Skip to content

Commit

Permalink
fix: Flaky mfa e2e tests (no-changelog) (#7192)
Browse files Browse the repository at this point in the history
Github issue / Community forum post (link here to close automatically):
  • Loading branch information
RicardoE105 authored Oct 6, 2023
1 parent f4d8c9e commit ab647b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cypress/e2e/27-two-factor-authentication.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ describe('Two-factor authentication', () => {
expect(err.message).to.include('Not logged in');
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;
signinPage.actions.loginWithEmailAndPassword(email, password);
personalSettingsPage.actions.enableMfa();
Expand All @@ -47,7 +48,7 @@ describe('Two-factor authentication', () => {
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;
signinPage.actions.loginWithEmailAndPassword(email, password);
personalSettingsPage.actions.enableMfa();
Expand All @@ -56,7 +57,7 @@ describe('Two-factor authentication', () => {
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;
signinPage.actions.loginWithEmailAndPassword(email, password);
personalSettingsPage.actions.enableMfa();
Expand Down
3 changes: 3 additions & 0 deletions cypress/pages/settings-personal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,14 @@ export class PersonalSettingsPage extends BasePage {
enableMfa: () => {
cy.visit(this.url);
this.getters.enableMfaButton().click();
cy.wait('@getMfaQrCode');
mfaSetupModal.getters.copySecretToClipboardButton().should('be.visible');
mfaSetupModal.getters.copySecretToClipboardButton().realClick();
cy.readClipboard().then((secret) => {
const token = generateOTPToken(secret);

mfaSetupModal.getters.tokenInput().type(token);
mfaSetupModal.getters.downloadRecoveryCodesButton().should('be.visible');
mfaSetupModal.getters.downloadRecoveryCodesButton().click();
mfaSetupModal.getters.saveButton().click();
});
Expand Down

0 comments on commit ab647b2

Please sign in to comment.