← All projects

Featured project 3 · Java · Web + API

Playwright for Java Framework

UI, API and network test automation with Playwright for Java and TestNG: the Sauce Demo shop and the Restful Booker API, 57 tests run in CI on Chromium, Firefox and WebKit.

Live CI status of Playwright for Java Framework

View source code View documentation View latest CI runs View test report

Purpose

Shows Playwright in a Java/TestNG stack, the combination many Java teams move to from Selenium: UI tests on Sauce Demo, API tests on Restful Booker through Playwright's own request context, and network control in the browser.

Technology stack

AreaTools
LanguageJava 17
Browser and API automationPlaywright for Java 1.63 (Chromium, Firefox, WebKit; APIRequestContext)
Test runnerTestNG 7.12 (groups, data providers, parallel classes)
JSONJackson (Java records)
ReportCustom TestNG IReporter: one HTML file with screenshots, videos and traces
CIGitHub Actions: one job per browser engine

Architecture overview

tests (ui, api, network, interview, framework)
      │
pages (PageFactory: @TestId, @Role, @Placeholder ...)     api (ApiClient, BookingApi, records)
      │                                                     │
BrowserManager: Playwright + browser per thread,     Playwright APIRequestContext
context per test, trace + video
      │
Chromium / Firefox / WebKit

Key engineering decisions

Implemented features

Setup and execution

mvn exec:java -Dexec.args="install"   # once: download Chromium, Firefox and WebKit
mvn clean test                        # all tests, headless Chromium
mvn clean test -Dbrowser=firefox      # chromium, firefox or webkit
mvn clean test -Dgroups=api           # one group

Sample test results

Playwright for Java HTML report
The custom HTML report (this run includes the deliberate demo failures).

CI workflow

On every push and pull request: one job each for Chromium, Firefox and WebKit; each installs its browser with the Linux libraries it needs, runs the tests headless and keeps the HTML report plus any failure screenshots, videos and traces as an artifact.

Known limitations and future improvements

Limitations

Next steps