Files
n8n/packages/testing/playwright/pages/MfaLoginPage.ts
T
alighasami 3d5eaf9445
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
first commit
2026-03-17 16:22:57 +03:30

52 lines
1.3 KiB
TypeScript

import type { Locator } from '@playwright/test';
import { BasePage } from './BasePage';
/**
* Page object for the MFA login page that appears after entering email/password when MFA is enabled.
*/
export class MfaLoginPage extends BasePage {
getForm(): Locator {
return this.page.getByTestId('mfa-login-form');
}
getMfaCodeField(): Locator {
return this.getForm().locator('input[name="mfaCode"]');
}
getMfaRecoveryCodeField(): Locator {
return this.getForm().locator('input[name="mfaRecoveryCode"]');
}
async fillMfaCode(code: string): Promise<void> {
await this.getMfaCodeField().fill(code);
}
async fillMfaRecoveryCode(recoveryCode: string): Promise<void> {
await this.getMfaRecoveryCodeField().fill(recoveryCode);
}
async clickEnterRecoveryCode(): Promise<void> {
await this.clickByTestId('mfa-enter-recovery-code-button');
}
/**
* Fill MFA code and submit the form
* @param code - The MFA token to submit
*/
async submitMfaCode(code: string): Promise<void> {
await this.fillMfaCode(code);
// Form auto-submits
}
/**
* Switch to recovery code mode, fill recovery code and submit
* @param recoveryCode - The recovery code to submit
*/
async submitMfaRecoveryCode(recoveryCode: string): Promise<void> {
await this.clickEnterRecoveryCode();
await this.fillMfaRecoveryCode(recoveryCode);
// Form auto-submits
}
}