@bigbinary/neeto-playwright-commons 2.1.0 → 2.1.2

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