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

breaking: .should() and .and() are now queries. #25296

Closed
wants to merge 33 commits into from

Conversation

BlueWinds
Copy link
Contributor

@BlueWinds BlueWinds commented Dec 28, 2022

User facing changelog

Not ready for review. PR description TODO. Marking as 'not a draft' so circleCI will build commits pushed to the branch.

Additional details

Steps to test

How has the user experience changed?

PR Tasks

  • Have tests been added/updated?
  • Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • Has a PR for user-facing changes been opened in cypress-documentation?
    • Update the 12.0.0 migration docs with an addendum speaking to assertions also joining the queries category in 12.x.x.
    • Mention that aliases are 'locators'
  • [n/a] Have API changes been updated in the type definitions?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Dec 28, 2022

Thanks for taking the time to open a PR!

@cypress
Copy link

cypress bot commented Dec 28, 2022

3 failed and 54 flaky tests on run #43850 ↗︎

3 26435 1271 0 Flakiness 54

Details:

One more try at fixing stack pointers in all situations
Project: cypress Commit: 273fe58336
Status: Failed Duration: 18:28 💡
Started: Feb 6, 2023 10:59 PM Ended: Feb 6, 2023 11:18 PM
Failed  reporter-ct-webpack.errors.cy.ts • 1 failed test • app-e2e

View Output Video

Test
Webpack - errors ui > hooks Screenshot
Failed  reporter-ct-vite.errors.cy.ts • 1 failed test • app-e2e

View Output Video

Test
Vite - errors ui > hooks Screenshot
Failed  reporter.errors.cy.ts • 1 failed test • app-e2e

View Output Video

Test
errors ui > hooks Screenshot
Flakiness  commands/actions/type_special_chars.cy.js • 1 flaky test • 5x-driver-electron

View Output Video

Test
... > triggers form submit synchronously before type logs or resolves
Flakiness  e2e/origin/cookie_behavior.cy.ts • 4 flaky tests • 5x-driver-electron

View Output Video

Test
... > same site / cross origin > XMLHttpRequest > sets cookie on same-site request if withCredentials is true, and attaches to same-site request if withCredentials is true
... > same site / cross origin > fetch > sets same-site cookies if "include" credentials option is specified from request, but does not attach same-site cookies to request by default (same-origin)
... > same site / cross origin > XMLHttpRequest > sets cookie on same-site request if withCredentials is true, and attaches to same-site request if withCredentials is true
... > same site / cross origin > fetch > sets same-site cookies if "include" credentials option is specified from request, but does not attach same-site cookies to request by default (same-origin)
Flakiness  commands/actions/trigger.cy.js • 1 flaky test • 5x-driver-electron

View Output Video

Test
... > snapshots before triggering
Flakiness  e2e/origin/commands/cookies.cy.ts • 1 flaky test • 5x-driver-electron

View Output Video

Test
... > .getCookies()
Flakiness  cypress/cypress.cy.js • 3 flaky tests • 5x-driver-electron

View Output Video

Test
... > correctly returns currentRetry
... > correctly returns currentRetry
... > correctly returns currentRetry

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

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

@BlueWinds BlueWinds marked this pull request as ready for review January 24, 2023 20:08
@BlueWinds BlueWinds changed the title feat: .should()/.and() are now queries. feat: .should(), .and(), .readFile() are now queries. Jan 24, 2023
packages/driver/src/cypress/error_messages.ts Outdated Show resolved Hide resolved
@@ -28,37 +34,32 @@ const commandRunningFailed = (Cypress, err, current?: $Command) => {
return
}

const lastLog = current?.getLastLog()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This logic is all mostly the same, with the exception that we now always call lastLog.error(err) if we have a last log - this ensures that we wrap up all assertions (and other log messages) whether or not an onFail() function exists on the error.

packages/driver/src/cy/commands/files.ts Outdated Show resolved Hide resolved
packages/driver/src/cy/commands/files.ts Outdated Show resolved Hide resolved
@@ -275,27 +192,26 @@ export const create = (Cypress: ICypress, cy: $Cy) => {

return {
finishAssertions,
assert,

// TODO: define the specific type of options
verifyUpcomingAssertions (subject, options: Record<string, any> = {}, callbacks: VerifyUpcomingAssertionsCallbacks = {}) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

verifyUpcomingAssertions is no longer an accurate name, but given that a variety of plugins and custom commands rely on it, I've opted not to rename it something more appropriate (like "verifyImplicitAssertions" or somesuch).

It may not be documented as part of our public API, but I'd consider it public-facing and am therefore hesitant to rename it without an extremely compelling reason.

})

it('has the $el', () => {
it('snapshots, has the element, and logs with console props', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No functional changes here, but combining the assertions into one test ends up saving about 60s per run on my machine (since this is executed in a loop), and likely more than that on a CI box.

No need to revisit dom.html hundreds of times. 🤷‍♀️

@BlueWinds BlueWinds changed the title feat: .should() and .and() are now queries. breaking: .should() and .and() are now queries. Feb 2, 2023
@@ -769,6 +766,22 @@ describe('src/cy/commands/assertions', () => {

cy.should(() => {})
})

it('throws a good error when aliased subject disappears', function (done) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added these two tests based on #25491 / #25493

@mjhenkes mjhenkes deleted the branch lkere/13.0.0 February 7, 2023 16:26
@mjhenkes mjhenkes closed this Feb 7, 2023
@BlueWinds
Copy link
Contributor Author

New PR for same work: #25738

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chains of query commands do not retry anything before an assertion
3 participants