-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
breaking: .should()
and .and()
are now queries.
#25738
Conversation
* fix: match alternate edge version string format (#25457) * fix: match alternate edge version string format * chore: add changelog entry * Apply suggestions from code review * Update cli/CHANGELOG.md * Update cli/CHANGELOG.md * chore: update changelog to release on Tuesday for 12.5 * [run ci] --------- Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com> Co-authored-by: Bill Glesias <bglesias@gmail.com> * chore: Use upstream cypress-testing-library again (#25548) * chore: Use upstream cypress-testing-library again * Update cypress-example-kitchensink commit hash * Revert "Update cypress-example-kitchensink commit hash" This reverts commit 8de5d1f. --------- Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com> * fix(deps): update dependency underscore.string to v3.3.6 🌟 (#25574) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Bill Glesias <bglesias@gmail.com> * feat: Debug page [IATR] (#25488) Co-authored-by: Zachary Williams <ZachJW34@gmail.com> Co-authored-by: Ankit <ankit@cypress.io> Co-authored-by: Stokes Player <stokes.player@gmail.com> Co-authored-by: elevatebart <bart@cypress.io> Co-authored-by: Rocky <25568640+rockindahizzy@users.noreply.github.com> Co-authored-by: Stokes Player <stokes@cypress.io> Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com> Co-authored-by: Mark Noonan <mark@cypress.io> Co-authored-by: Mike Plummer <mikep@cypress.io> Co-authored-by: amehta265 <65267668+amehta265@users.noreply.github.com> Co-authored-by: Adam Stone-Lord <adams@cypress.io> Co-authored-by: Mike Plummer <mike-plummer@users.noreply.github.com> Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com> * chore: fix changlelog section parsing and reference right ENV (#25633) * test: skip flaky migration test (#25378) * chore: Update README to add Cloud badges (#25645) * perf: remove reporter logs for collapsed tests in run mode (#25632) Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com> * chore: 12.5.0 release (#25648) * dependency: update dependency simple-git to v3.16.0 [security] (#25603) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Zachary Williams <zachjw34@gmail.com> Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com> * chore: renovate semantic types and percy ci updates (#25651) --------- Co-authored-by: Steven Collins <steven@carboncollins.uk> Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com> Co-authored-by: Bill Glesias <bglesias@gmail.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Stokes Player <stokes@cypress.io> Co-authored-by: Zachary Williams <ZachJW34@gmail.com> Co-authored-by: Ankit <ankit@cypress.io> Co-authored-by: Stokes Player <stokes.player@gmail.com> Co-authored-by: elevatebart <bart@cypress.io> Co-authored-by: Rocky <25568640+rockindahizzy@users.noreply.github.com> Co-authored-by: Mark Noonan <mark@cypress.io> Co-authored-by: Mike Plummer <mikep@cypress.io> Co-authored-by: amehta265 <65267668+amehta265@users.noreply.github.com> Co-authored-by: Adam Stone-Lord <adams@cypress.io> Co-authored-by: Mike Plummer <mike-plummer@users.noreply.github.com> Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com> Co-authored-by: Jennifer Shehane <jennifer@cypress.io> Co-authored-by: Matt Schile <mschile@cypress.io>
* Update cli/CHANGELOG.md Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com> * Update cli/CHANGELOG.md Co-authored-by: Matt Henkes <mjhenkes@gmail.com> --------- Co-authored-by: Emily Rohrbough <emilyrohrbough@yahoo.com> Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
…ypress into issue-25134-should-as-query
@@ -5,6 +5,8 @@ _Released 03/1/2023 (PENDING)_ | |||
|
|||
**Breaking Changes:** | |||
|
|||
- The [`.should()` and `.and()`](/api/commands/should) assertions are now queries. This means that they are fully retryable, and it is safe to chain further commands that interact with the DOM after them. Assertions are also now re-run as part of aliases. Addresses [#25134](https://github.com/cypress-io/cypress/issues/25134) and [#25491](https://github.com/cypress-io/cypress/issues/25491). Addressed in [#25738](https://github.com/cypress-io/cypress/pull/25738). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The [`.should()` and `.and()`](/api/commands/should) assertions are now queries. This means that they are fully retryable, and it is safe to chain further commands that interact with the DOM after them. Assertions are also now re-run as part of aliases. Addresses [#25134](https://github.com/cypress-io/cypress/issues/25134) and [#25491](https://github.com/cypress-io/cypress/issues/25491). Addressed in [#25738](https://github.com/cypress-io/cypress/pull/25738). | |
- The [`.should()`](https://docs.cypress.io/api/commands/should) and [`.and()`](/api/commands/and) assertions are now queries. This means that they are fully retryable, and it is safe to chain further commands that interact with the DOM after them. Assertions are also now re-run as part of aliases. Addresses [#25134](https://github.com/cypress-io/cypress/issues/25134) and [#25491](https://github.com/cypress-io/cypress/issues/25491). |
This means that they are fully retryable, and it is safe to chain further commands that interact with the DOM after them.
I don't know what this means and if users will either since assertions were documented such that they retried to pass.
@@ -237,10 +237,10 @@ describe('<FileChooser />', () => { | |||
.should('have.value', newExtension) | |||
|
|||
// debounce should cause this to hit | |||
.get('@onUpdateExtensionSpy').should('not.have.been.calledWith', newExtension) | |||
cy.get('@onUpdateExtensionSpy').should('not.have.been.calledWith', newExtension) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, would have thought .type()
broken the change so this change wouldn't have been needed.
it('includes assertions in the subject chain', () => { | ||
cy.get('#button').should('have.css', 'font-family').as('font') | ||
|
||
cy.get('@font').should('be.a', 'string') | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test isn't verifying the assertions are in the chain. Looks like some verification was missed?
|
||
expect(getLog.get('state')).to.eq('pending') | ||
expect(getLog.get('state')).to.eq('passed') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When an assertion fails and the command is requried, do we set this get status back to pending? Or how are we showing this subject changed from the yielded value? Console props?
expect(err.message).to.include('looks like you are trying to call a child command before running a parent command') | ||
|
||
// https://github.com/cypress-io/cypress/issues/25491 | ||
it('throws a good error when aliased subject disappears', function (done) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it('throws a good error when aliased subject disappears', function (done) { | |
it('throws an error when aliased subject disappears', function (done) { |
|
||
it('sets type to parent when assertion did not involve current subject and didnt have arguments', (done) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you intended to drop this test?
@@ -1245,7 +1226,8 @@ describe('src/cy/commands/connectors', () => { | |||
.onCall(0).returns(undefined) | |||
.onCall(1).returns(undefined) | |||
.onCall(2).returns(undefined) | |||
.onCall(3).returns(true), | |||
.onCall(3).returns(true) | |||
.onCall(4).returns(true), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't look needed?
… and and() will not be queries in v13. see cypress-io/cypress#25738
… is no longer applicable due to cypress-io/cypress#25738
* .readFile() is now a query (#5017) * .readFile() is now a query * Add section on new .readFile() superpowers * Fix page slug for readFile * Prettier run * Update guides to better support users in Cy 13, where assertions are now commands * Review updates * Apply suggestions from code review Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com> * Partial review feedback (more to come) * Review updates * Prettier run * fix: update retry ability guide and migration guide now that should() and and() will not be queries in v13. see cypress-io/cypress#25738 * chore: correct number of queries in example * revert: images changes due to should() and and() being queries, which is no longer applicable due to cypress-io/cypress#25738 * chore: lint guides --------- Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com> Co-authored-by: Bill Glesias <bglesias@gmail.com>
* BREAKING: update documentation by setting default video: false for v13.0.0 (#5300) * BREAKING: update documentation by setting default video: false * Update docs/guides/overview/why-cypress.mdx Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com> * Update docs/guides/end-to-end-testing/migration/protractor-to-cypress.mdx Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com> * Update docs/guides/continuous-integration/introduction.mdx Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com> * Update docs/guides/guides/screenshots-and-videos.mdx Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com> * chore: re-order video bits * Update docs/guides/end-to-end-testing/migration/protractor-to-cypress.mdx * chore: linting --------- Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com> * breaking: update documentation by setting videoCompression: false (#5301) * BREAKING: update documentation by setting default video: false * BREAKING: update documentation by setting videoCompression: false * Update docs/guides/guides/screenshots-and-videos.mdx Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com> * apply suggestion from code review * chore: attempt to rework the video encoding section * Update docs/guides/guides/screenshots-and-videos.mdx Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com> * chore: address comments in code review * chore: update video encoding guide to flow a bit more evenly --------- Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com> Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com> * BREAKING: remove the videoUploadOnPasses configuration option (#5306) * BREAKING: remove the videoUploadOnPasses configuration option * chore: add history entry of removed videoUploadOnPasses config option * .readFile() is now a query (#5017) (#5316) * .readFile() is now a query * Add section on new .readFile() superpowers * Fix page slug for readFile * Prettier run Co-authored-by: Blue F <blue@everblue.info> * Update guides for Cy 13, where assertions are now commands (#5081) * .readFile() is now a query (#5017) * .readFile() is now a query * Add section on new .readFile() superpowers * Fix page slug for readFile * Prettier run * Update guides to better support users in Cy 13, where assertions are now commands * Review updates * Apply suggestions from code review Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com> * Partial review feedback (more to come) * Review updates * Prettier run * fix: update retry ability guide and migration guide now that should() and and() will not be queries in v13. see cypress-io/cypress#25738 * chore: correct number of queries in example * revert: images changes due to should() and and() being queries, which is no longer applicable due to cypress-io/cypress#25738 * chore: lint guides --------- Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com> Co-authored-by: Bill Glesias <bglesias@gmail.com> * Apply suggestions from code review Co-authored-by: Mike McCready <66998419+MikeMcC399@users.noreply.github.com> * Remove nodeVersion documentation (#5318) * Remove reference to 'nodeVersion' * added history, removed changes to legacy * docs: v13 video and TR migration info (#5383) * added video config migration info * added tr migration info * PR feedback * PR feedback * PR feedback * Apply suggestions from code review Co-authored-by: Bill Glesias <bglesias@gmail.com> * Update docs/guides/references/migration-guide.mdx Co-authored-by: Jennifer Shehane <jennifer@cypress.io> --------- Co-authored-by: Bill Glesias <bglesias@gmail.com> Co-authored-by: Jennifer Shehane <jennifer@cypress.io> * Update results for module API and after:spec handler (#5379) * docs: adding documentation for runner-ui cli flags (#5424) * docs: test replay docs (#5349) * sidebar content shuffle * main feature content & link updates * add screenshots * add url to vpn whitelist * add TR banner * add & reorder faq * build test replay partial * add TR partial to related content * add TR link to related "see more" sections * content tweaks * include TR content in body copy * add troubleshooting * remove old images * add PR feedback * add command log notes * remove dead link * update images * replace runs page screenshots * Apply suggestions from code review Co-authored-by: Jennifer Shehane <jennifer@cypress.io> Co-authored-by: Bill Glesias <bglesias@gmail.com> Co-authored-by: Jennifer Shehane <jennifer@cypress.io> * add more faqs * restore missing partial export * fix links * swap in screenshot of new network panel * Apply suggestions from code review Co-authored-by: Bill Glesias <bglesias@gmail.com> * fix command line merge issue * lint * Update docs/guides/cloud/debugging/recorded-runs.mdx Co-authored-by: Bill Glesias <bglesias@gmail.com> * Apply suggestions from code review Co-authored-by: Bill Glesias <bglesias@gmail.com> --------- Co-authored-by: Jennifer Shehane <jennifer@cypress.io> Co-authored-by: Bill Glesias <bglesias@gmail.com> * Fix JavaScript caps * Fix caps of JavaScript * Fix typo * Write a document around Cloud data storage and controls (#5425) Co-authored-by: Paul Jaffre <jaffrepaul@gmail.com> Co-authored-by: Mike McCready <66998419+MikeMcC399@users.noreply.github.com> * add changelog, remove node 16 support, and update docker image refere… (#5434) * add changelog, remove node 16 support, and update docker image reference to be on at least node 18 * Update docs/guides/references/changelog.mdx * docs: minor v13 updates (#5438) * match data callout with data storage page * remove mention from artifacts panel * remove submitting feature requests callout * build & insert cloud free plan partial * docs: update v13 content urls (#5428) * update content urls * add todo * replace v13 changelog urls * docs: v13 changelog summary (#5441) * changelog summary * Update docs/guides/references/changelog.mdx Co-authored-by: Jennifer Shehane <jennifer@cypress.io> * tweak verbaige & lint --------- Co-authored-by: Jennifer Shehane <jennifer@cypress.io> * Apply suggestions from code review Co-authored-by: Bill Glesias <bglesias@gmail.com> * lint * Update docs/faq/questions/cloud-faq.mdx Co-authored-by: Mike McCready <66998419+MikeMcC399@users.noreply.github.com> * include TR note in cypress screenshot api options (#5445) * docs: additional test replay content (#5447) * add TR cost faq * add centos troubleshooting * sync up changelog * Update _cloud_free_plan.mdx minor text update --------- Co-authored-by: Bill Glesias <bglesias@gmail.com> Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com> Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com> Co-authored-by: Blue F <blue@everblue.info> Co-authored-by: Mike McCready <66998419+MikeMcC399@users.noreply.github.com> Co-authored-by: Paul Jaffre <jaffrepaul@gmail.com> Co-authored-by: Jennifer Shehane <jennifer@cypress.io> Co-authored-by: Matt Schile <mschile@cypress.io> Co-authored-by: Chris Breiding <chrisbreiding@gmail.com> Co-authored-by: Paul Jaffre <paul@cypress.io>
exist
Chai override does not allow chaining for HTML elements #25491Additional details
In Cypress 12, assertions belong to the commands that they follow after. When you write
cy.get('button').should('be.visible')
, the.should()
executes as part ofverifyUpcomingAssertions
while.get()
is the current Cypress command. This means that if an assertion fails, the command it's attached to fails as well; it also makes assertions very much a 'special case', working differently from every other command.This PR changes that.
.should()
and.and()
are now queries, and follow the same logic as every other query. This means they are safe to chain off of, they are re-executed when reading an alias that includes them, and they pass or fail independently of any other command, resulting in a clearer debugging experience..should('not.exist')
still skip the previous command's implicit existence checks - the logic to do this is somewhat more straightforward now, withverifyUpcomingAssertions
explicitly invoking a methodhasUpcomingExistenceAssertions()
and skipping the implicit existence checks if it returns true.Steps to test
How has the user experience changed?
PR Tasks
cypress-documentation
? Restructure API namespace for Cy13 cypress-documentation#5053type definitions
?