-
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.
#25296
Conversation
Thanks for taking the time to open a PR!
|
.should(),
.and()
, .readFile()
are now queries.
@@ -28,37 +34,32 @@ const commandRunningFailed = (Cypress, err, current?: $Command) => { | |||
return | |||
} | |||
|
|||
const lastLog = current?.getLastLog() |
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 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.
.should(),
.and()
, .readFile()
are now queries..should()
and .and()
are now queries.
@@ -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 = {}) { |
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.
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', () => { |
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.
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. 🤷♀️
…ypress into issue-25134-should-as-query
.should()
and .and()
are now queries..should()
and .and()
are now queries.
@@ -769,6 +766,22 @@ describe('src/cy/commands/assertions', () => { | |||
|
|||
cy.should(() => {}) | |||
}) | |||
|
|||
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.
New PR for same work: #25738 |
exist
Chai override does not allow chaining for HTML elements #25491User 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
cypress-documentation
?type definitions
?