You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
have a custom error displayed for an assertion made with .should()?
have a custom error be displayed without the original chai/cypress error?
I've tried several things as shown below but I haven't really been able to fully replace nor turn off an error message made with .should()
cy.visit("https://www.google.com/en");
// error message: expected <input.gNO89b> to have value Google Search
cy.get("input[type=submit]").eq(2).should("have.value", "Google Search");
// error message is the same as the original, does nothing
cy.get("input[type=submit]").eq(2).should("have.value", "Google Search", "Custom error");
// error message: Custom error: expected <input.gNO89b> to have value Google Search
// this displays the custom error but appends the original chai/cypress
cy.get("input[type=submit]").eq(2).should(btn => {
expect(btn, "Custom error").to.have.value("Google Search");
});
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Is there a way to:
I've tried several things as shown below but I haven't really been able to fully replace nor turn off an error message made with .should()
Beta Was this translation helpful? Give feedback.
All reactions