@bigbinary/neeto-playwright-commons 1.26.19 → 1.26.21

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
@@ -308,6 +308,7 @@ const ENVIRONMENT = {
308
308
  const EXAMPLE_URL = "https://example.com";
309
309
  const IS_STAGING_ENV = process.env.TEST_ENV === ENVIRONMENT.staging;
310
310
  const IS_DEV_ENV = process.env.TEST_ENV === ENVIRONMENT.development;
311
+ const DEFAULT_WEBHOOKS_RESPONSE_TEXT = JSON.stringify({ success: true });
311
312
  const STORAGE_STATE = "./e2e/auth/user.json";
312
313
  const GLOBAL_TRANSLATIONS_PATTERN = "../node_modules/@bigbinary/**/translations/en.json";
313
314
  const PROJECT_TRANSLATIONS_PATH = "../app/javascript/src/translations/en.json";
@@ -423,6 +424,9 @@ class WebhookSiteApi {
423
424
  this.WEBHOOK_SITE_BASE_URL = "https://webhook.site/token";
424
425
  this.create = () => this.request.post(this.WEBHOOK_SITE_BASE_URL);
425
426
  this.fetch = (token) => this.request.get(`${this.WEBHOOK_SITE_BASE_URL}/${token}/request/latest`);
427
+ this.configure = (tokenId, content = DEFAULT_WEBHOOKS_RESPONSE_TEXT) => this.request.put(`${THIRD_PARTY_ROUTES.webhooks.site}token/${tokenId}`, {
428
+ data: neetoCist.keysToSnakeCase({ defaultContent: content }),
429
+ });
426
430
  }
427
431
  }
428
432
 
@@ -4847,6 +4851,7 @@ const THANK_YOU_SELECTORS = {
4847
4851
  previewImage: "preview-image",
4848
4852
  thankYouMessageEditor: "thank-you-message-editor",
4849
4853
  thankYouMessageWrapper: "thank-you-message-wrapper",
4854
+ countLabel: "thank-you-pages-count",
4850
4855
  };
4851
4856
 
4852
4857
  const generateStagingData = (product = "invoice") => {
@@ -5556,6 +5561,9 @@ const TABLE_SELECTORS = {
5556
5561
  hideButton: "hide-column-menu-button",
5557
5562
  columnHeaderTitle: (columnName) => `${neetoCist.hyphenate(columnName)}-header-title`,
5558
5563
  columnMenuButton: "column-menu-button",
5564
+ columnInfoIcon: "column-info-icon",
5565
+ columnMenuBtn: (action) => `${action}-column-menu-button`,
5566
+ moveColumnBtn: (position) => `move-column-${position}-menu-button`,
5559
5567
  };
5560
5568
 
5561
5569
  const THEMES_SELECTORS = {
@@ -5584,6 +5592,7 @@ const CUSTOM_DOMAIN_SELECTORS = {
5584
5592
  nameInputError: "domain-name-input-error",
5585
5593
  };
5586
5594
  const API_KEYS_SELECTORS = {
5595
+ countLabel: "api-keys-count",
5587
5596
  editApiKeyButton: "api-key-edit-button",
5588
5597
  deleteApiKeyButton: "api-key-delete-button",
5589
5598
  addApiKeyButton: "add-api-key-button",
@@ -5957,17 +5966,15 @@ class CustomCommands {
5957
5966
  }).toPass({ timeout: 30000 });
5958
5967
  };
5959
5968
  this.verifyBreadcrumbs = async (titlesAndRoutes) => {
5960
- const breadcrumbHeader = this.page.getByTestId(COMMON_SELECTORS.breadcrumbHeader);
5961
- await test.expect(breadcrumbHeader).toHaveCount(titlesAndRoutes.length);
5962
- await Promise.all(titlesAndRoutes.map(async ({ title, route }) => {
5963
- const isRoutePresent = neetoCist.isPresent(route);
5964
- const breadcrumb = isRoutePresent
5965
- ? breadcrumbHeader.getByRole("link", { name: title, exact: true })
5966
- : breadcrumbHeader.getByTestId(COMMON_SELECTORS.breadcrumb(title));
5967
- return isRoutePresent
5968
- ? await test.expect(breadcrumb).toHaveAttribute("href", route)
5969
- : await test.expect(breadcrumb).toBeVisible();
5970
- }));
5969
+ const header = this.page.getByTestId(COMMON_SELECTORS.breadcrumbHeader);
5970
+ const titles = ramda.pluck("title", titlesAndRoutes);
5971
+ const [last, ...links] = titlesAndRoutes.slice().reverse();
5972
+ await Promise.all([
5973
+ test.expect(header).toContainText(titles),
5974
+ test.expect(header).toHaveCount(titlesAndRoutes.length),
5975
+ test.expect(header.getByRole("link", { name: last === null || last === void 0 ? void 0 : last.title, exact: true })).toHaveCount(0),
5976
+ ...links.map(({ title, route }) => test.expect(header.getByRole("link", { name: title, exact: true })).toHaveAttribute("href", route)),
5977
+ ]);
5971
5978
  };
5972
5979
  this.uploadFileViaDispatchV2 = async ({ droppableZone = this.page.getByTestId(COMMON_SELECTORS.fileUploadBody), dispatchEvent = "drop", timeout = 45000, file, }) => {
5973
5980
  const serializedFile = await serializeFileForBrowser(file);
@@ -118843,6 +118850,27 @@ class OrganizationPage {
118843
118850
  await this.page.getByTestId(COMMON_SELECTORS.selectOption(country)).click();
118844
118851
  await test.expect(countrySelector).toContainText(country);
118845
118852
  };
118853
+ this.loginViaGoogleAuth = async () => {
118854
+ const googlePage = new GooglePage({
118855
+ neetoPlaywrightUtilities: this.neetoPlaywrightUtilities,
118856
+ page: this.page,
118857
+ integration: "google",
118858
+ });
118859
+ const heading = this.page.getByText(GOOGLE_LOGIN_TEXTS.chooseAnAccount, {
118860
+ exact: true,
118861
+ });
118862
+ await this.page
118863
+ .getByTestId(LOGIN_SELECTORS.googleAuthenticationButton)
118864
+ .click();
118865
+ await test.expect(heading).toBeVisible({ timeout: 10000 });
118866
+ await this.page
118867
+ .getByRole("link", { name: GOOGLE_LOGIN_TEXTS.neetoAutomation })
118868
+ .click();
118869
+ await test.expect(heading).toBeHidden({ timeout: 10000 });
118870
+ this.page.url().includes(THIRD_PARTY_ROUTES.google.totpChallenge) &&
118871
+ (await googlePage.enterTotpCode());
118872
+ await this.page.waitForLoadState();
118873
+ };
118846
118874
  this.page = page;
118847
118875
  this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
118848
118876
  }
@@ -124871,6 +124899,7 @@ exports.CustomDomainPage = CustomDomainPage;
124871
124899
  exports.DATE_PICKER_SELECTORS = DATE_PICKER_SELECTORS;
124872
124900
  exports.DATE_RANGES = DATE_RANGES;
124873
124901
  exports.DATE_TEXTS = DATE_TEXTS;
124902
+ exports.DEFAULT_WEBHOOKS_RESPONSE_TEXT = DEFAULT_WEBHOOKS_RESPONSE_TEXT;
124874
124903
  exports.DESCRIPTION_EDITOR_TEXTS = DESCRIPTION_EDITOR_TEXTS;
124875
124904
  exports.EMBED_SELECTORS = EMBED_SELECTORS;
124876
124905
  exports.EMOJI_LABEL = EMOJI_LABEL;