Playwright Java Framework
A lightweight UI + API test automation framework built with Java, Playwright, Cucumber (Gherkin), and JUnit 5. Designed for clean, readable BDD scenarios and easy CI/CD integration.
Features
UI Testing (Playwright)
- Fast, reliable browser automation using Playwright for Java
- Reusable page actions and selectors
- Parameterised login steps
- Positive & negative authentication flows
- Automatic waits and resilient element handling
API Testing
- Uses Java HTTP Client
- Clean JSON parsing via Jackson
JsonNode - Structured assertions (no string-based assertions)
- Authentication scenarios with valid & invalid data
BDD Support
- Gherkin feature files (
.feature) - Step definitions mapped cleanly to UI and API tests
- Full Cucumber JUnit 5 integration
Reporting
- Standard Maven Surefire reports
- HTML reports generated automatically
- JUnit XML results for CI/CD dashboards
Project Structure
src/
├─ test/
│ ├─ resources/
│ │ └─ features/
│ │ └─ example.feature
│ └─ java/
│ ├─ steps/
│ ├─ api/
│ └─ support/
playwright.config
pom.xml
README.md
Prerequisites
- Java 17+
- Maven 3.8+
- Node is NOT required (Playwright Java manages browsers itself)
Quick Start
Get started with the framework in minutes:
- Clone the repository
- Install dependencies with Maven
- Install Playwright browsers
- Set environment variables
- Run your first test
Ready to get started?
Check out the Getting Started guide for detailed installation and setup instructions.
Example Test
Here's a simple example of a Gherkin feature file:
Feature: Login
@ui
Scenario: Successful login
Given I open the Domtree login page
When I log in with username "domtree-test" and password "domtree-password"
Then I should see the login success message