@bigbinary/neeto-playwright-commons 1.22.34 → 1.22.36

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 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",
@@ -189423,6 +189424,7 @@ const GOOGLE_LOGIN_TEXTS = {
189423
189424
  connectYourGoogleAccount: "Connect your Google account",
189424
189425
  signInWithGoogle: "Sign in with Google",
189425
189426
  signInHeading: (appName) => new RegExp(`(You’re signing back in to ${appName}\\.net|Sign in to ${appName}\\.net)`, "i"),
189427
+ stagingAppName: (appName) => `${appName} - Staging`,
189426
189428
  continue: "Continue",
189427
189429
  selectAll: "Select All",
189428
189430
  appNotVerified: "Google hasn’t verified this app",
@@ -191699,7 +191701,7 @@ class IntegrationBase {
191699
191701
  }
191700
191702
 
191701
191703
  class GooglePage extends IntegrationBase {
191702
- constructor({ page, neetoPlaywrightUtilities, integration, integrationRouteIndex, }) {
191704
+ constructor({ page, neetoPlaywrightUtilities, integration, integrationRouteIndex, appName, }) {
191703
191705
  var _a;
191704
191706
  super({
191705
191707
  page,
@@ -191711,7 +191713,7 @@ class GooglePage extends IntegrationBase {
191711
191713
  await this.page.waitForLoadState("load", { timeout: 25000 });
191712
191714
  await this.page.waitForURL(new RegExp(`${THIRD_PARTY_ROUTES.google.accountchooser}|${THIRD_PARTY_ROUTES.google.chooseAccount}`));
191713
191715
  };
191714
- this.connectGoogleAccount = async (appName) => {
191716
+ this.connectGoogleAccount = async (appName = this.appName) => {
191715
191717
  await this.waitForGoogleAuthURL();
191716
191718
  await this.selectGoogleAccount(appName);
191717
191719
  await this.page.waitForLoadState("load", { timeout: 25000 });
@@ -191720,7 +191722,7 @@ class GooglePage extends IntegrationBase {
191720
191722
  .getByRole("button", { name: GOOGLE_LOGIN_TEXTS.allow })
191721
191723
  .click();
191722
191724
  };
191723
- this.selectGoogleAccount = async (appName) => {
191725
+ this.selectGoogleAccount = async (appName = this.appName) => {
191724
191726
  const chooseAnAccountHeading = this.page.getByText(GOOGLE_LOGIN_TEXTS.chooseAnAccount, { exact: true });
191725
191727
  await test$1.expect(chooseAnAccountHeading).toBeVisible({ timeout: 10000 });
191726
191728
  await this.page
@@ -191836,11 +191838,28 @@ class GooglePage extends IntegrationBase {
191836
191838
  name: GOOGLE_LOGIN_TEXTS.backToSafety,
191837
191839
  })).toBeHidden({ timeout: 10000 });
191838
191840
  };
191841
+ this.revokePermissions = async () => {
191842
+ const stagingAppName = GOOGLE_LOGIN_TEXTS.stagingAppName(this.appName);
191843
+ await this.page.goto(THIRD_PARTY_ROUTES.google.connections);
191844
+ await this.page.waitForLoadState("load", { timeout: 15000 });
191845
+ const app = this.page.getByRole("link", { name: stagingAppName });
191846
+ if (await app.isHidden())
191847
+ return;
191848
+ await app.click();
191849
+ await this.page
191850
+ .getByRole("button", { name: GOOGLE_LOGIN_TEXTS.deleteConnections })
191851
+ .click();
191852
+ await this.page
191853
+ .getByRole("button", { name: GOOGLE_LOGIN_TEXTS.confirm })
191854
+ .click();
191855
+ await test$1.expect(this.page.getByText(GOOGLE_LOGIN_TEXTS.noLongerConnected)).toBeVisible();
191856
+ };
191857
+ this.t = playwrightI18nextFixture.getI18nInstance().t;
191858
+ this.appName = appName !== null && appName !== void 0 ? appName : "";
191839
191859
  this.totp = initializeTotp({
191840
191860
  issuer: "Google",
191841
191861
  secret: (_a = process.env.GOOGLE_2FA_SECRET_KEY) !== null && _a !== void 0 ? _a : "",
191842
191862
  });
191843
- this.t = playwrightI18nextFixture.getI18nInstance().t;
191844
191863
  }
191845
191864
  }
191846
191865
 
@@ -193599,36 +193618,46 @@ class ApiKeysPage {
193599
193618
 
193600
193619
  class AuditLogsPage {
193601
193620
  constructor(page, neetoPlaywrightUtilities) {
193621
+ this.page = page;
193622
+ this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
193623
+ this.verifyAuditLogEntry = async ({ page = this.page, tableDetails, paneDetails, }) => {
193624
+ await this.verifyAuditLog(tableDetails);
193625
+ await this.verifyDataInPane({
193626
+ ...paneDetails,
193627
+ page,
193628
+ action: tableDetails.action,
193629
+ });
193630
+ };
193602
193631
  this.verifyAuditLog = async ({ targetRow, action, date, adminName, }) => {
193603
- this.targetRow = targetRow;
193604
- await test$1.expect(targetRow.getByRole("cell", { name: action })).toBeVisible();
193605
- await test$1.expect(targetRow.getByRole("cell", {
193606
- name: this.t("neetoMolecules.common.success"),
193607
- })).toBeVisible();
193608
- await test$1.expect(targetRow.getByRole("cell", { name: adminName })).toBeVisible();
193609
- await test$1.expect(targetRow.getByRole("cell", { name: date })).toBeVisible();
193632
+ if (targetRow) {
193633
+ this.targetRow = targetRow;
193634
+ }
193635
+ await Promise.all([action, this.t("neetoMolecules.common.success"), adminName, date].map(name => test$1.expect(this.targetRow.getByRole("cell", { name })).toBeVisible()));
193610
193636
  };
193611
193637
  this.verifyDataInPane = async ({ page = this.page, action, values, firstName, lastName, roleName, }) => {
193612
- await this.targetRow.getByText(action).click();
193613
- await Promise.all(values.map(value => test$1.expect(page.getByTestId(COMMON_SELECTORS.paneBody).getByText(value)).toBeVisible()));
193614
193638
  const rowInPane = page
193615
193639
  .getByTestId(COMMON_SELECTORS.paneBody)
193616
193640
  .getByRole("row");
193617
- firstName &&
193618
- (await test$1.expect(rowInPane
193619
- .filter({ hasText: this.t("neetoTeamMembers.labels.firstName") })
193620
- .getByText(firstName)).toBeVisible());
193621
- lastName &&
193622
- (await test$1.expect(rowInPane
193623
- .filter({ hasText: this.t("neetoTeamMembers.labels.lastName") })
193624
- .getByText(lastName)).toBeVisible());
193625
- roleName &&
193626
- (await test$1.expect(rowInPane
193627
- .filter({ hasText: AUDIT_LOGS_TEXTS.organizationRole })
193628
- .getByText(roleName)).toBeVisible());
193641
+ await this.targetRow.getByText(action).click();
193642
+ await Promise.all([
193643
+ ...values.map(value => test$1.expect(page.getByTestId(COMMON_SELECTORS.paneBody).getByText(value)).toBeVisible()),
193644
+ firstName &&
193645
+ // eslint-disable-next-line playwright/missing-playwright-await
193646
+ test$1.expect(rowInPane
193647
+ .filter({ hasText: this.t("neetoTeamMembers.labels.firstName") })
193648
+ .getByText(firstName)).toBeVisible(),
193649
+ lastName &&
193650
+ // eslint-disable-next-line playwright/missing-playwright-await
193651
+ test$1.expect(rowInPane
193652
+ .filter({ hasText: this.t("neetoTeamMembers.labels.lastName") })
193653
+ .getByText(lastName)).toBeVisible(),
193654
+ roleName &&
193655
+ // eslint-disable-next-line playwright/missing-playwright-await
193656
+ test$1.expect(rowInPane
193657
+ .filter({ hasText: AUDIT_LOGS_TEXTS.organizationRole })
193658
+ .getByText(roleName)).toBeVisible(),
193659
+ ]);
193629
193660
  };
193630
- this.page = page;
193631
- this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
193632
193661
  this.t = playwrightI18nextFixture.getI18nInstance().t;
193633
193662
  }
193634
193663
  }