Skip to content

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.

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.

describe('sign in', () => {
it('opens the dashboard', () => {
cy.visit('/login');
cy.get('[data-testid="email"]').type('[email protected]');
cy.get('[data-testid="password"]').type('example-password');
cy.contains('button', 'Sign in').click();
cy.url().should('include', '/dashboard');
});
});
import { test, expect } from '@playwright/test';
test('opens the dashboard', async ({ page }) => {
await page.goto('/login');
await page.getByTestId('email').fill('[email protected]');
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.

  • 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 for repository workflows and self-healing for locator maintenance.