@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.cjs.js CHANGED
@@ -57655,6 +57655,36 @@ const hexToRGB = (hex) => {
57655
57655
  return `rgb(${Number(r)}, ${Number(g)}, ${Number(b)})`;
57656
57656
  };
57657
57657
 
57658
+ const fillCredentialsAndSubmit = async ({ page, loginPath, email = CREDENTIALS.email, }) => {
57659
+ loginPath && (await page.goto(loginPath, { timeout: 30_000 }));
57660
+ await page.waitForLoadState("load", { timeout: 35_000 });
57661
+ await test.expect(page.getByTestId(COMMON_SELECTORS.pageLoader)).toBeHidden({
57662
+ timeout: 30_000,
57663
+ });
57664
+ const emailInput = page.getByTestId(LOGIN_SELECTORS.emailTextField);
57665
+ await emailInput.waitFor({ state: "visible", timeout: 30_000 });
57666
+ await emailInput.fill(email);
57667
+ await page
57668
+ .getByTestId(LOGIN_SELECTORS.passwordTextField)
57669
+ .fill(CREDENTIALS.password);
57670
+ const submitButton = page.getByTestId(LOGIN_SELECTORS.submitButton);
57671
+ await submitButton.click();
57672
+ await test.expect(submitButton).toBeHidden({ timeout: 20_000 });
57673
+ await test.expect(page.getByTestId(COMMON_SELECTORS.floatingActionMenuButton)).toBeVisible({ timeout: 60_000 });
57674
+ };
57675
+ const loginWithoutSSO = async ({ page, loginPath = "/", email = CREDENTIALS.email, }) => {
57676
+ if (shouldSkipSetupAndTeardown())
57677
+ return;
57678
+ await fillCredentialsAndSubmit({ page, loginPath, email });
57679
+ const userCredentials = readFileSyncIfExists();
57680
+ await page.context().storageState({ path: STORAGE_STATE });
57681
+ const mergedCredentials = ramda.mergeAll([readFileSyncIfExists(), userCredentials]);
57682
+ writeDataToFile(JSON.stringify(mergedCredentials, null, 2));
57683
+ updateCredentials({ key: "isLoggedIn", value: "true" });
57684
+ };
57685
+ const login = async ({ page, loginPath, email }) => IS_DEV_ENV && (await loginWithoutSSO({ page, loginPath, email }));
57686
+ const generateRandomBypassEmail = () => `cpt${process.env.OTP_BYPASS_KEY}+${faker.faker.number.int()}@bigbinary.com`;
57687
+
57658
57688
  class RailsEmailUtils {
57659
57689
  neetoPlaywrightUtilities;
57660
57690
  railsEmailRakeClient;
@@ -57970,7 +58000,9 @@ class MailerUtils {
57970
58000
  const { html: { codes }, } = await this.findMessage({ to: email, subject: subjectSubstring }, { timeout, receivedAfter, expectedEmailCount });
57971
58001
  return codes?.[0];
57972
58002
  };
57973
- generateRandomEmail = () => faker.faker.internet.email({ provider: process.env.FASTMAIL_DOMAIN_NAME });
58003
+ generateRandomEmail = (shouldUseBypassEmail = false) => shouldUseBypassEmail
58004
+ ? generateRandomBypassEmail()
58005
+ : faker.faker.internet.email({ provider: process.env.FASTMAIL_DOMAIN_NAME });
57974
58006
  getEmailAttachment = async (attachmentName, messageSearchCriteria = {}, { timeout = 10_000, receivedAfter = dateTimeOneHourAgo(), expectedEmailCount = 1, } = {}, shouldThrowErrorOnTimeout = true) => {
57975
58007
  if (IS_DEV_ENV) {
57976
58008
  return this.railsEmailUtils.getEmailAttachment(attachmentName, messageSearchCriteria, { receivedAfter, expectedEmailCount, timeout: timeout / 3 }, shouldThrowErrorOnTimeout);
@@ -117984,6 +118016,8 @@ class EditorPage {
117984
118016
  verifyFontSize = async () => {
117985
118017
  const fontsAndTexts = [];
117986
118018
  const fontSizeDropdownButton = this.page.getByTestId(NEETO_EDITOR_SELECTORS.neetoEditorFixedMenuFontSize);
118019
+ await this.contentField.focus();
118020
+ await this.contentField.press("Enter");
117987
118021
  await fontSizeDropdownButton.click();
117988
118022
  const headingButtons = await this.page
117989
118023
  .getByTestId(COMMON_SELECTORS.dropdownContainer)
@@ -118049,7 +118083,6 @@ class EditorPage {
118049
118083
  isButtonInMoreMenu && (await this.moreMenuSelector.click());
118050
118084
  await this.editorWrapper
118051
118085
  .getByTestId(NEETO_TEXT_MODIFIER_SELECTORS["highlight"])
118052
- .locator("svg")
118053
118086
  .click();
118054
118087
  await test.expect(this.page.getByTestId(COMMON_SELECTORS.customDropdownContainer())).toBeVisible({ timeout: 5_000 });
118055
118088
  }).toPass({ timeout: 30_000 });
@@ -118807,36 +118840,6 @@ class TeamMembers {
118807
118840
  };
118808
118841
  }
118809
118842
 
118810
- const fillCredentialsAndSubmit = async ({ page, loginPath, email = CREDENTIALS.email, }) => {
118811
- loginPath && (await page.goto(loginPath, { timeout: 30_000 }));
118812
- await page.waitForLoadState("load", { timeout: 35_000 });
118813
- await test.expect(page.getByTestId(COMMON_SELECTORS.pageLoader)).toBeHidden({
118814
- timeout: 30_000,
118815
- });
118816
- const emailInput = page.getByTestId(LOGIN_SELECTORS.emailTextField);
118817
- await emailInput.waitFor({ state: "visible", timeout: 30_000 });
118818
- await emailInput.fill(email);
118819
- await page
118820
- .getByTestId(LOGIN_SELECTORS.passwordTextField)
118821
- .fill(CREDENTIALS.password);
118822
- const submitButton = page.getByTestId(LOGIN_SELECTORS.submitButton);
118823
- await submitButton.click();
118824
- await test.expect(submitButton).toBeHidden({ timeout: 20_000 });
118825
- await test.expect(page.getByTestId(COMMON_SELECTORS.floatingActionMenuButton)).toBeVisible({ timeout: 60_000 });
118826
- };
118827
- const loginWithoutSSO = async ({ page, loginPath = "/", email = CREDENTIALS.email, }) => {
118828
- if (shouldSkipSetupAndTeardown())
118829
- return;
118830
- await fillCredentialsAndSubmit({ page, loginPath, email });
118831
- const userCredentials = readFileSyncIfExists();
118832
- await page.context().storageState({ path: STORAGE_STATE });
118833
- const mergedCredentials = ramda.mergeAll([readFileSyncIfExists(), userCredentials]);
118834
- writeDataToFile(JSON.stringify(mergedCredentials, null, 2));
118835
- updateCredentials({ key: "isLoggedIn", value: "true" });
118836
- };
118837
- const login = async ({ page, loginPath, email }) => IS_DEV_ENV && (await loginWithoutSSO({ page, loginPath, email }));
118838
- const generateRandomBypassEmail = () => `cpt${process.env.OTP_BYPASS_KEY}+${faker.faker.number.int()}@bigbinary.com`;
118839
-
118840
118843
  const extractSubdomainFromError = (errorString) => {
118841
118844
  const regex = /cpt[a-zA-Z0-9-]+/g;
118842
118845
  const matches = errorString.match(regex);