79315105

Date: 2024-12-29 07:15:55
Score: 1
Natty:
Report link

Out of the box, ChaiJS provides the satisfy keyword which is followed by a predicate.

The predicate can use any Javascript expression, so for example using String.prototype.endsWith()

cy.get('.my_class')
  .find('a')
  .should('have.attr', 'href')
  .and('satisfy', href => href.endsWith('/' + test_id))
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Hendrik