@bigbinary/neeto-playwright-commons 2.0.0 → 2.0.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.d.ts CHANGED
@@ -1594,10 +1594,14 @@ declare class MailerUtils {
1594
1594
  *
1595
1595
  * Generates a random Fastmail email based on the value of the FASTMAIL_DOMAIN_NAME environment variable.
1596
1596
  *
1597
- * Returns a random mixed-cased email ending with the FASTMAIL_DOMAIN_NAME.
1597
+ * shouldUseBypassEmail (optional): A boolean value indicating whether to generate a bypass email. Defaults to false.
1598
+ *
1599
+ * Returns a random mixed-cased email ending with the FASTMAIL_DOMAIN_NAME. If shouldUseBypassEmail is true, it returns a random email to bypass OTP verification and log into
1600
+ *
1601
+ * neeto products.
1598
1602
  *
1599
1603
  */
1600
- generateRandomEmail: () => string;
1604
+ generateRandomEmail: (shouldUseBypassEmail?: boolean) => string;
1601
1605
  /**
1602
1606
  *
1603
1607
  * This method is used to return the attachment based on the attachmentName of first email matching the search criteria. On top of the findMessage method, this method matches the attachment name with the attachments associated to the email. If any attachment matches then it will fetch the attachment details and return. If any attachment file name doesn't contain the substring attachmentName then it will throw an error saying No such attachment exists.
package/index.js CHANGED
@@ -9,7 +9,7 @@ import path__default from 'path';
9
9
  import test, { expect, test as test$1, chromium as chromium$1, defineConfig, devices } from '@playwright/test';
10
10
  import { getI18nInstance, initI18n } from 'playwright-i18next-fixture';
11
11
  import require$$0$4 from 'util';
12
- import { curry, isNotNil, not, isEmpty, pluck, mergeDeepLeft, isNil, mergeAll } from 'ramda';
12
+ import { curry, isNotNil, not, isEmpty, pluck, mergeAll, mergeDeepLeft, isNil } from 'ramda';
13
13
  import dayjs from 'dayjs';
14
14
  import require$$0$8 from 'stream';
15
15
  import require$$0$7 from 'node:buffer';
@@ -57635,6 +57635,36 @@ const hexToRGB = (hex) => {
57635
57635
  return `rgb(${Number(r)}, ${Number(g)}, ${Number(b)})`;
57636
57636
  };
57637
57637
 
57638
+ const fillCredentialsAndSubmit = async ({ page, loginPath, email = CREDENTIALS.email, }) => {
57639
+ loginPath && (await page.goto(loginPath, { timeout: 30_000 }));
57640
+ await page.waitForLoadState("load", { timeout: 35_000 });
57641
+ await expect(page.getByTestId(COMMON_SELECTORS.pageLoader)).toBeHidden({
57642
+ timeout: 30_000,
57643
+ });
57644
+ const emailInput = page.getByTestId(LOGIN_SELECTORS.emailTextField);
57645
+ await emailInput.waitFor({ state: "visible", timeout: 30_000 });
57646
+ await emailInput.fill(email);
57647
+ await page
57648
+ .getByTestId(LOGIN_SELECTORS.passwordTextField)
57649
+ .fill(CREDENTIALS.password);
57650
+ const submitButton = page.getByTestId(LOGIN_SELECTORS.submitButton);
57651
+ await submitButton.click();
57652
+ await expect(submitButton).toBeHidden({ timeout: 20_000 });
57653
+ await expect(page.getByTestId(COMMON_SELECTORS.floatingActionMenuButton)).toBeVisible({ timeout: 60_000 });
57654
+ };
57655
+ const loginWithoutSSO = async ({ page, loginPath = "/", email = CREDENTIALS.email, }) => {
57656
+ if (shouldSkipSetupAndTeardown())
57657
+ return;
57658
+ await fillCredentialsAndSubmit({ page, loginPath, email });
57659
+ const userCredentials = readFileSyncIfExists();
57660
+ await page.context().storageState({ path: STORAGE_STATE });
57661
+ const mergedCredentials = mergeAll([readFileSyncIfExists(), userCredentials]);
57662
+ writeDataToFile(JSON.stringify(mergedCredentials, null, 2));
57663
+ updateCredentials({ key: "isLoggedIn", value: "true" });
57664
+ };
57665
+ const login = async ({ page, loginPath, email }) => IS_DEV_ENV && (await loginWithoutSSO({ page, loginPath, email }));
57666
+ const generateRandomBypassEmail = () => `cpt${process.env.OTP_BYPASS_KEY}+${faker.number.int()}@bigbinary.com`;
57667
+
57638
57668
  class RailsEmailUtils {
57639
57669
  neetoPlaywrightUtilities;
57640
57670
  railsEmailRakeClient;
@@ -57950,7 +57980,9 @@ class MailerUtils {
57950
57980
  const { html: { codes }, } = await this.findMessage({ to: email, subject: subjectSubstring }, { timeout, receivedAfter, expectedEmailCount });
57951
57981
  return codes?.[0];
57952
57982
  };
57953
- generateRandomEmail = () => faker.internet.email({ provider: process.env.FASTMAIL_DOMAIN_NAME });
57983
+ generateRandomEmail = (shouldUseBypassEmail = false) => shouldUseBypassEmail
57984
+ ? generateRandomBypassEmail()
57985
+ : faker.internet.email({ provider: process.env.FASTMAIL_DOMAIN_NAME });
57954
57986
  getEmailAttachment = async (attachmentName, messageSearchCriteria = {}, { timeout = 10_000, receivedAfter = dateTimeOneHourAgo(), expectedEmailCount = 1, } = {}, shouldThrowErrorOnTimeout = true) => {
57955
57987
  if (IS_DEV_ENV) {
57956
57988
  return this.railsEmailUtils.getEmailAttachment(attachmentName, messageSearchCriteria, { receivedAfter, expectedEmailCount, timeout: timeout / 3 }, shouldThrowErrorOnTimeout);
@@ -117964,6 +117996,8 @@ class EditorPage {
117964
117996
  verifyFontSize = async () => {
117965
117997
  const fontsAndTexts = [];
117966
117998
  const fontSizeDropdownButton = this.page.getByTestId(NEETO_EDITOR_SELECTORS.neetoEditorFixedMenuFontSize);
117999
+ await this.contentField.focus();
118000
+ await this.contentField.press("Enter");
117967
118001
  await fontSizeDropdownButton.click();
117968
118002
  const headingButtons = await this.page
117969
118003
  .getByTestId(COMMON_SELECTORS.dropdownContainer)
@@ -118029,7 +118063,6 @@ class EditorPage {
118029
118063
  isButtonInMoreMenu && (await this.moreMenuSelector.click());
118030
118064
  await this.editorWrapper
118031
118065
  .getByTestId(NEETO_TEXT_MODIFIER_SELECTORS["highlight"])
118032
- .locator("svg")
118033
118066
  .click();
118034
118067
  await expect(this.page.getByTestId(COMMON_SELECTORS.customDropdownContainer())).toBeVisible({ timeout: 5_000 });
118035
118068
  }).toPass({ timeout: 30_000 });
@@ -118787,36 +118820,6 @@ class TeamMembers {
118787
118820
  };
118788
118821
  }
118789
118822
 
118790
- const fillCredentialsAndSubmit = async ({ page, loginPath, email = CREDENTIALS.email, }) => {
118791
- loginPath && (await page.goto(loginPath, { timeout: 30_000 }));
118792
- await page.waitForLoadState("load", { timeout: 35_000 });
118793
- await expect(page.getByTestId(COMMON_SELECTORS.pageLoader)).toBeHidden({
118794
- timeout: 30_000,
118795
- });
118796
- const emailInput = page.getByTestId(LOGIN_SELECTORS.emailTextField);
118797
- await emailInput.waitFor({ state: "visible", timeout: 30_000 });
118798
- await emailInput.fill(email);
118799
- await page
118800
- .getByTestId(LOGIN_SELECTORS.passwordTextField)
118801
- .fill(CREDENTIALS.password);
118802
- const submitButton = page.getByTestId(LOGIN_SELECTORS.submitButton);
118803
- await submitButton.click();
118804
- await expect(submitButton).toBeHidden({ timeout: 20_000 });
118805
- await expect(page.getByTestId(COMMON_SELECTORS.floatingActionMenuButton)).toBeVisible({ timeout: 60_000 });
118806
- };
118807
- const loginWithoutSSO = async ({ page, loginPath = "/", email = CREDENTIALS.email, }) => {
118808
- if (shouldSkipSetupAndTeardown())
118809
- return;
118810
- await fillCredentialsAndSubmit({ page, loginPath, email });
118811
- const userCredentials = readFileSyncIfExists();
118812
- await page.context().storageState({ path: STORAGE_STATE });
118813
- const mergedCredentials = mergeAll([readFileSyncIfExists(), userCredentials]);
118814
- writeDataToFile(JSON.stringify(mergedCredentials, null, 2));
118815
- updateCredentials({ key: "isLoggedIn", value: "true" });
118816
- };
118817
- const login = async ({ page, loginPath, email }) => IS_DEV_ENV && (await loginWithoutSSO({ page, loginPath, email }));
118818
- const generateRandomBypassEmail = () => `cpt${process.env.OTP_BYPASS_KEY}+${faker.number.int()}@bigbinary.com`;
118819
-
118820
118823
  const extractSubdomainFromError = (errorString) => {
118821
118824
  const regex = /cpt[a-zA-Z0-9-]+/g;
118822
118825
  const matches = errorString.match(regex);