liveBook · Manning

Interaction

As explained in BDD in Action, Second Edition

A web interaction is a Screenplay-compatible operation that performs an action through a web interface without exposing the underlying browser-automation tool.

A web interaction is a Screenplay-compatible operation that performs an action through a web interface without exposing the underlying browser-automation tool. It represents a low-level activity, such as navigating, clicking, scrolling, or entering a value, while the actor performs it through an ability. section 15.1.3 section 15.2.5

Unlike conventional WebDriver code, Screenplay models an interaction as an object rather than a method call. The actor passes that object to attemptsTo(), so new behavior can be added through new interaction classes without changing existing classes. section 12.5.2 section 12.11

Interactions fit into Screenplay’s layered model:

  • Actors perform interactions using their abilities to access application interfaces. section 12.2
  • Tasks compose interactions into reusable, higher-level business activities. section 15.1.3
  • Questions retrieve application state for assertions rather than changing it. section 12.11

Composing a registration flow

A task can navigate to the home page and click the Register button: Navigate.to('/') followed by Click.on(Form.buttonCalled('Register')). The same interaction style can use Click.on(Toaster.message()) or Enter.the(value).into(input), while remaining independent of Playwright, WebdriverIO, or Selenium WebDriver. section 15.1.3 section 15.2.5

Figure 12.2 The Screenplay Pattern is an actor-centric model.

Use the actor-centric model to see how interactions connect actors, abilities, tasks, and questions. section 12.2

How BDD in Action, Second Edition covers it

How deep it goes
Explains interactions as command objects, composes them into tasks, and stops short of implementing the underlying integration layer.
Examples
Uses navigation, clicking, double-clicking, scrolling, text entry, registration flows, and toaster-message elements.
What it assumes
Assumes familiarity with actors, abilities, tasks, questions, and the system interfaces used by acceptance tests.
What you can do after
Apply it via Serenity/JS to compose portable web actions and reuse them inside higher-level tasks.
How it connects
Connects interactions to actors, abilities, tasks, questions, Page Elements, and the Command Pattern.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of BDD in Action, Second Edition. The section links point to the parts of the book it draws on.