- Home
- Skills
- Testing & Debugging
- Fix Flaky Playwright Tests by Auditing Locators and Waits
Fix Flaky Playwright Tests by Auditing Locators and Waits
Runs offline with zero-dependency Python across TypeScript, JavaScript, and Python test files without installing Playwright or launching a browser.
$19
Works with the AI Agents you already use
Fix Flaky Playwright Tests by Auditing Locators and Waits
Example session with this skill installed
Audit the Playwright tests in ./tests/auth.spec.ts for flakiness and brittle locators. Use markdown format.
- Read your context and instructions
- Compiled the fix flaky playwright
I have completed the static audit of ./tests/auth.spec.ts. I found 4 issues related to brittle selectors and manual wait calls that likely cause intermittent failures in CI.
Playwright Audit Report: auth.spec.ts
| Severity | Line | Issue | Recommendation |
|---|---|---|---|
| High | 14 | Hardcoded page.waitForTimeout(3000) | Replace with expect(locator).toBeVisible() or page.waitForSelector(). |
| Medium | 22 | Brittle CSS selector button.btn-primary.active | Use page.getByRole('button', { name: 'Submit' }) for accessibility. |
| Medium | 45 | Non-retrying assertion expect(val).toBe(true) | Use await expect(locator).toHaveText() to benefit from auto-retries. |
| Low | 58 | XPath locator //div[@id='user-profile']/span[2] | Use page.getByTestId('profile-name') or a more resilient text locator. |
Next steps
- Replace the hardcoded sleep on line 14 with a web-first assertion to reduce test duration and flakiness.
- Update the CSS and XPath selectors to use Playwright's recommended Locators API.
- Re-run the audit with the
--strictflag to ensure all issues are resolved.
Connects securely to your tools. The creator never sees your data.
About this skill
For web engineers and QA teams tired of flaky AI-generated Playwright suites: pinpoint fixed sleeps, networkidle waits, brittle CSS/XPath selectors, and unclosed browser/context/page allocations with concrete replacement guidance before CI runs. Runs offline with zero-dependency Python across TypeScript, JavaScript, and Python test files without installing Playwright or launching a browser.
Each finding includes a path, physical line number, evidence, and a practical replacement. Comments and string literals are masked before matching. Reports in JSON, CSV, Markdown, or text; add --strict to exit 1 when findings exist so CI can gate on it.
Limits: this is a static single-file check, not a browser runner. It does not follow a shared Page Object or helper, cannot reproduce runtime flakiness, and its resource-lifetime analysis is a conservative local heuristic. Confirm remaining timing issues with a real CI run.
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.
Static single-file check, not a browser runner. Does not follow a shared Page Object or helper, so issues hidden there are not expanded. Cannot reproduce runtime flakiness; confirm remaining timing issues with a real CI run. Resource-lifetime analysis is a conservative local heuristic. Reads UTF-8/UTF-8 BOM source and rejects UTF-16.
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 today
- Software
Python