- Home
- Skills
- Testing & Debugging
- Playwright E2E Test Writer and Flaky Test Fixer
Works with the AI Agents you already use
Playwright E2E Test Writer and Flaky Test Fixer
Writes Playwright end-to-end tests for real user journeys, fixes flaky tests from traces, and sets up CI sharding. Verdict STABLE, FLAKY or BROKEN.
$5
Playwright E2E Test Writer and Flaky Test Fixer
Example session with this skill installed
Our checkout test in tests/checkout.spec.ts passes locally but fails on CI about once every few runs. The cart is $50.00 and the SAVE10 coupon should take 10% off. Find the cause, fix it, and prove it is stable.
- Read your context and instructions
- Compiled the playwright e2e test
Playwright E2E: shop-web (Next.js) — FLAKY → STABLE after fix
Playwright version as reported by npx playwright --version in your repo · browsers: chromium, webkit
Diagnosis
Reproduced with npx playwright test tests/checkout.spec.ts --repeat-each=20 --retries=0:
3 of 20 runs failed on CI-like settings (--workers=4).
| Test | Cause | Evidence (trace step) | Fix |
|---|---|---|---|
| checkout › applies coupon | RACE | click Apply fired while GET /api/cart was pending; total re-rendered to old value | wait for the cart response before asserting |
| checkout › applies coupon | WRONG-LOCATOR | locator('.total') matched 2 elements (summary + mobile drawer) | getByRole('region', { name: 'Order summary' }) scope |
The waitForTimeout(2000) on line 31 hid the race locally and was removed.
Key code
test('applies coupon', async ({ page }) => {
await page.goto('/cart');
const summary = page.getByRole('region', { name: 'Order summary' });
await expect(summary.getByText('Subtotal')).toBeVisible();
const cartUpdated = page.waitForResponse(r =>
r.url().includes('/api/cart') && r.request().method() === 'POST');
await page.getByLabel('Coupon code').fill('SAVE10');
await page.getByRole('button', { name: 'Apply' }).click();
await cartUpdated;
await expect(summary.getByTestId('order-total')).toHaveText('$45.00');
});
Your prompt gave a $50.00 cart and a 10% coupon, so the expected total is $45.00.
Verify
--repeat-each=20 --retries=0: 20 of 20 passed, 0 flaky.
Changes
- tests/checkout.spec.ts: removed fixed sleep, scoped locators, awaited response
- eslint: added
@typescript-eslint/no-floating-promises - playwright.config.ts:
trace: 'on-first-retry',retriesCI-only (was 3 everywhere)
Commands to reproduce
npx playwright test tests/checkout.spec.ts --repeat-each=20 --retries=0 --workers=4
npx playwright show-report
Next steps
- Add
--fail-on-flaky-teststo the CI run once the suite is clean. - Create the coupon via API per test instead of relying on a shared seeded coupon.
Connects securely to your tools. The creator never sees your data.
About this skill
End-to-end suites usually fail in one of two ways: nobody writes them, or they get written fast with CSS selectors, fixed sleeps and shared test data, and then fail on CI one run in five until the team stops trusting them. This skill gives your coding agent a fixed method for Playwright that follows the playwright.dev guidance.
What it does:
- Detects your framework and any existing Playwright setup, or initializes one with baseURL, webServer, browser projects, CI-only retries and trace on first retry
- Picks 3 to 5 critical user journeys and writes one spec per journey with role, label and text locators, test IDs only as a fallback
- Uses auto-retrying web-first assertions and bans fixed sleeps and unawaited calls
- Sets up login once through an auth setup project and storageState, with per-test data created and cleaned up through the API
- Mocks third-party services with page.route
- In fix mode, reproduces flakes with repeat runs, reads the trace, classifies the cause (race, animation, shared state, order dependency, unawaited promise, wrong locator, CI timing, or a real app bug) and verifies the fix
- Adds a GitHub Actions workflow with sharding and a merged HTML report artifact
- Ends with a STABLE, FLAKY or BROKEN verdict based on actual run counts
Who it is for: frontend and full-stack developers, QA engineers and teams adding or rescuing a Playwright suite. TypeScript by default, with notes for pytest-playwright.
Honesty: the skill tells the agent to check versions and flags against playwright.dev or the CLI help, report only pass and fail counts it actually observed, and label real app bugs instead of hiding them behind retries or skips. The reference file reflects the docs as of October 2026.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Testing & Debugging.
The skill needs a runnable app (local or staging) and test credentials or seed data; it will not run against production with real payments. It follows playwright.dev as of October 2026, so new releases may add or change flags. Pass rates come only from runs the agent performs in your environment.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 29 days ago
- Software
- @playwright/testorpytest-playwrightPlaywright browsers
PythonPlaywright
Node.js
@playwright/test runs on Node.js; pytest-playwright runs on Python. Install browsers with npx playwright install.