@bigbinary/neeto-playwright-commons 1.24.0 → 1.24.1
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 +18 -8
- package/index.cjs.js.map +1 -1
- package/index.js +18 -8
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -116153,14 +116153,24 @@ class GooglePage extends IntegrationBase {
|
|
|
116153
116153
|
await this.page.waitForLoadState("load", { timeout: 25000 });
|
|
116154
116154
|
await this.page.waitForURL(new RegExp(THIRD_PARTY_ROUTES.google.myAccount));
|
|
116155
116155
|
};
|
|
116156
|
-
this.enterTotpCode =
|
|
116157
|
-
|
|
116158
|
-
await
|
|
116159
|
-
|
|
116160
|
-
|
|
116161
|
-
|
|
116162
|
-
|
|
116163
|
-
|
|
116156
|
+
this.enterTotpCode = async (locator) => {
|
|
116157
|
+
let previousToken = null;
|
|
116158
|
+
await test.expect(async () => {
|
|
116159
|
+
let totpToken = this.totp.generate({ timestamp: Date.now() });
|
|
116160
|
+
if (totpToken === previousToken) {
|
|
116161
|
+
const remainingTime = this.totp.remaining({ timestamp: Date.now() });
|
|
116162
|
+
// eslint-disable-next-line playwright/no-wait-for-timeout
|
|
116163
|
+
await this.page.waitForTimeout(remainingTime + 500); // Wait for the remaining time plus a small buffer (500ms) to ensure new token
|
|
116164
|
+
totpToken = this.totp.generate({ timestamp: Date.now() });
|
|
116165
|
+
}
|
|
116166
|
+
previousToken = totpToken;
|
|
116167
|
+
await this.page.getByLabel(GOOGLE_LOGIN_TEXTS.enterCode).fill(totpToken);
|
|
116168
|
+
test.expect(this.totp.validate({ token: totpToken })).not.toBeNull();
|
|
116169
|
+
await this.page.locator(GOOGLE_LOGIN_SELECTORS.totpNext).click();
|
|
116170
|
+
await test.expect(this.page.getByText(GOOGLE_LOGIN_TEXTS.wrongCode)).toBeHidden({ timeout: 10000 });
|
|
116171
|
+
await test.expect(locator).toBeHidden({ timeout: 10000 });
|
|
116172
|
+
}).toPass({ timeout: 2 * 60 * 1000 });
|
|
116173
|
+
};
|
|
116164
116174
|
this.logoutFromGoogle = async () => {
|
|
116165
116175
|
await this.page.goto(THIRD_PARTY_ROUTES.google.myAccount, {
|
|
116166
116176
|
timeout: 20000,
|