-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Using cy.server() and cy.route() not working in before hooks #595
Comments
The second use case has been fixed in the upcoming The first use case still fails in the upcoming Minimum code to reproduce describe('test', () => {
before(() => {
cy.server()
})
describe('describe n1', () => {
before(() => {
cy.route('fake')
})
it('test n1', () => {})
})
describe('describe n2', () => {
before(() => {
cy.route('fake')
})
it('test nr 2', () => {})
})
}) |
I looked at this, and this is not a bug, this is the correct and intended behavior of mocha hooks. Code in a Replace the notion of You just need to move the |
To clarify I only ran @jennifer-shehane's minimal code example in our upcoming |
Fixed the situation when calling The initial request of using |
Current behavior:
I'm getting error in Cypress app console:
CypressError: cy.route() cannot be invoked before starting the cy.server()
when I usecy.server()
in topbefore
hook and thency.route()
in children contextsbefore
hooks.If I remove top
cy.server()
and move it tobefore
hook before eachcy.route()
call then I get fail for second describe context with error:CypressError: The XHR server is unavailable or missing. This should never happen and likely is a bug. Open an issue if you see this message.
Desired behavior:
I should be able to use
cy.route()
andcy.server()
withinbefore
hooks.Test code:
The text was updated successfully, but these errors were encountered: