cypress
cypress copied to clipboard
Laravel route "login" does not exist.
I'm using Cypress 10, which may be relevant, and version 2.2.1 of this package.
I have a simple test to check the login form works
describe('Login', function () {
it('redirects to the home page once logged in', function () {
cy.visit({route: 'login'})
.get('#email').type('[email protected]')
.get('#password').type('password')
.get('[type="submit"]').click()
.url().should('eq', Cypress.config().baseUrl + '/');
});
});
The test passes, but I get the message Laravel route "login" does not exist.

It clearly exists so I'm not sure what is that about. Besides, the message in an assertion and it's green, which indicates it's not an error (which is correct).
Could it be that maybe the package is trying to assert the route exist rather than it doesn't?
facing the same issue
@troccoli I have the same issue but if I add cy.refreshRoutes() to the top of the test then its happy.
I do call cy.refreshRoutes() in the before() method.
It looks like the route handler (in laravel-routes.js) is correctly validating that the route exists, but the "error message" is stating the opposite of what it should state.
I think the feedback Chai and Cypress are giving, should be what we're trying to assert, not what we want to know if the assertion fails. E.g. Assert the route exists, then the message should be "Laravel route "login" should exist"
Placing cy.refreshRoutes() in before() does not fix this for me
I'm ignoring these messages for now. It's only the representation in the Cypress UI that is a bit misleading. The message doesn't appear when running headless mode unless the route actually doesn't exist.