Serenity BDD 5.2.4 Release Notes

February 22, 2026 · View on GitHub

Screenplay + @UsePlaywright Integration, Reporting Improvements, and Dependency Updates

This release adds BrowseTheWebWithPlaywright.withPage(Page) for using Screenplay actors with @UsePlaywright-managed browsers, fixes a confusing duration label in the HTML report, and updates key dependencies.

What's New

Screenplay Support for @UsePlaywright

Previously, using @UsePlaywright with the Screenplay pattern created two separate browser instances — one managed by Playwright and one by Screenplay's BrowseTheWebWithPlaywright ability. The new withPage(Page) factory method lets a Screenplay actor wrap an externally-provided Page, reusing the @UsePlaywright browser:

@ExtendWith(SerenityJUnit5Extension.class)
@ExtendWith(SerenityPlaywrightExtension.class)
@UsePlaywright(ChromeHeadlessOptions.class)
class WhenSearchingTest {

    @BeforeEach
    void setUp(Page page) {
        Actor actor = Actor.named("Toby");
        actor.can(BrowseTheWebWithPlaywright.withPage(page));
    }

    @Test
    void shouldSearchForResults() {
        actor.attemptsTo(
            Open.url("https://example.com"),
            Ensure.that(PageTitle.of()).isEqualTo("Example Domain")
        );
    }
}

How It Works

  • withPage(page) creates a lightweight BrowseTheWebWithPlaywright ability wrapping the external page
  • The browser, context, and page are derived from the injected Page — no duplicate browser is created
  • On teardown, Screenplay only unregisters the page from Serenity; it does not close the Page, BrowserContext, Browser, or Playwright instance (the @UsePlaywright lifecycle owns those)
  • Screenshots and failure evidence capture work normally

Base Class Pattern

@ExtendWith(SerenityJUnit5Extension.class)
@ExtendWith(SerenityPlaywrightExtension.class)
@UsePlaywright(SerenityPlaywrightTest.ChromeHeadlessOptions.class)
public abstract class ScreenplayPlaywrightTest {

    protected Actor toby;

    @BeforeEach
    void setUpPlaywright(Page page) {
        toby = Actor.named("Toby");
        toby.can(BrowseTheWebWithPlaywright.withPage(page));
    }

    public static class ChromeHeadlessOptions implements OptionsFactory {
        @Override
        public Options getOptions() {
            return new Options()
                    .setHeadless(true)
                    .setLaunchOptions(
                            new BrowserType.LaunchOptions()
                                    .setArgs(Arrays.asList(
                                        "--no-sandbox",
                                        "--disable-extensions",
                                        "--disable-gpu"))
                    );
        }
    }
}

Report Labeling Fix (Issue #3723)

The HTML report's "Total Execution Time" field showed the cumulative sum of all individual test durations, which with parallel test execution can be many times larger than the actual wall clock time. This was confusing — a 13-hour test suite could show "4d 23h" because the sum of all parallel test durations was ~119 hours.

Before: "Total Execution Time" — unclear whether this is wall clock or cumulative

After: "Cumulative Test Time (sum of all individual test durations)" — clearly communicates this is the cumulative total across all threads

The "Total Duration" field (wall clock time from start to finish) is unchanged and continues to show the actual elapsed time.

Dependency Updates

DependencyPreviousUpdated
Selenium4.39.04.41.0
Cucumber7.33.07.34.2
JUnit 5 (junit-platform)6.0.16.0.3
AssertJ3.26.33.27.7
Byte Buddy1.18.31.18.5
SLF4J2.0.162.0.17

Maven Coordinates

<dependency>
    <groupId>net.serenity-bdd</groupId>
    <artifactId>serenity-screenplay-playwright</artifactId>
    <version>5.2.4</version>
    <scope>test</scope>
</dependency>

Documentation


Full Changelog: https://github.com/serenity-bdd/serenity-core/compare/5.2.3...5.2.4