In Cypress.io is there a way that I can force a test to fail if a certain condition is met?
For example, on my webpage, if the string "Sorry, something went wrong." is present on the page I want the test to fail. Currently here is what I am doing.
/// <reference types="Cypress" />
describe("These tests are designed to fail if certain criteria are met.", () => {
beforeEach(() => {
cy.visit("");
});
specify("If 'Sorry, something went wrong.' is present on page, FAIL ", () => {
cy.contains("Sorry, something went wrong.");
});
});
Right now, if "Sorry, something went wrong." is found, the test succeeds. How do I fail the test if this condition is met?