Files
magnus919_agent-skills/playwright/templates/example.spec.ts
T
Magnus HedemarkGitHubfactory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
ac1beb117d feat(skill): add Playwright skill (E2E testing + scraping + headless browsing) (#264)
Add ONE tool skill for Playwright: SKILL.md covering E2E test authoring,
selector robustness, network interception/mocking, parallel workers, CI
integration, scraping/headless patterns, accessibility snapshot checks, and
headed debugging; scripts/pwrun (agent-first smoke harness with --json,
fixture-tested); templates/ test-suite scaffold; eight dated references; a
schema-valid evals/evals.json (6 cases); a human-facing README; reverse
routing from qa-methodology and frontend-engineering; top-level README index
entry; and regenerated catalogs (llms.txt, marketplace, codex).

Closes #244.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-08-03 17:59:38 -04:00

26 lines
948 B
TypeScript

import { test, expect } from '@playwright/test';
/**
* Spec scaffold: one spec per user journey, described in prose, located by
* user-facing roles/labels, asserted with web-first assertions. Copy into
* e2e/ and adapt the [fill: ...] markers.
*/
test.describe('[fill: feature under test]', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/'); // [fill: app entry route, relative to baseURL]
});
test('[fill: the behavior in one sentence]', async ({ page }) => {
// Prefer getByRole / getByLabel / getByText over CSS that encodes markup.
await page.getByRole('button', { name: '[fill: button label]' }).click();
// Web-first assertions auto-retry until the timeout; never use
// page.waitForTimeout() to "fix" a race.
await expect(
page.getByRole('heading', { level: 1 }),
).toHaveText('[fill: expected heading]');
await expect(page).toHaveURL(/\/[fill: path-pattern]/);
});
});