I have a button which has two status, one activate and one deactivate. By clicking on it you can de/activate a driver. Im using cypress to test this button and below is part of the test:
cy.get('button').then(($btn) => {
if ($btn.has('[data-cy="activate-user-account"]')) {
cy.get('[data-cy="activate-user-account"] span').click();
cy.get('.btn-primary > .button-wrapper').click();
cy.get('.btn > .ng-star-inserted svg').click();
}
else {
cy.get('[data-cy="deactivate-user-account"] span').click();
cy.get('.btn-primary > .button-wrapper').click();
cy.get('.btn > .ng-star-inserted svg').click();
}
});
But what it does, it only looks at the else and tries to execute that one, without considering if part. What Im doing wrong in here?
Im new to cypress, apologies if this is an easy one and I don't know it ;)
Aucun commentaire:
Enregistrer un commentaire