Skip to content

Commit 712c051

Browse files
Merge pull request #389 from Web3Auth/harry/enhance-mandatory-mfa
E2E - Enhance Mandatory MFA scenarios if the token is invalid
2 parents 3eed4c1 + 777aaa6 commit 712c051

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

authservice/login-with-passwordless/AuthServicePage.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,23 @@ export class AuthServicePage {
5454
});
5555

5656
await this.page.locator(`xpath=.//input[@data-test='single-input']`).first().type(token);
57+
58+
await delay(2000);
59+
if (await this.page.locator('text="Invalid OTP, please try again"').isVisible()) {
60+
await this.page.locator(`xpath=.//input[@data-test='single-input']`).last().click();
61+
62+
for (let index = 0; index < 6; index++) {
63+
await this.page.keyboard.press("Delete");
64+
}
65+
66+
const newToken = speakeasy.totp({
67+
secret,
68+
encoding: "base32",
69+
step: 30,
70+
});
71+
72+
await this.page.locator(`xpath=.//input[@data-test='single-input']`).first().type(newToken);
73+
}
5774
}
5875

5976
async setupAuthenticator() {

authservice/login-with-passwordless/auth-case-3.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { LoginPage } from "./LoginPage";
88
const passwordTestingFactor = "Testing@123";
99

1010
test.describe.serial("Passwordless Login scenarios", () => {
11-
test.setTimeout(90000);
11+
test.setTimeout(120000);
1212

1313
test("Login email passwordless case 3, mandatory MFA then setup 2FA @mandatorymfa", async ({ page, browser }) => {
1414
const testEmail = generateEmailWithTag();

0 commit comments

Comments
 (0)