<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/playwright-anti-patterns-what-to-watch-for-ygrjj2udw" -->

---
title: Playwright Anti-Patterns: What to Watch For | daily.dev
description: A deep diagnostic guide to structural problems that accumulate in Playwright test suites as they scale, covering isolation issues (shared module-level state,...
canonical: https://daily.dev/posts/playwright-anti-patterns-what-to-watch-for-ygrjj2udw
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Playwright Anti-Patterns: What to Watch For | daily.dev
og:description: A deep diagnostic guide to structural problems that accumulate in Playwright test suites as they scale, covering isolation issues (shared module-level state,...
og:url: https://daily.dev/posts/playwright-anti-patterns-what-to-watch-for-ygrjj2udw
og:image: https://api.daily.dev/og/posts/yGrjj2UdW.png
og:image:alt: Playwright Anti-Patterns: What to Watch For
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Playwright Anti-Patterns: What to Watch For

**[Currents](https://daily.dev/sources/currents)** · 29 min read · 0 upvotes · 0 comments

## Summary

A deep diagnostic guide to structural problems that accumulate in Playwright test suites as they scale, covering isolation issues (shared module-level state, order-dependent tests, shared test accounts, disabling parallelism), fragile selector strategies (CSS/XPath selectors, overly broad text selectors, index-based locators), timing anti-patterns (waitForTimeout, premature navigation assertions, over-reliance on networkidle), fixture and architecture problems (logic-heavy beforeEach hooks, god fixtures, shared storageState misuse, DOM-mirroring page objects, UI-based setup, over-mocking), suite strategy gaps (missing test taxonomy, undefined flake budgets), configuration issues (monolithic config, parallelism tuning, retry strategy), and observability gaps (no cross-run visibility, unused traces/artifacts). Each pattern is explained with the underlying mechanism and a concrete fix, with references to Playwright's built-in features like fixtures, projects, --grep tagging, and trace recording.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://currents.dev/posts/playwright-anti-patterns>

## Questions this post answers

### Why does my Playwright test pass locally but fail intermittently in CI under parallel workers?

Shared mutable state is the most common cause, such as module-level variables assigned in test.beforeAll that don't reset between tests in the same worker process, or shared test accounts across parallel workers where one worker modifies data while another reads it. Playwright discards a worker after a failure, but earlier passing tests within the same worker can still corrupt state for tests that follow them.

_Anyone debugging flaky parallel test runs can track Playwright troubleshooting patterns like this on daily.dev._

### Should I use page.waitForTimeout() to fix a flaky Playwright test?

No, a fixed delay like page.waitForTimeout(2000) is almost always the wrong fix because it's simultaneously too long, adding unnecessary tax on every run, and too short under CI load or slow external services. Playwright's auto-waiting on locator assertions like expect(locator).toBeVisible() handles most readiness scenarios; waitForResponse gives a deterministic condition when explicit coordination is needed.

_Developers chasing flaky waits can follow practical Playwright timing fixes like these on daily.dev._

### Is waitForLoadState('networkidle') a reliable way to know a Playwright page is ready?

No, networkidle only means there have been no network connections for about 500ms, which is a poor readiness signal for apps with background polling, analytics beacons, WebSockets, or long-polling endpoints where it either never fires or fires unpredictably. Playwright now discourages using it as a general readiness check and recommends concrete web assertions like DOM, text, or locator checks instead.

_Teams choosing the right wait strategy for their app can compare Playwright approaches on daily.dev._

## Similar posts on daily.dev

- [Self-Healing Playwright: AI Browser Automation Guide](https://daily.dev/posts/self-healing-playwright-ai-browser-automation-guide-ekvw8feem) · Alex CloudStar · 7 upvotes · 2 comments
- [Playwright Tags and Annotations: Organize Large CI Suites](https://daily.dev/posts/playwright-tags-and-annotations-organize-large-ci-suites-s0yxpg2ir) · Currents · 0 upvotes · 0 comments
- [How to Build Reliable Stateful Browser Automation with Playwright](https://daily.dev/posts/how-to-build-reliable-stateful-browser-automation-with-playwright-qqzelgknv) · SitePoint · 1 upvotes · 1 comments
- [Mastering waits and timeouts in Playwright](https://daily.dev/posts/mastering-waits-and-timeouts-in-playwright-a1pw100gb) · CircleCI · 0 upvotes · 0 comments

---

Tags: [#cicd](https://daily.dev/tags/cicd), [#testing](https://daily.dev/tags/testing)

[View this post on daily.dev](https://daily.dev/posts/playwright-anti-patterns-what-to-watch-for-ygrjj2udw)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Playwright Anti-Patterns: What to Watch For","url":"https://daily.dev/posts/playwright-anti-patterns-what-to-watch-for-ygrjj2udw","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/playwright-anti-patterns-what-to-watch-for-ygrjj2udw"},"datePublished":"2026-09-06T08:56:38.947Z","dateModified":"2026-10-14T02:26:13.418Z","description":"A deep diagnostic guide to structural problems that accumulate in Playwright test suites as they scale, covering isolation issues (shared module-level state,...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ed4d91018d58a5b60f624310289fc976?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ed4d91018d58a5b60f624310289fc976?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Currents","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Currents","logo":"https://media.daily.dev/image/upload/s--RxsiMZ1S--/f_auto,q_auto/v1788684994/logos/currents?_a=BAMAMicg0","url":"https://daily.dev/sources/currents"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/playwright-anti-patterns-what-to-watch-for-ygrjj2udw","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"cicd,testing","timeRequired":"PT29M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Currents","item":"https://daily.dev/sources/currents"},{"@type":"ListItem","position":3,"name":"Playwright Anti-Patterns: What to Watch For"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/playwright-anti-patterns-what-to-watch-for-ygrjj2udw#faq","mainEntity":[{"@type":"Question","name":"Why does my Playwright test pass locally but fail intermittently in CI under parallel workers?","acceptedAnswer":{"@type":"Answer","text":"Shared mutable state is the most common cause, such as module-level variables assigned in test.beforeAll that don't reset between tests in the same worker process, or shared test accounts across parallel workers where one worker modifies data while another reads it. Playwright discards a worker after a failure, but earlier passing tests within the same worker can still corrupt state for tests that follow them. Anyone debugging flaky parallel test runs can track Playwright troubleshooting patterns like this on daily.dev."}},{"@type":"Question","name":"Should I use page.waitForTimeout() to fix a flaky Playwright test?","acceptedAnswer":{"@type":"Answer","text":"No, a fixed delay like page.waitForTimeout(2000) is almost always the wrong fix because it's simultaneously too long, adding unnecessary tax on every run, and too short under CI load or slow external services. Playwright's auto-waiting on locator assertions like expect(locator).toBeVisible() handles most readiness scenarios; waitForResponse gives a deterministic condition when explicit coordination is needed. Developers chasing flaky waits can follow practical Playwright timing fixes like these on daily.dev."}},{"@type":"Question","name":"Is waitForLoadState('networkidle') a reliable way to know a Playwright page is ready?","acceptedAnswer":{"@type":"Answer","text":"No, networkidle only means there have been no network connections for about 500ms, which is a poor readiness signal for apps with background polling, analytics beacons, WebSockets, or long-polling endpoints where it either never fires or fires unpredictably. Playwright now discourages using it as a general readiness check and recommends concrete web assertions like DOM, text, or locator checks instead. Teams choosing the right wait strategy for their app can compare Playwright approaches on daily.dev."}}]}
```

