I have a case: get all "a" tags, then check if they have a [title] attribute.
This is my code that works:
it(`Accessibility -link title`, () => {
cy.visit("https://webpage");
cy.get("a").not("[href='#']").not("[href='']").each((link) => {
expect(link).to.have.attr("title");
})
})
And this is cool until the test finds first element with wrong assertion. Then it fails and stops scanning forward, so I cant get knowledge about all elements without [title] atribute.
My intention is to scan whole "a" tags on the web page, and check which of them are w/o [title] attribute. Get a list of it at one test, not to avoid the test after first fail.
Is there a way, to make assertion, but when it fails: avoid the AssertionError so the test can move on until the end?
Thanks for every response!
Aucun commentaire:
Enregistrer un commentaire