> Full documentation index: [llms.txt](https://docs.qualitymax.io/llms.txt)

# Migrate Cypress to Playwright

QualityMax automation scripts use Playwright. Cypress suites are migrated in the repository: inventory the suite, establish consistent mappings, convert shared setup before leaf tests, and run both suites until coverage and behavior match.

## Start with a migration inventory

Record Cypress spec counts, test counts, custom commands, fixtures, plugins, browser targets, CI jobs, and skipped tests. Choose one representative flow first. Keep Cypress installed until the Playwright suite passes on the same supported browsers and CI environment.

### Before: Cypress

```js
describe('sign in', () => {
  it('opens the dashboard', () => {
    cy.visit('/login');
    cy.get('[data-testid="email"]').type('user@example.com');
    cy.get('[data-testid="password"]').type('example-password');
    cy.contains('button', 'Sign in').click();
    cy.url().should('include', '/dashboard');
  });
});
```

### After: runnable Playwright

```js
import { test, expect } from '@playwright/test';

test('opens the dashboard', async ({ page }) => {
  await page.goto('/login');
  await page.getByTestId('email').fill('user@example.com');
  await page.getByTestId('password').fill('example-password');
  await page.getByRole('button', { name: 'Sign in' }).click();
  await expect(page).toHaveURL(/\/dashboard/);
});
```

Run with `npx playwright test`. Store real credentials outside source control; the example values are placeholders.

## Map the suite, not only selectors

- Replace `cy.intercept()` with `page.route()` or response waits.
- Replace custom commands with Playwright fixtures or helpers.
- Replace `cy.session()` with a reviewed `storageState` setup.
- Prefer role, label, and test-id locators over generated CSS or positional selectors.
- Remove fixed waits where a web-first assertion can express the actual readiness condition.

Add the converted tests to the appropriate QualityMax project after they pass locally. Compare test intent, assertions, fixtures, screenshots, retries, browser coverage, and CI artifacts before removing Cypress.

See [CLI and local agent](/quickstart-cli/) for repository workflows and [self-healing](/self-healing/) for locator maintenance.
