💡 What will happen after running the following tests?
before(() => {
cy.wrap('some value').as('value');
});
it('test #1', () => {
cy.get('@value').should('eq', 'some value');
});
it('test #2', () => {
cy.get('@value').should('eq', 'some value');
});A | Both tests will pass
B | Both tests will fail
C | First test will pass, second one will fail
D | First test will fail, second one will pass
🎉 Quiz Completed! 🎉
The first test will pass but the second one will fail because all aliases are reset before each test.
So, it's better to use beforeEach hook instead.