@bigbinary/neeto-playwright-commons 1.11.14 → 1.11.15
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 +74 -59
- package/index.cjs.js.map +1 -1
- package/index.d.ts +74 -29
- package/index.js +74 -59
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -13131,7 +13131,7 @@ const GOOGLE_LOGIN_TEXTS = {
|
|
|
13131
13131
|
googleAccount: "Google Account:",
|
|
13132
13132
|
connectYourGoogleAccount: "Connect your Google account",
|
|
13133
13133
|
signInWithGoogle: "Sign in with Google",
|
|
13134
|
-
signInHeading:
|
|
13134
|
+
signInHeading: (appName) => `Sign in to ${appName}.net`,
|
|
13135
13135
|
continue: "Continue",
|
|
13136
13136
|
selectAll: "Select All",
|
|
13137
13137
|
appNotVerified: "Google hasn’t verified this app",
|
|
@@ -13145,6 +13145,12 @@ const GOOGLE_LOGIN_TEXTS = {
|
|
|
13145
13145
|
signOut: "Sign out",
|
|
13146
13146
|
wrongCode: "Wrong code. Try again",
|
|
13147
13147
|
verificationCode: "verification code",
|
|
13148
|
+
confirm: "Confirm",
|
|
13149
|
+
cancel: "Cancel",
|
|
13150
|
+
deleteConnections: "Delete all connections you",
|
|
13151
|
+
noLongerConnected: "You’re no longer connected to",
|
|
13152
|
+
backToSafety: "Back to safety",
|
|
13153
|
+
neetoAutomation: "neeto.automation",
|
|
13148
13154
|
};
|
|
13149
13155
|
|
|
13150
13156
|
const HELP_CENTER_SELECTORS = {
|
|
@@ -13420,14 +13426,6 @@ class HelpAndProfilePage {
|
|
|
13420
13426
|
}
|
|
13421
13427
|
}
|
|
13422
13428
|
|
|
13423
|
-
const INTEGRATION_SELECTORS = {
|
|
13424
|
-
integrationCard: (integration) => `${integration}-integration-card`,
|
|
13425
|
-
connectButton: "connect-button",
|
|
13426
|
-
integrationStatusTag: "integration-status-tag",
|
|
13427
|
-
disconnectButton: "disconnect-button",
|
|
13428
|
-
manageButton: "manage-button",
|
|
13429
|
-
};
|
|
13430
|
-
|
|
13431
13429
|
const GOOGLE_LOGIN_SELECTORS = {
|
|
13432
13430
|
totpNext: "#totpNext",
|
|
13433
13431
|
form: "form",
|
|
@@ -15181,6 +15179,14 @@ const initializeTotp = ({ issuer, secret, }) => {
|
|
|
15181
15179
|
});
|
|
15182
15180
|
};
|
|
15183
15181
|
|
|
15182
|
+
const INTEGRATION_SELECTORS = {
|
|
15183
|
+
integrationCard: (integration) => `${integration}-integration-card`,
|
|
15184
|
+
connectButton: "connect-button",
|
|
15185
|
+
integrationStatusTag: "integration-status-tag",
|
|
15186
|
+
disconnectButton: "disconnect-button",
|
|
15187
|
+
manageButton: "manage-button",
|
|
15188
|
+
};
|
|
15189
|
+
|
|
15184
15190
|
class IntegrationBase {
|
|
15185
15191
|
constructor({ page, neetoPlaywrightUtilities, integration, connectHeader, connectedHeader, pageloaderTimeout, integrationRouteIndex, integrationRouteResponsesParams, }) {
|
|
15186
15192
|
this.disconnect = async (interceptMultipleResponsesParams = {}) => {
|
|
@@ -15256,18 +15262,9 @@ class GooglePage extends IntegrationBase {
|
|
|
15256
15262
|
integration,
|
|
15257
15263
|
integrationRouteIndex,
|
|
15258
15264
|
});
|
|
15259
|
-
this.
|
|
15260
|
-
await this.connect();
|
|
15261
|
-
await test$1.expect(this.page.getByRole("heading", {
|
|
15262
|
-
name: GOOGLE_LOGIN_TEXTS.connectYourGoogleAccount,
|
|
15263
|
-
})).toBeVisible({ timeout: 15000 });
|
|
15264
|
-
await this.page
|
|
15265
|
-
.getByRole("link", {
|
|
15266
|
-
name: GOOGLE_LOGIN_TEXTS.signInWithGoogle,
|
|
15267
|
-
})
|
|
15268
|
-
.click();
|
|
15265
|
+
this.connectGoogleAccount = async (appName) => {
|
|
15269
15266
|
await this.page.waitForURL(new RegExp(THIRD_PARTY_ROUTES.google.chooseAccount));
|
|
15270
|
-
await this.selectGoogleAccount();
|
|
15267
|
+
await this.selectGoogleAccount(appName);
|
|
15271
15268
|
if (process.env.TEST_ENV === ENVIRONMENT.staging) {
|
|
15272
15269
|
await this.stagingConsentFlow();
|
|
15273
15270
|
}
|
|
@@ -15277,22 +15274,26 @@ class GooglePage extends IntegrationBase {
|
|
|
15277
15274
|
.getByRole("button", { name: GOOGLE_LOGIN_TEXTS.allow })
|
|
15278
15275
|
.click();
|
|
15279
15276
|
}
|
|
15280
|
-
await Promise.all([
|
|
15281
|
-
test$1.expect(this.page.getByRole("heading", { name: this.connectedHeader })).toBeVisible({ timeout: 20000 }),
|
|
15282
|
-
test$1.expect(this.page.getByTestId(INTEGRATION_SELECTORS.manageButton)).toBeVisible({ timeout: 20000 }),
|
|
15283
|
-
]);
|
|
15284
15277
|
};
|
|
15285
|
-
this.selectGoogleAccount = async () => {
|
|
15286
|
-
|
|
15287
|
-
|
|
15288
|
-
|
|
15289
|
-
|
|
15290
|
-
|
|
15291
|
-
|
|
15278
|
+
this.selectGoogleAccount = async (appName) => {
|
|
15279
|
+
const neetoAutomationLocator = this.page.getByRole("link", {
|
|
15280
|
+
name: GOOGLE_LOGIN_TEXTS.neetoAutomation,
|
|
15281
|
+
});
|
|
15282
|
+
await neetoAutomationLocator.click();
|
|
15283
|
+
await test$1.expect(neetoAutomationLocator).toBeHidden({ timeout: 10000 });
|
|
15284
|
+
const verificationCode = this.page
|
|
15285
|
+
.locator("form")
|
|
15286
|
+
.getByText(GOOGLE_LOGIN_TEXTS.verificationCode);
|
|
15287
|
+
if (this.page.url().includes(THIRD_PARTY_ROUTES.google.totpChallenge)) {
|
|
15292
15288
|
await this.enterTotpCode(verificationCode);
|
|
15293
|
-
// eslint-disable-next-line no-empty
|
|
15294
15289
|
}
|
|
15295
|
-
|
|
15290
|
+
await this.handleNotVerifiedPage();
|
|
15291
|
+
await test$1.expect(this.page.getByRole("heading", {
|
|
15292
|
+
name: GOOGLE_LOGIN_TEXTS.signInHeading(appName),
|
|
15293
|
+
})).toBeVisible();
|
|
15294
|
+
await this.page
|
|
15295
|
+
.getByRole("button", { name: GOOGLE_LOGIN_TEXTS.continue })
|
|
15296
|
+
.click();
|
|
15296
15297
|
};
|
|
15297
15298
|
this.loginToGoogle = async () => {
|
|
15298
15299
|
await this.page.goto(THIRD_PARTY_ROUTES.google.signin);
|
|
@@ -15315,17 +15316,20 @@ class GooglePage extends IntegrationBase {
|
|
|
15315
15316
|
await this.page
|
|
15316
15317
|
.getByRole("button", { name: GOOGLE_LOGIN_TEXTS.next })
|
|
15317
15318
|
.click();
|
|
15318
|
-
|
|
15319
|
-
|
|
15320
|
-
|
|
15321
|
-
|
|
15319
|
+
if (this.page.url().includes(THIRD_PARTY_ROUTES.google.challengeSelection)) {
|
|
15320
|
+
await this.page
|
|
15321
|
+
.locator(GOOGLE_LOGIN_SELECTORS.totpChallengeSelector)
|
|
15322
|
+
.click();
|
|
15323
|
+
}
|
|
15322
15324
|
await this.page.waitForURL(new RegExp(THIRD_PARTY_ROUTES.google.totpChallenge));
|
|
15323
|
-
const twoStepVerification = this.page
|
|
15324
|
-
.
|
|
15325
|
-
|
|
15325
|
+
const twoStepVerification = this.page.locator("form").getByRole("heading", {
|
|
15326
|
+
name: GOOGLE_LOGIN_TEXTS.twoStepVerification,
|
|
15327
|
+
level: 2,
|
|
15328
|
+
exact: true,
|
|
15329
|
+
});
|
|
15326
15330
|
await test$1.expect(twoStepVerification).toBeVisible();
|
|
15327
15331
|
await this.enterTotpCode(twoStepVerification);
|
|
15328
|
-
await this.page.waitForURL(new RegExp(THIRD_PARTY_ROUTES.google.myAccount));
|
|
15332
|
+
await this.page.waitForURL(new RegExp(THIRD_PARTY_ROUTES.google.myAccount), { waitUntil: "load" });
|
|
15329
15333
|
};
|
|
15330
15334
|
this.enterTotpCode = async (locator) => {
|
|
15331
15335
|
await test$1.expect(async () => {
|
|
@@ -15333,8 +15337,8 @@ class GooglePage extends IntegrationBase {
|
|
|
15333
15337
|
await this.page.getByLabel(GOOGLE_LOGIN_TEXTS.enterCode).fill(totpToken);
|
|
15334
15338
|
test$1.expect(this.totp.validate({ token: totpToken })).not.toBeNull();
|
|
15335
15339
|
await this.page.locator(GOOGLE_LOGIN_SELECTORS.totpNext).click();
|
|
15336
|
-
await test$1.expect(this.page.getByText(GOOGLE_LOGIN_TEXTS.wrongCode)).toBeHidden();
|
|
15337
|
-
await test$1.expect(locator).toBeHidden({ timeout:
|
|
15340
|
+
await test$1.expect(this.page.getByText(GOOGLE_LOGIN_TEXTS.wrongCode)).toBeHidden({ timeout: 15000 });
|
|
15341
|
+
await test$1.expect(locator).toBeHidden({ timeout: 10000 });
|
|
15338
15342
|
}).toPass({ timeout: 50000 });
|
|
15339
15343
|
};
|
|
15340
15344
|
this.logoutFromGoogle = async () => {
|
|
@@ -15349,28 +15353,39 @@ class GooglePage extends IntegrationBase {
|
|
|
15349
15353
|
await this.disconnect();
|
|
15350
15354
|
await this.verifyIntegrationStatus("disconnected");
|
|
15351
15355
|
};
|
|
15352
|
-
this.stagingConsentFlow = async () => {
|
|
15353
|
-
await this.
|
|
15354
|
-
|
|
15355
|
-
|
|
15356
|
-
|
|
15357
|
-
|
|
15358
|
-
|
|
15359
|
-
.click();
|
|
15360
|
-
await test$1.expect(this.page.getByRole("heading", {
|
|
15361
|
-
name: GOOGLE_LOGIN_TEXTS.signInHeading,
|
|
15362
|
-
})).toBeVisible();
|
|
15363
|
-
await this.page
|
|
15364
|
-
.getByRole("button", { name: GOOGLE_LOGIN_TEXTS.continue })
|
|
15365
|
-
.click();
|
|
15356
|
+
this.stagingConsentFlow = async ({ abortFlow = false, allowPermissions = true, } = {}) => {
|
|
15357
|
+
await this.handleNotVerifiedPage();
|
|
15358
|
+
if (this.page.url().includes(THIRD_PARTY_ROUTES.google.additionalInfoScreen)) {
|
|
15359
|
+
await this.page
|
|
15360
|
+
.getByRole("button", { name: GOOGLE_LOGIN_TEXTS.continue })
|
|
15361
|
+
.click({ timeout: 20000 });
|
|
15362
|
+
}
|
|
15366
15363
|
await this.page.waitForURL(new RegExp(THIRD_PARTY_ROUTES.google.consentSummary));
|
|
15364
|
+
if (abortFlow) {
|
|
15365
|
+
await this.page
|
|
15366
|
+
.getByRole("button", { name: GOOGLE_LOGIN_TEXTS.cancel })
|
|
15367
|
+
.click({ timeout: 20000 });
|
|
15368
|
+
return;
|
|
15369
|
+
}
|
|
15367
15370
|
const selectAllPermissions = this.page.getByLabel(GOOGLE_LOGIN_TEXTS.selectAll);
|
|
15368
|
-
if (await selectAllPermissions.isVisible()) {
|
|
15371
|
+
if (allowPermissions && (await selectAllPermissions.isVisible())) {
|
|
15369
15372
|
await selectAllPermissions.click();
|
|
15370
15373
|
}
|
|
15371
15374
|
await this.page
|
|
15372
15375
|
.getByRole("button", { name: GOOGLE_LOGIN_TEXTS.continue })
|
|
15373
|
-
.click({ timeout:
|
|
15376
|
+
.click({ timeout: 20000 });
|
|
15377
|
+
};
|
|
15378
|
+
this.handleNotVerifiedPage = async () => {
|
|
15379
|
+
const continueUnsafeButton = this.page.getByRole("button", {
|
|
15380
|
+
name: GOOGLE_LOGIN_TEXTS.continue,
|
|
15381
|
+
});
|
|
15382
|
+
const backToSafety = this.page.getByRole("button", {
|
|
15383
|
+
name: GOOGLE_LOGIN_TEXTS.backToSafety,
|
|
15384
|
+
});
|
|
15385
|
+
if (this.page.url().includes(THIRD_PARTY_ROUTES.google.warningScreen)) {
|
|
15386
|
+
await continueUnsafeButton.click();
|
|
15387
|
+
await test$1.expect(backToSafety).toBeHidden({ timeout: 10000 });
|
|
15388
|
+
}
|
|
15374
15389
|
};
|
|
15375
15390
|
this.totp = initializeTotp({
|
|
15376
15391
|
issuer: "Google",
|