mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-24 04:59:13 +00:00
feat(core): Add MFA (#4767)
https://linear.app/n8n/issue/ADO-947/sync-branch-with-master-and-fix-fe-e2e-tets --------- Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
import { ChangePasswordModal } from './modals/change-password-modal';
|
||||
import { MfaSetupModal } from './modals/mfa-setup-modal';
|
||||
import { BasePage } from './base';
|
||||
|
||||
const changePasswordModal = new ChangePasswordModal();
|
||||
const mfaSetupModal = new MfaSetupModal();
|
||||
|
||||
export class PersonalSettingsPage extends BasePage {
|
||||
url = '/settings/personal';
|
||||
secret = '';
|
||||
|
||||
getters = {
|
||||
currentUserName: () => cy.getByTestId('current-user-name'),
|
||||
firstNameInput: () => cy.getByTestId('firstName').find('input').first(),
|
||||
@@ -13,6 +17,8 @@ export class PersonalSettingsPage extends BasePage {
|
||||
emailInput: () => cy.getByTestId('email').find('input').first(),
|
||||
changePasswordLink: () => cy.getByTestId('change-password-link').first(),
|
||||
saveSettingsButton: () => cy.getByTestId('save-settings-button'),
|
||||
enableMfaButton: () => cy.getByTestId('enable-mfa-button'),
|
||||
disableMfaButton: () => cy.getByTestId('disable-mfa-button'),
|
||||
};
|
||||
actions = {
|
||||
loginAndVisit: (email: string, password: string) => {
|
||||
@@ -50,5 +56,21 @@ export class PersonalSettingsPage extends BasePage {
|
||||
this.actions.loginAndVisit(email, password);
|
||||
cy.url().should('match', new RegExp(this.url));
|
||||
},
|
||||
enableMfa: () => {
|
||||
cy.visit(this.url);
|
||||
this.getters.enableMfaButton().click();
|
||||
mfaSetupModal.getters.copySecretToClipboardButton().realClick();
|
||||
cy.readClipboard().then((secret) => {
|
||||
cy.generateToken(secret).then((token) => {
|
||||
mfaSetupModal.getters.tokenInput().type(token);
|
||||
mfaSetupModal.getters.downloadRecoveryCodesButton().click();
|
||||
mfaSetupModal.getters.saveButton().click();
|
||||
});
|
||||
});
|
||||
},
|
||||
disableMfa: () => {
|
||||
cy.visit(this.url);
|
||||
this.getters.disableMfaButton().click();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user