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: studio generated assertions now use proper past tense for assertions #28593

Merged
merged 3 commits into from
Dec 28, 2023

Conversation

jennifer-shehane
Copy link
Member

@jennifer-shehane jennifer-shehane commented Dec 27, 2023

Additional details

When you generate assertions within Cypress Studio, we insert a little preview of the assertions right away while the assertions are being written to your code. It doesn't refresh and run what is in your codebase right away - it generates a fake preview.

Previously this preview was showing the text 'expect....' for assertions, but in reality assertions always show in the past tense as 'expected...'. You can see this behavior after saving the commands - when they run, it switches from 'expect' to 'expected'

I found this while working on this PR because I created a regex to capture all assertion text and this was the one test that failed and borked up when going through the regex. Baffling!

Well the hard written generated assertion is incorrect and the test was written to verify the incorrect behavior. This updates both.

Steps to test

Not sure I would bother with a true test to prevent this in the future. 🤔 But you can run cypress with studio, add an assertion - see that it writes 'expected' and then the same thing after saving the file should display as 'expected'.

How has the user experience changed?

Before

Screen Shot 2023-12-27 at 3 22 26 PM

After

Screen Shot 2023-12-27 at 3 22 42 PM

PR Tasks

Copy link

cypress bot commented Dec 27, 2023

31 flaky tests on run #53055 ↗︎

0 28305 1347 0 Flakiness 31

Details:

Merge branch 'develop' into fix-studio-generated-assertions
Project: cypress Commit: ff5a839690
Status: Passed Duration: 18:48 💡
Started: Dec 28, 2023 3:18 PM Ended: Dec 28, 2023 3:36 PM
Flakiness  commands/files.cy.js • 1 flaky test • 5x-driver-electron

View Output

Test Artifacts
... > passes through assertion error when not about existence Test Replay
Flakiness  cypress/cypress.cy.js • 3 flaky tests • 5x-driver-electron

View Output

Test Artifacts
... > correctly returns currentRetry Test Replay
... > correctly returns currentRetry Test Replay
... > correctly returns currentRetry Test Replay
Flakiness  runs.cy.ts • 2 flaky tests • app-e2e

View Output

Test Artifacts
App: Runs > Runs - Cannot Find Project > opens Connect Project modal after clicking Reconnect Project button Test Replay Screenshots
... > displays a list of recorded runs if a run has been recorded Test Replay Screenshots
Flakiness  cypress-in-cypress.cy.ts • 2 flaky tests • app-e2e

View Output

Test Artifacts
Cypress in Cypress > scales the AUT correctly in component Test Replay Screenshots
Cypress in Cypress > restarts browser if there is a before:browser:launch task and there is a change on the config Test Replay Screenshots
Flakiness  specs_list_latest_runs.cy.ts • 1 flaky test • app-e2e

View Output

Test Artifacts
App/Cloud Integration - Latest runs and Average duration > when no runs are recorded > shows placeholders for all visible specs Test Replay Screenshots

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

Review all test suite changes for PR #28593 ↗︎

Copy link
Collaborator

@jordanpowell88 jordanpowell88 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is quite the find. Change looks good to me.

@emilyrohrbough emilyrohrbough merged commit f80027f into develop Dec 28, 2023
81 of 83 checks passed
@emilyrohrbough emilyrohrbough deleted the fix-studio-generated-assertions branch December 28, 2023 19:56
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jan 17, 2024

Released in 13.6.3.

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

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Jan 17, 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