@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.d.ts
CHANGED
|
@@ -2146,7 +2146,7 @@ declare class GooglePage extends IntegrationBase {
|
|
|
2146
2146
|
* @endexample
|
|
2147
2147
|
*/
|
|
2148
2148
|
loginToGoogle: () => Promise<void>;
|
|
2149
|
-
enterTotpCode: (
|
|
2149
|
+
enterTotpCode: () => Promise<void>;
|
|
2150
2150
|
/**
|
|
2151
2151
|
*
|
|
2152
2152
|
* Logs out of the Google account by navigating to the account settings and clicking the "Sign Out" button.
|
package/index.js
CHANGED
|
@@ -116427,11 +116427,8 @@ class GooglePage extends IntegrationBase {
|
|
|
116427
116427
|
.getByRole("link", { name: GOOGLE_LOGIN_TEXTS.neetoAutomation })
|
|
116428
116428
|
.click();
|
|
116429
116429
|
await expect(chooseAnAccountHeading).toBeHidden({ timeout: 10000 });
|
|
116430
|
-
const verificationCode = this.page
|
|
116431
|
-
.locator("form")
|
|
116432
|
-
.getByText(GOOGLE_LOGIN_TEXTS.verificationCode);
|
|
116433
116430
|
this.page.url().includes(THIRD_PARTY_ROUTES.google.totpChallenge) &&
|
|
116434
|
-
(await this.enterTotpCode(
|
|
116431
|
+
(await this.enterTotpCode());
|
|
116435
116432
|
await this.handleNotVerifiedPage();
|
|
116436
116433
|
const signInHeading = this.page.getByRole("heading", {
|
|
116437
116434
|
name: GOOGLE_LOGIN_TEXTS.signInHeading(appName),
|
|
@@ -116470,32 +116467,29 @@ class GooglePage extends IntegrationBase {
|
|
|
116470
116467
|
.click());
|
|
116471
116468
|
await this.page.waitForLoadState("load", { timeout: 25000 });
|
|
116472
116469
|
await this.page.waitForURL(new RegExp(THIRD_PARTY_ROUTES.google.totpChallenge));
|
|
116473
|
-
|
|
116474
|
-
name: GOOGLE_LOGIN_TEXTS.twoStepVerification,
|
|
116475
|
-
level: 2,
|
|
116476
|
-
exact: true,
|
|
116477
|
-
});
|
|
116478
|
-
await expect(twoStepVerification).toBeVisible({ timeout: 15000 });
|
|
116479
|
-
await this.enterTotpCode(twoStepVerification);
|
|
116470
|
+
await this.enterTotpCode();
|
|
116480
116471
|
await this.page.waitForLoadState("load", { timeout: 25000 });
|
|
116481
116472
|
await this.page.waitForURL(new RegExp(THIRD_PARTY_ROUTES.google.myAccount));
|
|
116482
116473
|
};
|
|
116483
|
-
this.enterTotpCode = async (
|
|
116474
|
+
this.enterTotpCode = async () => {
|
|
116484
116475
|
let previousToken = null;
|
|
116476
|
+
const codeInput = this.page.getByLabel(GOOGLE_LOGIN_TEXTS.enterCode);
|
|
116477
|
+
await expect(codeInput).toBeVisible({ timeout: 20000 });
|
|
116485
116478
|
await expect(async () => {
|
|
116486
116479
|
let totpToken = this.totp.generate({ timestamp: Date.now() });
|
|
116487
116480
|
if (totpToken === previousToken) {
|
|
116488
116481
|
const remainingTime = this.totp.remaining({ timestamp: Date.now() });
|
|
116482
|
+
// Wait for the remaining time plus a small buffer to ensure new token is generated
|
|
116489
116483
|
// eslint-disable-next-line playwright/no-wait-for-timeout
|
|
116490
|
-
await this.page.waitForTimeout(remainingTime + 500);
|
|
116484
|
+
await this.page.waitForTimeout(remainingTime + 500);
|
|
116491
116485
|
totpToken = this.totp.generate({ timestamp: Date.now() });
|
|
116492
116486
|
}
|
|
116493
116487
|
previousToken = totpToken;
|
|
116494
|
-
await
|
|
116488
|
+
await codeInput.fill(totpToken);
|
|
116495
116489
|
expect(this.totp.validate({ token: totpToken })).not.toBeNull();
|
|
116496
116490
|
await this.page.locator(GOOGLE_LOGIN_SELECTORS.totpNext).click();
|
|
116497
116491
|
await expect(this.page.getByText(GOOGLE_LOGIN_TEXTS.wrongCode)).toBeHidden({ timeout: 10000 });
|
|
116498
|
-
await expect(
|
|
116492
|
+
await expect(codeInput).toBeHidden({ timeout: 15000 });
|
|
116499
116493
|
}).toPass({ timeout: 2 * 60 * 1000 });
|
|
116500
116494
|
};
|
|
116501
116495
|
this.logoutFromGoogle = async () => {
|