@bigbinary/neeto-playwright-commons 2.2.1 → 2.2.3

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
@@ -5433,6 +5433,7 @@ const LOGIN_SELECTORS = {
5433
5433
  twitterAuthenticationButton: "twitter-authentication-button",
5434
5434
  authenticatorAppOtpInput: "authenticator-app-otp-login-code-input",
5435
5435
  enterOtpInputError: "enter-otp-input-error",
5436
+ authenticatorAppLaterButton: "authenticator-app-promo-later-button",
5436
5437
  };
5437
5438
 
5438
5439
  const MEMBER_SELECTORS = {
@@ -8561,6 +8562,10 @@ class OrganizationPage {
8561
8562
  await submitButton.click();
8562
8563
  await test.expect(submitButton).toBeHidden({ timeout: 35_000 });
8563
8564
  };
8565
+ dismissAuthenticatorSetupPromptIfPresent = async () => {
8566
+ const maybeLaterButton = this.page.getByTestId(LOGIN_SELECTORS.authenticatorAppLaterButton);
8567
+ (await maybeLaterButton.isVisible()) && (await maybeLaterButton.click());
8568
+ };
8564
8569
  createOrganization = async ({ email, businessName, subdomainName, firstName, lastName, appName, }) => {
8565
8570
  if (shouldSkipSetupAndTeardown())
8566
8571
  return;
@@ -8704,11 +8709,13 @@ class OrganizationPage {
8704
8709
  }
8705
8710
  await this.fillEmailAndSubmit(email, loginTimeout);
8706
8711
  await this.fillOTP();
8712
+ await this.dismissAuthenticatorSetupPromptIfPresent();
8707
8713
  };
8708
8714
  loginWithFastmailEmail = async ({ email, loginTimeout = 2 * 60 * 1000, fetchOtpFromEmail, }) => {
8709
8715
  await this.fillEmailAndSubmit(email, loginTimeout);
8710
8716
  const otp = await fetchOtpFromEmail({ email, timeout: 4 * 60 * 1000 });
8711
8717
  await this.fillOTP(otp);
8718
+ await this.dismissAuthenticatorSetupPromptIfPresent();
8712
8719
  };
8713
8720
  setupProfile = async ({ firstName = faker.faker.person.firstName(), lastName = faker.faker.person.lastName(), country, } = {}) => {
8714
8721
  if (IS_DEV_ENV)
@@ -125712,6 +125719,66 @@ function requireMain () {
125712
125719
  var mainExports = requireMain();
125713
125720
  var dotenvExpand = /*@__PURE__*/getDefaultExportFromCjs(mainExports);
125714
125721
 
125722
+ const E2E_TEST_DIR = "e2e/tests";
125723
+ const LOG_PREFIX = "[playwright.config]";
125724
+ const logInfo = (message) => process.stdout.write(`${LOG_PREFIX} ${message}\n`);
125725
+ const logError = (message) => process.stderr.write(`${LOG_PREFIX} ${message}\n`);
125726
+ /**
125727
+ * Patterns are often anchored for paths under `e2e/tests`, but Playwright
125728
+ * matches `testMatch` against absolute paths — so we also allow the same
125729
+ * pattern after any path ending in `/e2e/tests/`.
125730
+ */
125731
+ const normalizeSpecPattern = (pattern) => {
125732
+ if (!pattern.startsWith("^") || pattern.includes(E2E_TEST_DIR)) {
125733
+ return pattern;
125734
+ }
125735
+ return `(?:${pattern}|^.*\\/${E2E_TEST_DIR}\\/${pattern.slice(1)})`;
125736
+ };
125737
+ const compilePatterns = (patternStrings) => patternStrings.flatMap((pattern, index) => {
125738
+ const normalized = normalizeSpecPattern(pattern);
125739
+ try {
125740
+ return [new RegExp(normalized)];
125741
+ }
125742
+ catch (error) {
125743
+ logError(`Failed to compile spec pattern at index ${index}: ${pattern}. Normalized pattern: ${normalized}. ${error}`);
125744
+ return [];
125745
+ }
125746
+ });
125747
+ const parseSpecPatterns = () => {
125748
+ let parsed;
125749
+ const raw = process.env.PLAYWRIGHT_SPEC_PATTERNS_JSON?.trim();
125750
+ if (!raw) {
125751
+ logInfo("PLAYWRIGHT_SPEC_PATTERNS_JSON missing; using default test discovery.");
125752
+ return undefined;
125753
+ }
125754
+ logInfo(`PLAYWRIGHT_SPEC_PATTERNS_JSON received: ${raw}`);
125755
+ try {
125756
+ parsed = JSON.parse(raw);
125757
+ }
125758
+ catch (error) {
125759
+ logError(`Failed to parse PLAYWRIGHT_SPEC_PATTERNS_JSON; using default test discovery. ${error}`);
125760
+ return undefined;
125761
+ }
125762
+ if (!Array.isArray(parsed) || parsed.length === 0) {
125763
+ logError("Parsed spec patterns are empty or non-array; using default test discovery.");
125764
+ return undefined;
125765
+ }
125766
+ const patternStrings = parsed.filter((p) => typeof p === "string");
125767
+ if (patternStrings.length !== parsed.length) {
125768
+ logError(`Parsed spec patterns contain non-strings (${parsed.length - patternStrings.length}); using default test discovery.`);
125769
+ return undefined;
125770
+ }
125771
+ const compiledPatterns = compilePatterns(patternStrings);
125772
+ if (compiledPatterns.length === 0) {
125773
+ logError("No valid regex patterns compiled; using default test discovery.");
125774
+ return undefined;
125775
+ }
125776
+ logInfo(`Compiled spec regex patterns: ${compiledPatterns
125777
+ .map(pattern => pattern.toString())
125778
+ .join(", ")}`);
125779
+ return compiledPatterns;
125780
+ };
125781
+
125715
125782
  // @ts-check
125716
125783
  const loadEnv = (path) => dotenvExpand.expand(dotenv.config({ path, quiet: true }));
125717
125784
  const envBasePath = "./e2e/config/.env";
@@ -125801,6 +125868,7 @@ const definePlaywrightConfig = (overrides) => {
125801
125868
  ],
125802
125869
  ];
125803
125870
  }
125871
+ const specPatterns = parseSpecPatterns();
125804
125872
  return test.defineConfig({
125805
125873
  testDir: "./e2e/tests",
125806
125874
  fullyParallel: true,
@@ -125809,6 +125877,7 @@ const definePlaywrightConfig = (overrides) => {
125809
125877
  timeout: 5 * 60 * 1000,
125810
125878
  workers: isCI ? 6 : 5,
125811
125879
  reporter: isCI ? reporter : [["line"]],
125880
+ ...(specPatterns && { testMatch: specPatterns }),
125812
125881
  ...(IS_DEV_ENV && {
125813
125882
  webServer: [
125814
125883
  {