All skills
fugazi avatar

/playwright-e2e-testing

@96feaff

Author and maintain versioned Playwright (@playwright/test) TypeScript UI specs for browser user flows. Use when asked to create, run, debug, or refactor E2E tests, form/navigation/auth flows, responsive checks, UI mocking, fixtures, Page Objects, or visual comparisons. Use api-testing for standalone REST/GraphQL contracts and playwright-cli for live browser sessions. Keywords: E2E spec, Playwright test, POM, fixtures, UI regression.

Use this Skill: https://skilld.dev/gh/fugazi/test-automation-skills-agents/playwright-e2e-testing

This session only. Nothing lands on disk.

referencesfile-map-template.md

≈965 tokens on demand. Your agent reads this file only when SKILL.md points to it.

File Map Template (Playwright TypeScript)

Part of the playwright-e2e-testing skill. See SKILL.md for full context.

When agents generate test code for a target project, they must follow this structure. Copy this section into the target project's CLAUDE.md or test configuration.

Recommended Project Structure

tests/
├── pages/                      # Page Object Models
│   └── {feature}/
│       └── {name}.page.ts      # One POM per page/component
├── fixtures/
│   ├── test-base.ts            # Custom test with merged fixtures
│   └── {scope}.fixture.ts      # Auth, cart, API fixtures
├── data/
│   ├── users.data.ts           # User credentials and roles
│   ├── {entity}.data.ts        # Feature-specific test data
│   └── factories/              # Optional: data factories
├── helpers/
│   └── {name}.helper.ts        # Reusable test utilities
└── e2e/
    └── {feature}/
        └── {name}.spec.ts      # Test specs by feature

Naming Conventions

Type Pattern Example
Page Object {name}.page.ts login.page.ts, cart.page.ts
Spec {name}.spec.ts login.spec.ts, checkout.spec.ts
Fixture {scope}.fixture.ts auth.fixture.ts, cart.fixture.ts
Data {entity}.data.ts users.data.ts, products.data.ts
Helper {name}.helper.ts api.helper.ts, date.helper.ts

Fixture System (DI)

All tests import from the custom fixture base — never from @playwright/test directly in specs.

// tests/fixtures/test-base.ts
import { mergeTests } from "@playwright/test";
import { pagesTest } from "./pages.fixture";
import { authTest } from "./auth.fixture";

export const test = mergeTests(pagesTest, authTest);
export { expect };
// tests/fixtures/pages.fixture.ts
import { test as base } from "@playwright/test";
import { LoginPage } from "../pages/auth/login.page";
import { HomePage } from "../pages/home/home.page";

type Pages = {
  loginPage: LoginPage;
  homePage: HomePage;
};

export const pagesTest = base.extend<Pages>({
  loginPage: async ({ page }, use) => await use(new LoginPage(page)),
  homePage: async ({ page }, use) => await use(new HomePage(page)),
});

Spec Template

// tests/e2e/{feature}/{name}.spec.ts
import { test, expect } from "../fixtures/test-base";
import { USERS } from "../data/users.data";

test.describe("Feature Name", () => {
  test("should do something", async ({ homePage, loginPage }) => {
    await test.step("Navigate to feature", async () => {
      await homePage.goto();
    });

    await test.step("Perform action", async () => {
      await loginPage.login(USERS.customer);
    });

    await test.step("Verify result", async () => {
      await expect(homePage.dashboard).toBeVisible();
    });
  });
});

POM Template

// tests/pages/{feature}/{name}.page.ts
import { expect, Locator, Page } from "@playwright/test";

export class ExamplePage {
  readonly heading: Locator;
  readonly actionButton: Locator;

  constructor(private readonly page: Page) {
    this.heading = page.getByRole("heading", { name: "Example" });
    this.actionButton = page.getByRole("button", { name: "Action" });
  }

  async goto(): Promise<void> {
    await this.page.goto("/example");
  }

  async performAction(): Promise<void> {
    await this.actionButton.click();
  }
}

Usage

Copy the "Recommended Project Structure" section into the target project's CLAUDE.md under a ## File Map heading. Agents will use this to place files in the correct directories.

Source: SKILL.md on GitHub

1 warning16d4 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    No security issues detected. The skill provides standard and safe instructions for authoring Playwright E2E tests, following best practices for locator usage and Page Object Model implementation.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer7mo

    3/5 files flagged

Signed by skilld at 96feaff. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 4 days ago.

Activeupdated 2 months ago

README badge

README badge for fugazi/test-automation-skills-agents/playwright-e2e-testing