Annotation Interface PlaywrightCastMember


@Retention(RUNTIME) @Target(FIELD) public @interface PlaywrightCastMember
Annotation to inject an Actor with the BrowseTheWebWithPlaywright ability into a test. The actor will be configured with a Playwright browser based on the annotation attributes.

Usage example:

 
 @ExtendWith(SerenityJUnit5Extension.class)
 public class MyPlaywrightTest {

     @PlaywrightCastMember(name = "Alice")
     Actor alice;

     @PlaywrightCastMember(browserType = "firefox", headless = false)
     Actor bob;

     @Test
     void should_browse_with_playwright() {
         alice.attemptsTo(
             Open.url("https://example.com"),
             Ensure.that("h1").isVisible()
         );
     }
 }
 
 
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The browser type to use.
    A description of the actor, which will appear alongside the actor name in reports.
    boolean
    Whether to run the browser in headless mode.
    The name of the actor.
  • Element Details

    • name

      String name
      The name of the actor. If not specified, the capitalized field name will be used.
      Default:
      ""
    • description

      String description
      A description of the actor, which will appear alongside the actor name in reports.
      Default:
      ""
    • browserType

      String browserType
      The browser type to use. Supported values are "chromium", "firefox", and "webkit". Default is "chromium".
      Default:
      "chromium"
    • headless

      boolean headless
      Whether to run the browser in headless mode. Default is true.
      Default:
      true