Playwright
01 / 02

Cypress vs Playwright

Cypress vs Playwright

Feature            Playwright                  Cypress
────────────────────────────────────────────────────────────────
Browsers           Chrome, Firefox, Safari, Edge Chrome, Edge, Firefox (Electron)
Multi-tab/window   Yes                         Limited
iframes            Full support                Limited
Parallelisation    Built-in (sharding)         Paid (Cloud)
Speed              Faster                      Slower
API testing        Yes (request())             Yes
Language           TS/JS/Python/Java/.NET      JS/TS only
Auto-wait          Yes (all locators)          Yes
Time-travel debug  Trace viewer                Time-travel (built-in)
Community          Growing fast                Larger, mature
Pricing            Free, open source           Open source (Cloud paid)

When to choose Playwright:
- Multi-browser, multi-tab testing required
- Python/Java/.NET team
- CI performance matters
- Edge cases: iframes, shadow DOM, new tabs

When to choose Cypress:
- Team familiar with Cypress
- Love component testing integration
- Cypress Cloud for parallelisation already paid

E2E Testing Best Practices

  • Use data-testid sparingly — prefer accessible selectors (getByRole, getByLabel, getByText) that also verify accessibility

  • Avoid sleeping (waitForTimeout) — use waitForSelector, expect(locator).toBeVisible(), waitForURL, or waitForResponse instead

  • Test what users do, not implementation — focus on flows (sign up, checkout, search) not individual units

  • Reuse auth state — save storageState to file, reuse across tests. Avoid logging in on every test (slow)

  • Mock external services — use page.route() to intercept API calls; don't depend on real third-party services in tests

  • Keep tests independent — each test should set up its own state. Avoid test ordering dependencies. Use beforeEach for fresh state

Keep your own version of these notes — editable, searchable, and organised by your stack.

Start free