Why is this an issue?

Cypress and Playwright provide helpers such as cy.pause(), cy.debug(), and page.pause() for interactive debugging while developing a UI test. These helpers are useful during a local investigation, but they should not remain in committed test code.

When a UI test debug helper is left in the suite:

Code examples

Noncompliant code example

// Cypress
it('saves a user', () => {
  cy.get('button.save').debug().click(); // Noncompliant
  cy.pause();                            // Noncompliant
  cy.contains('Saved').should('be.visible');
});

Compliant solution

// Cypress
it('saves a user', () => {
  cy.get('button.save').click();
  cy.contains('Saved').should('be.visible');
});

Noncompliant code example

// Playwright
test('saves a user', async ({ page }) => {
  await page.getByRole('button', { name: 'Save' }).click();
  await page.pause(); // Noncompliant
  await expect(page.getByText('Saved')).toBeVisible();
});

Compliant solution

// Playwright
test('saves a user', async ({ page }) => {
  await page.getByRole('button', { name: 'Save' }).click();
  await expect(page.getByText('Saved')).toBeVisible();
});

Resources

Documentation

Related rules