import type { Locator } from '@playwright/test'; import { expect } from '@playwright/test'; import { BasePage } from './BasePage'; /** * Page object for the MFA setup modal that appears when enabling two-factor authentication. */ export class MfaSetupModal extends BasePage { get container(): Locator { return this.page.getByTestId('mfaSetup-modal'); } getTokenInput(): Locator { return this.container.getByTestId('mfa-token-input'); } getDownloadRecoveryCodesButton(): Locator { return this.container.getByTestId('mfa-recovery-codes-button'); } async fillToken(token: string): Promise { await this.getTokenInput().fill(token); } async clickCopySecretToClipboard(): Promise { await this.clickByTestId('mfa-secret-button'); } async clickDownloadRecoveryCodes(): Promise { await this.clickByTestId('mfa-recovery-codes-button'); } async clickSave(): Promise { await this.container.getByTestId('mfa-save-button').click(); } /** * Wait for the MFA setup modal to be hidden from view */ async waitForHidden(): Promise { await expect(this.container).toBeHidden(); } }