Closed orbmis closed 5 years ago
When I try to run cy.server() in order to mock http requests that are executed as part of the tests, I get the following error:
Uncaught CypressError: Cannot call "cy.server()" outside a running test.....
I don't know how to get this to work. This is my code:
import { Given, Then } from 'cypress-cucumber-preprocessor/steps' beforeEach(() => { cy.server() cy.route({ method: 'GET', url: '/', response: [] }) }) const url = 'http://localhost:8080' Given('I click the big button', () => { cy.visit(url) cy.get('.btn').click() }) Then('I can get the MOTD', (title) => { cy.title().should('include', title) })
Closing this as it is in the wrong repo - apologies. Will re-open in correct repo.
When I try to run cy.server() in order to mock http requests that are executed as part of the tests, I get the following error:
Uncaught CypressError: Cannot call "cy.server()" outside a running test.....
I don't know how to get this to work. This is my code: