cypress icon indicating copy to clipboard operation
cypress copied to clipboard

The wildcard for routes RegExp fails on optional parameters

Open whitespacecode opened this issue 3 years ago • 1 comments

Right now the RegExp for wildcard parameters requires the wildcard to be exact

Using your example:

 cy.visit({
        route: 'team.dashboard',
        parameters: { team: 1 }
});

This will replace following /teams/{team}/dashboard to /teams/1/dashboard

What if you have a route that have optional parameters

 cy.visit({
        route: 'team.dashboard.style',
        parameters: { team: 1, style: 3 }
});

/teams/{team}/dashboard/{style?} to /teams/1/dashboard/%7Bstyle%7D

whitespacecode avatar Dec 14 '22 13:12 whitespacecode

I have fixed this in following pull request https://github.com/laracasts/cypress/pull/76. I made this pull request since i'm already using this fix on my codebase.

whitespacecode avatar Dec 14 '22 13:12 whitespacecode