Skip to content
Skillpedia
Testing48k · #3842

playwright-java

Helps your agent write and debug thorough tests for web applications using Java. It's useful for ensuring everything works well before releasing software.

What it does

This tool helps create automated tests to check if a website functions correctly. It organizes the code to make maintenance and collaboration easier on large projects.

When to use it

  • ✓When starting a new website testing project.
  • ✓When writing code to test specific website features.
  • ✓When you need detailed reports about the tests.

Example of what to ask your AI

“Create an automated test for the login page using the Page Object Model pattern.”

Want more? Open the sections below.

How to use

The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.

Skill link

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/playwright-java/SKILL.md

Ready-to-paste message

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/playwright-java/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
How it works

The tool uses a pattern called 'Page Object Model' to organize the code. Each page of the website has its code representation, and tests interact with these representations.

Installation

Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.

In the terminal (Claude Code, Codex, Cursor), in your project folder:

npx skills add sickn33/agentic-awesome-skills --skill playwright-java

Or download just the file:

curl -L https://raw.githubusercontent.com/sickn33/agentic-awesome-skills/main/plugins/agentic-awesome-skills-claude/skills/playwright-java/SKILL.md -o SKILL.md
Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Supporting material availability

This catalog copy contains the inline guidance below, but does not include the following supporting paths. They are external prerequisites, not bundled files:

  • <support-root>/references/config.md
  • <support-root>/references/page-objects.md
  • <support-root>/references/assertions.md
  • <support-root>/references/fixtures.md
  • <support-root>/templates/BaseTest.java
  • <support-root>/templates/BasePage.java
  • src/test/resources/junit-platform.properties

Ask for the original supporting material or an existing installation before using a step that depends on these paths; this catalog does not identify a verified download source for them. Resolve each path relative to that installation, inspect its contents, and verify any applicable license and execution prerequisites. Do not run a command or claim a referenced procedure was followed until its required file exists. Do not fabricate the missing scripts or treat an unrelated file with the same name as equivalent. Independent steps fully documented here can proceed within the user’s authorized scope; report any dependent step as unavailable.

Playwright Java – Advanced Test Automation

Overview

This skill produces production-quality, enterprise-grade Playwright Java test code. It enforces the Page Object Model (POM), strict locator strategies, thread-safe parallel execution, and full Allure reporting integration. Targets Java 17+ and Playwright 1.44+.

Supporting reference files are available for deeper topics:

Topic File
Maven POM, ConfigReader, Docker/CI setup references/config.md
Component pattern, dropdowns, uploads, waits references/page-objects.md
Full assertion API, soft assertions, visual testing references/assertions.md
Fixtures, test data factory, auth state, retry references/fixtures.md
Drop-in base class templates templates/BaseTest.java, templates/BasePage.java

When to Use This Skill

  • Use when scaffolding a new Playwright Java project from scratch
  • Use when writing Page Object classes or JUnit 5 test classes
  • Use when the user asks about cross-browser testing, parallel execution, or Allure reports
  • Use when fixing flaky tests or replacing Thread.sleep() with proper waits
  • Use when setting up Playwright in CI/CD pipelines (GitHub Actions, Jenkins, Docker)
  • Use when combining API calls and UI assertions in a single test (hybrid testing)
  • Use when the user mentions "POM pattern", "BrowserContext", "Playwright fixtures", or "traces"

How It Works

Step 1: Decide the Approach

Use this matrix to pick the right pattern before writing any code:

User Request Approach
New project from scratch Full scaffold — see references/config.md
Single feature test POM page class + JUnit5 test class
API + UI hybrid APIRequestContext alongside Page
Cross-browser @MethodSource parameterized over browser names
Flaky test fix Replace sleep with waitFor / waitForResponse
CI integration playwright install --with-deps in pipeline
Parallel execution junit-platform.properties + ThreadLocal
Rich reporting Allure + Playwright trace + video recording

Step 2: Scaffold the Project Structure

Always use this layout when creating a new project:

src/
├── test/
│   ├── java/com/company/tests/
│   │   ├── base/
│   │   │   ├── BaseTest.java        ← templates/BaseTest.java
│   │   │   └── BasePage.java        ← templates/BasePage.java
│   │   ├── pages/
│   │   │   └── LoginPage.java
│   │   ├── tests/
│   │   │   └── LoginTest.java
│   │   ├── utils/
│   │   │   ├── TestDataFactory.java
│   │   │   └── WaitUtils.java
│   │   └── config/
│   │       └── ConfigReader.java
│   └── resources/
│       ├── test.properties
│       ├── junit-platform.properties
│       └── testdata/users.json
pom.xml

Step 3: Set Up Thread-Safe BaseTest

public class BaseTest {
    protected static ThreadLocal<Playwright>     playwrightTL = new ThreadLocal<>();
    protected static ThreadLocal<Browser>        browserTL    = new ThreadLocal<>();
    protected static ThreadLocal<BrowserContext> contextTL    = new ThreadLocal<>();
    protected static ThreadLocal<Page>           pageTL       = new ThreadLocal<>();

    protected Page page() { return pageTL.get(); }

    @BeforeEach
    void setUp() {
        Playwright playwright = Playwright.create();

…
FAQ

What is 'Page Object Model'?

It's a way to organize test code where each website page (or part of it) becomes an object in the code. This makes tests easier to read and maintain.

What are 'parallel tests'?

It means running multiple tests at the same time, which speeds up the website verification process.

What are 'Allure reports'?

These are visual and detailed reports that show the outcome of each test, including steps, screenshots, and logs.

Details

Original description by the author

Scaffold, write, debug, and enhance enterprise-grade Playwright E2E tests in Java using Page Object Model, JUnit 5, Allure reporting, and parallel execution.

repo: sickn33/agentic-awesome-skills

Popularity

GitHub stars
48k
Ranking position
#3842
License
MIT
Updated
10/15/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills