-
-
Notifications
You must be signed in to change notification settings - Fork 50
Closed
Description
Hi there,
first, thanks for the project, it helped me a lot!
Unfortunately I have an issue when using cy.logout.
I have tests with cy.login() in the Cypress before hook, those work great.
But I also want to test the logged out state, so I defined cy.logout() in the before hook accordingly. Those tests fail on the cy.logout() command with the following:
Error: CypressError: Cypress detected that you returned a promise from a command while also invoking one or more cy commands in that promise.
The command that returned the promise was:
> cy.logout()
The cy command you invoked inside the promise was:
> cy.log()
Because Cypress commands are already promise-like, you don't need to wrap them or return your own promise.
Cypress will resolve your command with whatever the final Cypress command yields.
The reason this is an error instead of a warning is because Cypress internally queues commands serially whereas Promises execute as soon as they are invoked. Attempting to reconcile this would prevent Cypress from ever resolving.
https://on.cypress.io/returning-promise-and-commands-in-another-command
Because this error occurred during a 'before all' hook we are skipping the remaining tests in the current suite: 'Landing Page Unauthenticated'
I'm not sure if this is an issue on my side (wrong usage,...) or something of the lib.
For reference you can find the code of the failing test here.
Thanks for your help!
-Alex
Metadata
Metadata
Assignees
Labels
No labels