I am having problems matching the following URLs with Cypress intercept() using regex. What am I doing wrong?
cy.intercept('GET', /https:\/\/mysite\.me\.com\/pages\/[^\/]+[0-9](?=\/$|$)/, { fixture: 'pages.json' }).as('getPage');
Matching URLs:
Non-matching URLs:
- https://mysite.me.com/pages/?something=something
- https://mysite.me.com/pages/1234/something
- https://mysite.me.com/pages/something
I would ultimately like to use the regex with an env variable but first things first.
cy.intercept('GET', `${Cypress.env('API_PATH')}/pages/[^\/]+[0-9](?=\/$|$)/`, { fixture: 'pages.json' }).as('getPages');