-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Examples for Typescript type parameters for cy.intercept and cy.wait #5831
Conversation
docs/api/commands/wait.mdx
Outdated
cy.intercept('/activities/*').as('getActivities') | ||
|
||
// As templated types: | ||
cy.wait<CustomRequest, CustomResponse>('@getUsers').then( |
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 types here will need to match the ones above (and in the callback body):
cy.wait<UserReq, UserRes>(...
docs/api/commands/wait.mdx
Outdated
|
||
// As inferred types, with type `Interception` available in `cypress/types/net-stubbing` | ||
cy.wait('@getUsers').then( | ||
({ request, response }: Interception<CustomRequest, CustomResponse>) => { |
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.
Similarly to above, the types should match the above (and expected by the callback body):
...Interception<UserReq, UserRes>...
docs/api/commands/wait.mdx
Outdated
} | ||
) | ||
|
||
// When passing an array of aliases, types must me inferred: |
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.
Looks like a typo here :)
me
→ be
docs/api/commands/wait.mdx
Outdated
cy.wait(['@getUsers', 'getActivities']).then( | ||
( | ||
interceptions: Array< | ||
Interception<UserReq | ActivityReq, UserRes, ActivityRes> |
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.
Small typo here:
Interception<UserReq | ActivityReq, UserRes | ActivityRes>
(note the comma → pipe)
@scottmcginness Thank you for your feedback! I'd gone back and forth on a few different edits, and missed updating some of them. Thanks for catching them! |
| [6.0.0](/guides/references/changelog#6-0-0) | Removed `experimentalNetworkStubbing` option and made it the default behavior. | | ||
| [5.1.0](/guides/references/changelog#5-1-0) | Added experimental `cy.route2()` command under `experimentalNetworkStubbing` option. | | ||
| Version | Changes | | ||
| ----------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | |
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.
@cacieprins It looks like you added an unnecessry |
to the end of this markup
Issue opened here #5924
This covers changes introduced by: cypress-io/cypress#29508