@bigbinary/neeto-playwright-commons 1.22.33 → 1.22.35
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 +31 -11
- package/index.cjs.js.map +1 -1
- package/index.d.ts +36 -45
- package/index.js +31 -11
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -116,6 +116,7 @@ const THIRD_PARTY_ROUTES = {
|
|
|
116
116
|
signin: "https://accounts.google.com/v3/signin/identifier?hl=en-gb&ifkv=ASKXGp0nW770RS7xin2puSwbGDpGCeaVKDtCgfpEU73fYmhMKbqUjukBQ5x8kdvEVxQ7OvcrnUo8sg&flowName=GlifWebSignIn&flowEntry=ServiceLogin&dsh=S688843923%3A1704795906762870&theme=glif",
|
|
117
117
|
password: "https://accounts.google.com/v3/signin/challenge/pwd",
|
|
118
118
|
totpChallenge: "https://accounts.google.com/v3/signin/challenge/totp",
|
|
119
|
+
connections: "https://myaccount.google.com/connections",
|
|
119
120
|
challengeSelection: "https://accounts.google.com/v3/signin/challenge/selection",
|
|
120
121
|
myAccount: "https://myaccount.google.com/",
|
|
121
122
|
chooseAccount: "accounts.google.com/o/oauth2/auth/oauthchooseaccount",
|
|
@@ -189192,6 +189193,7 @@ const GOOGLE_LOGIN_TEXTS = {
|
|
|
189192
189193
|
connectYourGoogleAccount: "Connect your Google account",
|
|
189193
189194
|
signInWithGoogle: "Sign in with Google",
|
|
189194
189195
|
signInHeading: (appName) => new RegExp(`(You’re signing back in to ${appName}\\.net|Sign in to ${appName}\\.net)`, "i"),
|
|
189196
|
+
stagingAppName: (appName) => `${appName} - Staging`,
|
|
189195
189197
|
continue: "Continue",
|
|
189196
189198
|
selectAll: "Select All",
|
|
189197
189199
|
appNotVerified: "Google hasn’t verified this app",
|
|
@@ -191468,7 +191470,7 @@ class IntegrationBase {
|
|
|
191468
191470
|
}
|
|
191469
191471
|
|
|
191470
191472
|
class GooglePage extends IntegrationBase {
|
|
191471
|
-
constructor({ page, neetoPlaywrightUtilities, integration, integrationRouteIndex, }) {
|
|
191473
|
+
constructor({ page, neetoPlaywrightUtilities, integration, integrationRouteIndex, appName, }) {
|
|
191472
191474
|
var _a;
|
|
191473
191475
|
super({
|
|
191474
191476
|
page,
|
|
@@ -191480,7 +191482,7 @@ class GooglePage extends IntegrationBase {
|
|
|
191480
191482
|
await this.page.waitForLoadState("load", { timeout: 25000 });
|
|
191481
191483
|
await this.page.waitForURL(new RegExp(`${THIRD_PARTY_ROUTES.google.accountchooser}|${THIRD_PARTY_ROUTES.google.chooseAccount}`));
|
|
191482
191484
|
};
|
|
191483
|
-
this.connectGoogleAccount = async (appName) => {
|
|
191485
|
+
this.connectGoogleAccount = async (appName = this.appName) => {
|
|
191484
191486
|
await this.waitForGoogleAuthURL();
|
|
191485
191487
|
await this.selectGoogleAccount(appName);
|
|
191486
191488
|
await this.page.waitForLoadState("load", { timeout: 25000 });
|
|
@@ -191489,7 +191491,7 @@ class GooglePage extends IntegrationBase {
|
|
|
191489
191491
|
.getByRole("button", { name: GOOGLE_LOGIN_TEXTS.allow })
|
|
191490
191492
|
.click();
|
|
191491
191493
|
};
|
|
191492
|
-
this.selectGoogleAccount = async (appName) => {
|
|
191494
|
+
this.selectGoogleAccount = async (appName = this.appName) => {
|
|
191493
191495
|
const chooseAnAccountHeading = this.page.getByText(GOOGLE_LOGIN_TEXTS.chooseAnAccount, { exact: true });
|
|
191494
191496
|
await test$1.expect(chooseAnAccountHeading).toBeVisible({ timeout: 10000 });
|
|
191495
191497
|
await this.page
|
|
@@ -191605,11 +191607,28 @@ class GooglePage extends IntegrationBase {
|
|
|
191605
191607
|
name: GOOGLE_LOGIN_TEXTS.backToSafety,
|
|
191606
191608
|
})).toBeHidden({ timeout: 10000 });
|
|
191607
191609
|
};
|
|
191610
|
+
this.revokePermissions = async () => {
|
|
191611
|
+
const stagingAppName = GOOGLE_LOGIN_TEXTS.stagingAppName(this.appName);
|
|
191612
|
+
await this.page.goto(THIRD_PARTY_ROUTES.google.connections);
|
|
191613
|
+
await this.page.waitForLoadState("load", { timeout: 15000 });
|
|
191614
|
+
const app = this.page.getByRole("link", { name: stagingAppName });
|
|
191615
|
+
if (await app.isHidden())
|
|
191616
|
+
return;
|
|
191617
|
+
await app.click();
|
|
191618
|
+
await this.page
|
|
191619
|
+
.getByRole("button", { name: GOOGLE_LOGIN_TEXTS.deleteConnections })
|
|
191620
|
+
.click();
|
|
191621
|
+
await this.page
|
|
191622
|
+
.getByRole("button", { name: GOOGLE_LOGIN_TEXTS.confirm })
|
|
191623
|
+
.click();
|
|
191624
|
+
await test$1.expect(this.page.getByText(GOOGLE_LOGIN_TEXTS.noLongerConnected)).toBeVisible();
|
|
191625
|
+
};
|
|
191626
|
+
this.t = playwrightI18nextFixture.getI18nInstance().t;
|
|
191627
|
+
this.appName = appName !== null && appName !== void 0 ? appName : "";
|
|
191608
191628
|
this.totp = initializeTotp({
|
|
191609
191629
|
issuer: "Google",
|
|
191610
191630
|
secret: (_a = process.env.GOOGLE_2FA_SECRET_KEY) !== null && _a !== void 0 ? _a : "",
|
|
191611
191631
|
});
|
|
191612
|
-
this.t = playwrightI18nextFixture.getI18nInstance().t;
|
|
191613
191632
|
}
|
|
191614
191633
|
}
|
|
191615
191634
|
|
|
@@ -192875,6 +192894,9 @@ class TeamMembers {
|
|
|
192875
192894
|
this.addMemberViaUI = async ({ emails = [faker.faker.internet.exampleEmail()], role = "standard", } = {}) => {
|
|
192876
192895
|
await this.page.getByTestId(MEMBER_SELECTORS.newButton).click();
|
|
192877
192896
|
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
192897
|
+
const continueButton = this.page.getByTestId(MEMBER_SELECTORS.continueButton);
|
|
192898
|
+
await test$1.expect(continueButton).toBeVisible();
|
|
192899
|
+
await test$1.expect(continueButton.getByTestId(COMMON_SELECTORS.uiSpinner)).toBeHidden({ timeout: 35000 });
|
|
192878
192900
|
await this.page
|
|
192879
192901
|
.getByTestId(MEMBER_FORM_SELECTORS.emailTextField)
|
|
192880
192902
|
.fill(emails.join(", "));
|
|
@@ -192882,7 +192904,7 @@ class TeamMembers {
|
|
|
192882
192904
|
await this.neetoPlaywrightUtilities.toggleElement({
|
|
192883
192905
|
locator: this.page.getByTestId(MEMBER_SELECTORS.roleLabel(role)),
|
|
192884
192906
|
});
|
|
192885
|
-
await
|
|
192907
|
+
await continueButton.click();
|
|
192886
192908
|
if (IS_STAGING_ENV) {
|
|
192887
192909
|
await this.page
|
|
192888
192910
|
.getByTestId(COMMON_SELECTORS.paneBody)
|
|
@@ -193076,6 +193098,7 @@ neetoPlaywrightUtilities, loginPath = "/", }) => {
|
|
|
193076
193098
|
if (shouldSkipSetupAndTeardown())
|
|
193077
193099
|
return;
|
|
193078
193100
|
await page.goto(loginPath, { timeout: 20000 });
|
|
193101
|
+
await page.waitForLoadState("load", { timeout: 35000 });
|
|
193079
193102
|
await page
|
|
193080
193103
|
.getByTestId(LOGIN_SELECTORS.emailTextField)
|
|
193081
193104
|
.fill(CREDENTIALS.email);
|
|
@@ -193108,9 +193131,7 @@ class OrganizationPage {
|
|
|
193108
193131
|
return `https://${subdomainName}.${appName}.net`;
|
|
193109
193132
|
};
|
|
193110
193133
|
this.createOrganization = async ({ email, businessName, subdomainName, firstName, lastName, appName, }) => {
|
|
193111
|
-
if (!IS_STAGING_ENV)
|
|
193112
|
-
return;
|
|
193113
|
-
if (shouldSkipSetupAndTeardown())
|
|
193134
|
+
if (!IS_STAGING_ENV || shouldSkipSetupAndTeardown())
|
|
193114
193135
|
return;
|
|
193115
193136
|
const defaultOtp = "123456";
|
|
193116
193137
|
const appNameInLowerCase = appName.toLowerCase();
|
|
@@ -193118,6 +193139,7 @@ class OrganizationPage {
|
|
|
193118
193139
|
isNeetoAuth
|
|
193119
193140
|
? await this.page.goto(ROUTES.neetoAuthSignup, { timeout: 20000 })
|
|
193120
193141
|
: await this.page.goto(`${ROUTES.neetoAuthSignup}?redirect_uri=${appNameInLowerCase}.net/admin`, { timeout: 20000 });
|
|
193142
|
+
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
193121
193143
|
const submitButton = this.page.getByTestId(SIGNUP_SELECTORS.submitButton);
|
|
193122
193144
|
await this.page.getByTestId(SIGNUP_SELECTORS.emailTextField).fill(email);
|
|
193123
193145
|
await submitButton.click();
|
|
@@ -193141,9 +193163,7 @@ class OrganizationPage {
|
|
|
193141
193163
|
});
|
|
193142
193164
|
};
|
|
193143
193165
|
this.setupOrganization = async (product) => {
|
|
193144
|
-
if (!IS_STAGING_ENV)
|
|
193145
|
-
return;
|
|
193146
|
-
if (shouldSkipSetupAndTeardown())
|
|
193166
|
+
if (!IS_STAGING_ENV || shouldSkipSetupAndTeardown())
|
|
193147
193167
|
return;
|
|
193148
193168
|
const { user } = readFileSyncIfExists();
|
|
193149
193169
|
await this.createOrganization({
|