My URL contain a number that is assigned to a particular item so it might be 1, 2, ..., 999 and so on.
2nd possible issue:
In your sample you're calling a function called .contain
, and as per the cypress docs it is .contains
(with an S).
CodePudding user response:
You do not need to invoke the text content of the value yielded from cy.url
, as it is already a string.
Additionally, your regex is incorrect. It is matching for only strings that begin, contain, and ends with numbers.
Fixing the above, you could have something like...
cy.url().should('match', /https:\/\/www\.test\.com\/items\/(\d*)\.html/)