@bigbinary/neeto-playwright-commons 1.26.12 → 1.26.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +9 -15
- package/index.cjs.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +9 -15
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -116448,11 +116448,8 @@ class GooglePage extends IntegrationBase {
|
|
|
116448
116448
|
.getByRole("link", { name: GOOGLE_LOGIN_TEXTS.neetoAutomation })
|
|
116449
116449
|
.click();
|
|
116450
116450
|
await test.expect(chooseAnAccountHeading).toBeHidden({ timeout: 10000 });
|
|
116451
|
-
const verificationCode = this.page
|
|
116452
|
-
.locator("form")
|
|
116453
|
-
.getByText(GOOGLE_LOGIN_TEXTS.verificationCode);
|
|
116454
116451
|
this.page.url().includes(THIRD_PARTY_ROUTES.google.totpChallenge) &&
|
|
116455
|
-
(await this.enterTotpCode(
|
|
116452
|
+
(await this.enterTotpCode());
|
|
116456
116453
|
await this.handleNotVerifiedPage();
|
|
116457
116454
|
const signInHeading = this.page.getByRole("heading", {
|
|
116458
116455
|
name: GOOGLE_LOGIN_TEXTS.signInHeading(appName),
|
|
@@ -116491,32 +116488,29 @@ class GooglePage extends IntegrationBase {
|
|
|
116491
116488
|
.click());
|
|
116492
116489
|
await this.page.waitForLoadState("load", { timeout: 25000 });
|
|
116493
116490
|
await this.page.waitForURL(new RegExp(THIRD_PARTY_ROUTES.google.totpChallenge));
|
|
116494
|
-
|
|
116495
|
-
name: GOOGLE_LOGIN_TEXTS.twoStepVerification,
|
|
116496
|
-
level: 2,
|
|
116497
|
-
exact: true,
|
|
116498
|
-
});
|
|
116499
|
-
await test.expect(twoStepVerification).toBeVisible({ timeout: 15000 });
|
|
116500
|
-
await this.enterTotpCode(twoStepVerification);
|
|
116491
|
+
await this.enterTotpCode();
|
|
116501
116492
|
await this.page.waitForLoadState("load", { timeout: 25000 });
|
|
116502
116493
|
await this.page.waitForURL(new RegExp(THIRD_PARTY_ROUTES.google.myAccount));
|
|
116503
116494
|
};
|
|
116504
|
-
this.enterTotpCode = async (
|
|
116495
|
+
this.enterTotpCode = async () => {
|
|
116505
116496
|
let previousToken = null;
|
|
116497
|
+
const codeInput = this.page.getByLabel(GOOGLE_LOGIN_TEXTS.enterCode);
|
|
116498
|
+
await test.expect(codeInput).toBeVisible({ timeout: 20000 });
|
|
116506
116499
|
await test.expect(async () => {
|
|
116507
116500
|
let totpToken = this.totp.generate({ timestamp: Date.now() });
|
|
116508
116501
|
if (totpToken === previousToken) {
|
|
116509
116502
|
const remainingTime = this.totp.remaining({ timestamp: Date.now() });
|
|
116503
|
+
// Wait for the remaining time plus a small buffer to ensure new token is generated
|
|
116510
116504
|
// eslint-disable-next-line playwright/no-wait-for-timeout
|
|
116511
|
-
await this.page.waitForTimeout(remainingTime + 500);
|
|
116505
|
+
await this.page.waitForTimeout(remainingTime + 500);
|
|
116512
116506
|
totpToken = this.totp.generate({ timestamp: Date.now() });
|
|
116513
116507
|
}
|
|
116514
116508
|
previousToken = totpToken;
|
|
116515
|
-
await
|
|
116509
|
+
await codeInput.fill(totpToken);
|
|
116516
116510
|
test.expect(this.totp.validate({ token: totpToken })).not.toBeNull();
|
|
116517
116511
|
await this.page.locator(GOOGLE_LOGIN_SELECTORS.totpNext).click();
|
|
116518
116512
|
await test.expect(this.page.getByText(GOOGLE_LOGIN_TEXTS.wrongCode)).toBeHidden({ timeout: 10000 });
|
|
116519
|
-
await test.expect(
|
|
116513
|
+
await test.expect(codeInput).toBeHidden({ timeout: 15000 });
|
|
116520
116514
|
}).toPass({ timeout: 2 * 60 * 1000 });
|
|
116521
116515
|
};
|
|
116522
116516
|
this.logoutFromGoogle = async () => {
|