I’m writing Cypress tests and running them headless in terminal. The tests are passing even when they should fail.
For example writing this code:
describe('Website Landing', () => {
it.only('Should load', async () => {
cy.visit('http://www.mywebsite.com/');
cy.get('[data-testid="sign-inx"]');
})
})
And running this on terminal will end on success:
cypress run
But there is no element with such attribute and value. And if I add other assertions at the end, the test keeps passing
cy.get('[data-testid="sign-inx"]').should('have.length', 1);
I don’t understand how Cypress manages to allow tests to pass and to fail. Could someone help?