Langsung ke konten
Skillpedia
Testing48k Β· #5456

playwright-java

Fungsinya

Alat ini membantu membuat tes otomatis untuk memeriksa apakah sebuah website berfungsi dengan benar. Kodenya diatur sedemikian rupa agar lebih mudah dirawat dan dikerjakan bersama di proyek berskala besar.

Kapan dipakai

  • βœ“Saat memulai proyek pengujian website baru.
  • βœ“Saat menulis kode untuk menguji fitur tertentu di website.
  • βœ“Saat Anda membutuhkan laporan detail tentang hasil tes.

Link skill

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

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/playwright-java/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œBuatkan tes otomatis untuk halaman login menggunakan pola Page Object Model.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Alat ini menggunakan pola bernama 'Page Object Model' untuk mengatur kode. Setiap halaman website memiliki representasi dalam bentuk kode, dan tes berinteraksi dengan representasi tersebut.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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();

…
Pertanyaan umum

Apa itu 'Page Object Model'?

Ini adalah cara mengatur kode tes di mana setiap halaman website (atau bagian dari halaman) menjadi sebuah objek dalam kode. Dengan cara ini, tes lebih mudah dibaca dan dirawat.

Apa itu 'parallel tests'?

Artinya beberapa tes dijalankan pada saat yang bersamaan, sehingga proses pemeriksaan website menjadi lebih cepat.

Apa itu 'Allure reports'?

Ini adalah laporan visual dan detail yang menampilkan hasil setiap tes, termasuk langkah-langkahnya, screenshot, dan log.

Detail

Deskripsi asli dari pembuat

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

Popularitas

Bintang GitHub
48k
Peringkat
#5456
Lisensi
MIT
Diperbarui
15/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa