I'm tyring to add an if statement into my login test as there are two login pages that can be loaded. The test below is failing when it can't find the text 'Not your account?', when it should be continuing to the login steps. I think this is happening because both login pages have the same elements 'a.auth0-lock-alternative-link' but contain different text.
How can I create an if statement in the test to fulfill both these scenarios?
describe('My Login Test2', function (){
it('Visit Risk App Landing Page', function (){
cy.visit('https://bvt-riskassessment.lmkcloud.net')
cy.get('button').click()
if(cy.get('a.auth0-lock-alternative-link').contains('Not your account?'))
{
cy.get('a.auth0-lock-alternative-link').contains('Not your account?').click();
}
cy.fixture('loginUser').as('myUserFixture');
cy.get('@myUserFixture').then(user => {
cy.get('input.auth0-lock-input').first().type(user.email);
cy.get('input.auth0-lock-input').last().type(user.password);
cy.get('button').click()
cy.url().should('eq','https://bvt-riskassessment.lmkcloud.net/workflow')
})
})
})
Aucun commentaire:
Enregistrer un commentaire