fix: Flaky mfa e2e tests (no-changelog) (#7192)

Github issue / Community forum post (link here to close automatically):
This commit is contained in:
Ricardo Espinoza 2023-10-06 11:06:38 +02:00 committed by GitHub
parent f4d8c9eed5
commit ab647b231d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View file

@ -35,9 +35,10 @@ describe('Two-factor authentication', () => {
expect(err.message).to.include('Not logged in'); expect(err.message).to.include('Not logged in');
return false; return false;
}); });
cy.intercept('GET', '/rest/mfa/qr').as('getMfaQrCode');
}); });
it.skip('Should be able to login with MFA token', () => { it('Should be able to login with MFA token', () => {
const { email, password } = user; const { email, password } = user;
signinPage.actions.loginWithEmailAndPassword(email, password); signinPage.actions.loginWithEmailAndPassword(email, password);
personalSettingsPage.actions.enableMfa(); personalSettingsPage.actions.enableMfa();
@ -47,7 +48,7 @@ describe('Two-factor authentication', () => {
mainSidebar.actions.signout(); mainSidebar.actions.signout();
}); });
it.skip('Should be able to login with recovery code', () => { it('Should be able to login with recovery code', () => {
const { email, password } = user; const { email, password } = user;
signinPage.actions.loginWithEmailAndPassword(email, password); signinPage.actions.loginWithEmailAndPassword(email, password);
personalSettingsPage.actions.enableMfa(); personalSettingsPage.actions.enableMfa();
@ -56,7 +57,7 @@ describe('Two-factor authentication', () => {
mainSidebar.actions.signout(); mainSidebar.actions.signout();
}); });
it.skip('Should be able to disable MFA in account', () => { it('Should be able to disable MFA in account', () => {
const { email, password } = user; const { email, password } = user;
signinPage.actions.loginWithEmailAndPassword(email, password); signinPage.actions.loginWithEmailAndPassword(email, password);
personalSettingsPage.actions.enableMfa(); personalSettingsPage.actions.enableMfa();

View file

@ -60,11 +60,14 @@ export class PersonalSettingsPage extends BasePage {
enableMfa: () => { enableMfa: () => {
cy.visit(this.url); cy.visit(this.url);
this.getters.enableMfaButton().click(); this.getters.enableMfaButton().click();
cy.wait('@getMfaQrCode');
mfaSetupModal.getters.copySecretToClipboardButton().should('be.visible');
mfaSetupModal.getters.copySecretToClipboardButton().realClick(); mfaSetupModal.getters.copySecretToClipboardButton().realClick();
cy.readClipboard().then((secret) => { cy.readClipboard().then((secret) => {
const token = generateOTPToken(secret); const token = generateOTPToken(secret);
mfaSetupModal.getters.tokenInput().type(token); mfaSetupModal.getters.tokenInput().type(token);
mfaSetupModal.getters.downloadRecoveryCodesButton().should('be.visible');
mfaSetupModal.getters.downloadRecoveryCodesButton().click(); mfaSetupModal.getters.downloadRecoveryCodesButton().click();
mfaSetupModal.getters.saveButton().click(); mfaSetupModal.getters.saveButton().click();
}); });