cypress icon indicating copy to clipboard operation
cypress copied to clipboard

fix: Add optional regex check for comma preceding 'but' in assertions for command formatting

Open jennifer-shehane opened this issue 1 month ago • 1 comments

Additional details

When an assertion did not contain a comma preceding a 'but', we were not formatting the message correctly. This makes the comma optional in the assertion regex.

it('runs', () => {
  cy.get('div').should("have.length.greaterThan", 1)
})

Steps to test

Run test above within branch to see formatting is fixed.

I locally ran this repo against this branch to also ensure no catastrophic backtracking was introduced. https://github.com/tom-mi/cypress-visual-testing-error-demo

How has the user experience changed?

Before

Screenshot 2024-05-14 at 3 27 22 PM

After

Screenshot 2024-05-14 at 3 26 59 PM

PR Tasks

jennifer-shehane avatar May 14 '24 19:05 jennifer-shehane

9 flaky tests on run #55486 ↗︎

0 29255 1328 0 Flakiness 9

Details:

Merge branch 'develop' into opt-comma-check-command
Project: cypress Commit: c7fb7f3469
Status: Passed Duration: 19:50 💡
Started: May 20, 2024 2:32 PM Ended: May 20, 2024 2:52 PM
Flakiness  runner/runner.experimentalRetries.mochaEvents.cy.ts • 1 flaky test • app-e2e

View Output

Test Artifacts
... > hook failures > fail in [before] Test Replay Screenshots
Flakiness  e2e/origin/navigation.cy.ts • 1 flaky test • 5x-driver-electron

View Output

Test Artifacts
delayed navigation > errors > redirects to an unexpected cross-origin and calls another command in the cy.origin command Test Replay
Flakiness  e2e/origin/commands/waiting.cy.ts • 1 flaky test • 5x-driver-electron

View Output

Test Artifacts
... > throws when foo cannot resolve Test Replay
Flakiness  commands/net_stubbing.cy.ts • 1 flaky test • 5x-driver-chrome:beta

View Output

Test Artifacts
network stubbing > waiting and aliasing > yields the expected interception when two requests are raced Test Replay
Flakiness  commands/waiting.cy.js • 1 flaky test • 5x-driver-chrome:beta

View Output

Test Artifacts
... > waits for requestTimeout and responseTimeout override Test Replay

The first 5 flaky specs are shown, see all 8 specs in Cypress Cloud.

Review all test suite changes for PR #29517 ↗︎

cypress[bot] avatar May 14 '24 20:05 cypress[bot]

Released in 13.10.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to Cypress v13.10.0, please open a new issue.

cypress-bot[bot] avatar May 21 '24 20:05 cypress-bot[bot]