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.

referencesdebugging-tracing-logging.md

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

Debugging: Trace Viewer, Verbose Logging & Screenshots

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

Related: this file was split from the original debugging.md. See the other debugging-*.md files in this folder for related sections.

Trace Viewer

Post-mortem debugging with recorded traces:

Enable Traces

// playwright.config.ts
export default defineConfig({
  use: {
    trace: "on-first-retry", // Record on retry
    // trace: 'on',                  // Always record
    // trace: 'retain-on-failure',   // Keep only on failure
  },
});

View Traces

# From HTML report
npx playwright show-report

# Directly open trace file
npx playwright show-trace trace.zip

# View remote trace
npx playwright show-trace https://example.com/trace.zip

Manual Trace Recording

test("with trace", async ({ page, context }) => {
  // Start recording
  await context.tracing.start({
    screenshots: true,
    snapshots: true,
    sources: true,
  });

  await page.goto("/");
  await page.getByRole("button").click();

  // Stop and save
  await context.tracing.stop({ path: "traces/my-trace.zip" });
});

Verbose Logging

Enable Playwright debug logs:

# All Playwright logs
DEBUG=pw:api npx playwright test

# Specific channels
DEBUG=pw:browser npx playwright test
DEBUG=pw:protocol npx playwright test

# Multiple channels
DEBUG=pw:api,pw:browser npx playwright test

# Windows PowerShell
$env:DEBUG="pw:api"; npx playwright test

Log Channels

Channel Description
pw:api Playwright API calls
pw:browser Browser logs
pw:protocol CDP/WebSocket messages
pw:webserver Web server logs

Screenshots & Videos

Configuration

// playwright.config.ts
export default defineConfig({
  use: {
    screenshot: "only-on-failure", // 'on' | 'off' | 'only-on-failure'
    video: "retain-on-failure", // 'on' | 'off' | 'retain-on-failure'
  },
});

Manual Screenshots

test("capture state", async ({ page }) => {
  await page.goto("/");

  // Full page screenshot
  await page.screenshot({ path: "screenshots/full.png", fullPage: true });

  // Element screenshot
  await page.getByTestId("chart").screenshot({ path: "screenshots/chart.png" });

  // With mask for dynamic content
  await page.screenshot({
    path: "screenshots/masked.png",
    mask: [page.getByTestId("timestamp")],
  });
});

Attach to Report

test("with attachments", async ({ page }, testInfo) => {
  await page.goto("/");

  // Attach screenshot on failure
  if (testInfo.status !== testInfo.expectedStatus) {
    const screenshot = await page.screenshot();
    await testInfo.attach("failure-screenshot", {
      body: screenshot,
      contentType: "image/png",
    });
  }
});

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