Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
May 20, 2024

Conversation

jennifer-shehane
Copy link
Member

@jennifer-shehane jennifer-shehane commented May 14, 2024

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 jennifer-shehane changed the title fix: Add optional regex check for comma preceding 'but' in assertions… fix: Add optional regex check for comma preceding 'but' in assertions for command formatting May 14, 2024
Copy link

cypress bot commented May 14, 2024

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 ↗︎

@jennifer-shehane jennifer-shehane self-assigned this May 14, 2024
@jennifer-shehane jennifer-shehane merged commit 297abbb into develop May 20, 2024
80 of 82 checks passed
@jennifer-shehane jennifer-shehane deleted the opt-comma-check-command branch May 20, 2024 17:41
@cypress-bot
Copy link
Contributor

cypress-bot bot commented May 21, 2024

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 cypress-bot bot locked as resolved and limited conversation to collaborators May 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants