@bigbinary/neeto-playwright-commons 2.1.0 → 2.1.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
@@ -8680,8 +8680,8 @@ class OrganizationPage {
8680
8680
  await codeInput.fill(totpToken);
8681
8681
  test.expect(totp.validate({ token: totpToken })).not.toBeNull();
8682
8682
  await Promise.all([
8683
- test.expect(codeInput).toBeHidden(),
8684
- test.expect(this.page.getByTestId(LOGIN_SELECTORS.enterOtpInputError)).toBeHidden(),
8683
+ test.expect(codeInput).toBeHidden({ timeout: 10_000 }),
8684
+ test.expect(this.page.getByTestId(LOGIN_SELECTORS.enterOtpInputError)).toBeHidden({ timeout: 10_000 }),
8685
8685
  ]);
8686
8686
  }).toPass({ timeout: 2 * 60 * 1000 });
8687
8687
  };
@@ -8841,22 +8841,25 @@ class Health {
8841
8841
  constructor(page, neetoPlaywrightUtilities) {
8842
8842
  this.page = page;
8843
8843
  this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
8844
- if (!process.env.PLAYWRIGHT_PRODUCTION_EMAIL) {
8845
- throw new Error("PLAYWRIGHT_PRODUCTION_EMAIL is not set");
8844
+ if (!process.env.PLAYWRIGHT_PRODUCTION_EMAIL ||
8845
+ !process.env.PLAYWRIGHT_PRODUCTION_2FA_SECRET_KEY) {
8846
+ throw new Error("One or more required env variables are missing: PLAYWRIGHT_PRODUCTION_EMAIL, PLAYWRIGHT_PRODUCTION_2FA_SECRET_KEY");
8846
8847
  }
8847
8848
  this.loginPage = new OrganizationPage(page, neetoPlaywrightUtilities);
8848
8849
  }
8850
+ loginToApp = async (route = ROUTES.adminPanel.index) => {
8851
+ await this.page.goto(route);
8852
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
8853
+ await this.loginPage.loginViaAuthenticatorApp(this.email);
8854
+ };
8855
+ verifyAppUI = async () => {
8856
+ await this.neetoPlaywrightUtilities.waitForFloatingMenu();
8857
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
8858
+ await Promise.all([COMMON_SELECTORS.neetoLogo, COMMON_SELECTORS.heading].map(selector => test.expect(this.page.getByTestId(selector)).toBeVisible()));
8859
+ };
8849
8860
  verifyAppIsLive = async (customSteps) => {
8850
- await test.step("1: Login to the application", async () => {
8851
- await this.page.goto(ROUTES.adminPanel.index);
8852
- await this.neetoPlaywrightUtilities.waitForPageLoad();
8853
- await this.loginPage.loginViaAuthenticatorApp(this.email);
8854
- });
8855
- await test.step("2: Verify application is live", async () => {
8856
- await this.neetoPlaywrightUtilities.waitForFloatingMenu();
8857
- await this.neetoPlaywrightUtilities.waitForPageLoad();
8858
- await Promise.all([COMMON_SELECTORS.neetoLogo, COMMON_SELECTORS.heading].map(selector => test.expect(this.page.getByTestId(selector)).toBeVisible()));
8859
- });
8861
+ await test.step("1: Login to the application", () => this.loginToApp());
8862
+ await test.step("2: Verify application UI", this.verifyAppUI);
8860
8863
  await customSteps?.();
8861
8864
  };
8862
8865
  }
@@ -125313,19 +125316,13 @@ var mainExports = requireMain();
125313
125316
  var dotenvExpand = /*@__PURE__*/getDefaultExportFromCjs(mainExports);
125314
125317
 
125315
125318
  // @ts-check
125319
+ const loadEnv = (path) => dotenvExpand.expand(dotenv.config({ path, quiet: true }));
125320
+ const envBasePath = "./e2e/config/.env";
125321
+ const envLocalPath = `${envBasePath}.local`;
125322
+ const reporterPackageName = "@bigbinary/neeto-playwright-reporter";
125316
125323
  process.env.TEST_ENV = process.env.TEST_ENV ?? ENVIRONMENT.development;
125317
- const env = dotenv.config({
125318
- path: `./e2e/config/.env.${process.env.TEST_ENV}`,
125319
- quiet: true,
125320
- });
125321
- dotenvExpand.expand(env);
125322
- if (require$$0__namespace.existsSync("./e2e/config/.env.local")) {
125323
- const localEnv = dotenv.config({
125324
- path: "./e2e/config/.env.local",
125325
- quiet: true,
125326
- });
125327
- dotenvExpand.expand(localEnv);
125328
- }
125324
+ loadEnv(`${envBasePath}.${process.env.TEST_ENV}`);
125325
+ require$$0__namespace.existsSync(envLocalPath) && loadEnv(envLocalPath);
125329
125326
  const playdashStagingConfig = {
125330
125327
  apiKey: process.env.PLAYDASH_STAGING_API_KEY,
125331
125328
  ciBuildId: process.env.NEETO_CI_JOB_ID,
@@ -125342,6 +125339,11 @@ const playdashLighthouseConfig = {
125342
125339
  ciBuildId: process.env.NEETO_CI_JOB_ID,
125343
125340
  tags: process.env.TAG,
125344
125341
  };
125342
+ const playdashProductionHealthConfig = {
125343
+ apiKey: process.env.PLAYDASH_PRODUCTION_HEALTH_API_KEY,
125344
+ ciBuildId: process.env.NEETO_CI_JOB_ID,
125345
+ tags: process.env.TAG,
125346
+ };
125345
125347
  const isCI = neetoCist.isPresent(process.env.NEETO_CI_JOB_ID);
125346
125348
  const railsPort = process.env.RAILS_SERVER_PORT;
125347
125349
  const vitePort = process.env.VITE_PORT;
@@ -125351,9 +125353,10 @@ const PROJECT_NAMES = {
125351
125353
  webkit: "webkit",
125352
125354
  lighthouseAudits: "lighthouse-audits",
125353
125355
  cleanupCredentials: "cleanup credentials",
125356
+ productionHealth: "production-health",
125354
125357
  };
125355
125358
  const definePlaywrightConfig = (overrides) => {
125356
- const { globalOverrides = {}, useOverrides = {}, useCustomProjects = false, projectOverrides = [], playdashStagingOverrides = {}, playdashProductionOverrides = {}, playdashLighthouseOverrides = {}, webServerOverrides = [], projectLaunchOptionsOverrides = {}, } = overrides;
125359
+ const { globalOverrides = {}, useOverrides = {}, useCustomProjects = false, projectOverrides = [], playdashProductionHealthOverrides = {}, playdashStagingOverrides = {}, playdashProductionOverrides = {}, playdashLighthouseOverrides = {}, webServerOverrides = [], projectLaunchOptionsOverrides = {}, } = overrides;
125357
125360
  const getProjectLaunchOptions = (projectName, defaultLaunchOptions) => {
125358
125361
  const overrides = projectLaunchOptionsOverrides[projectName];
125359
125362
  if (!overrides)
@@ -125372,29 +125375,31 @@ const definePlaywrightConfig = (overrides) => {
125372
125375
  let reporter = !ramda.isEmpty(playdashStagingOverrides)
125373
125376
  ? [
125374
125377
  [
125375
- "@bigbinary/neeto-playwright-reporter",
125376
- {
125377
- ...playdashStagingConfig,
125378
- ...playdashStagingOverrides,
125379
- },
125378
+ reporterPackageName,
125379
+ { ...playdashStagingConfig, ...playdashStagingOverrides },
125380
125380
  ],
125381
125381
  ]
125382
125382
  : [
125383
125383
  [
125384
- "@bigbinary/neeto-playwright-reporter",
125385
- {
125386
- ...playdashProductionConfig,
125387
- ...playdashProductionOverrides,
125388
- },
125384
+ reporterPackageName,
125385
+ { ...playdashProductionConfig, ...playdashProductionOverrides },
125389
125386
  ],
125390
125387
  ];
125391
125388
  if (process.env.IS_LIGHTHOUSE_REPORT) {
125392
125389
  reporter = [
125393
125390
  [
125394
- "@bigbinary/neeto-playwright-reporter",
125391
+ reporterPackageName,
125392
+ { ...playdashLighthouseConfig, ...playdashLighthouseOverrides },
125393
+ ],
125394
+ ];
125395
+ }
125396
+ if (process.env.TAG?.includes("production")) {
125397
+ reporter = [
125398
+ [
125399
+ reporterPackageName,
125395
125400
  {
125396
- ...playdashLighthouseConfig,
125397
- ...playdashLighthouseOverrides,
125401
+ ...playdashProductionHealthConfig,
125402
+ ...playdashProductionHealthOverrides,
125398
125403
  },
125399
125404
  ],
125400
125405
  ];
@@ -125497,13 +125502,14 @@ const definePlaywrightConfig = (overrides) => {
125497
125502
  }),
125498
125503
  },
125499
125504
  {
125500
- name: "production-health",
125505
+ name: PROJECT_NAMES.productionHealth,
125501
125506
  testDir: "./e2e/health",
125502
125507
  testMatch: "production.health.ts",
125503
125508
  use: {
125504
125509
  ...test.devices["Desktop Chrome"],
125505
125510
  baseURL: process.env.PLAYWRIGHT_PRODUCTION_BASE_URL,
125506
- storageState: { cookies: [], origins: [] },
125511
+ screenshot: "on",
125512
+ trace: "on",
125507
125513
  },
125508
125514
  },
125509
125515
  ...projectOverrides,