@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 +48 -42
- package/index.cjs.js.map +1 -1
- package/index.d.ts +40 -11
- package/index.js +48 -42
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1041,15 +1041,41 @@ declare class Health {
|
|
|
1041
1041
|
constructor(page: Page, neetoPlaywrightUtilities: CustomCommands);
|
|
1042
1042
|
/**
|
|
1043
1043
|
*
|
|
1044
|
-
*
|
|
1044
|
+
* Navigates to the given route (default: /admin/admin-panel), waits for the page to
|
|
1045
1045
|
*
|
|
1046
|
-
*
|
|
1046
|
+
* load, then logs in via the authenticator app using the production email from the
|
|
1047
1047
|
*
|
|
1048
|
-
*
|
|
1048
|
+
* environment.
|
|
1049
1049
|
*
|
|
1050
|
-
*
|
|
1050
|
+
* route (optional): Path to open. Defaults to ROUTES.adminPanel.index.
|
|
1051
1051
|
*
|
|
1052
|
-
*
|
|
1052
|
+
* @example
|
|
1053
|
+
*
|
|
1054
|
+
* await health.loginToApp(ROUTES.dashboard);
|
|
1055
|
+
* @endexample
|
|
1056
|
+
*/
|
|
1057
|
+
loginToApp: (route?: string) => Promise<void>;
|
|
1058
|
+
/**
|
|
1059
|
+
*
|
|
1060
|
+
* Waits for the floating menu and page load, then asserts that the Neeto logo and
|
|
1061
|
+
*
|
|
1062
|
+
* main heading test IDs are visible.
|
|
1063
|
+
*
|
|
1064
|
+
* @example
|
|
1065
|
+
*
|
|
1066
|
+
* await health.verifyAppUI();
|
|
1067
|
+
* @endexample
|
|
1068
|
+
*/
|
|
1069
|
+
verifyAppUI: () => Promise<void>;
|
|
1070
|
+
/**
|
|
1071
|
+
*
|
|
1072
|
+
* Performs login, waits until the main application UI (floating menu, logo, and
|
|
1073
|
+
*
|
|
1074
|
+
* heading) is present, and then executes your custom verification steps.
|
|
1075
|
+
*
|
|
1076
|
+
* customSteps (optional): An async function (no arguments) that runs after login
|
|
1077
|
+
*
|
|
1078
|
+
* and common verification. Use it to perform additional assertions or navigation.
|
|
1053
1079
|
*
|
|
1054
1080
|
* @example
|
|
1055
1081
|
*
|
|
@@ -8704,23 +8730,26 @@ declare const PROJECT_NAMES: {
|
|
|
8704
8730
|
readonly webkit: "webkit";
|
|
8705
8731
|
readonly lighthouseAudits: "lighthouse-audits";
|
|
8706
8732
|
readonly cleanupCredentials: "cleanup credentials";
|
|
8733
|
+
readonly productionHealth: "production-health";
|
|
8707
8734
|
};
|
|
8708
8735
|
type ProjectName = ValueOf<typeof PROJECT_NAMES>;
|
|
8709
8736
|
interface PlaydashOverrides {
|
|
8710
8737
|
projectKey: string;
|
|
8711
8738
|
}
|
|
8712
8739
|
type WebServerConfig = Exclude<NonNullable<PlaywrightTestConfig["webServer"]>, readonly unknown[]>;
|
|
8740
|
+
type UnknownRecord = Record<string, unknown>;
|
|
8713
8741
|
interface ProjectLaunchOptionsConfig extends LaunchOptions {
|
|
8714
8742
|
mergeArgs?: boolean;
|
|
8715
8743
|
}
|
|
8716
8744
|
interface Overrides {
|
|
8717
|
-
globalOverrides?:
|
|
8718
|
-
useOverrides?:
|
|
8745
|
+
globalOverrides?: UnknownRecord;
|
|
8746
|
+
useOverrides?: UnknownRecord;
|
|
8719
8747
|
useCustomProjects?: boolean;
|
|
8720
|
-
projectOverrides?:
|
|
8721
|
-
playdashStagingOverrides?: PlaydashOverrides &
|
|
8722
|
-
playdashProductionOverrides?: PlaydashOverrides &
|
|
8723
|
-
playdashLighthouseOverrides?: PlaydashOverrides &
|
|
8748
|
+
projectOverrides?: UnknownRecord[];
|
|
8749
|
+
playdashStagingOverrides?: PlaydashOverrides & UnknownRecord;
|
|
8750
|
+
playdashProductionOverrides?: PlaydashOverrides & UnknownRecord;
|
|
8751
|
+
playdashLighthouseOverrides?: PlaydashOverrides & UnknownRecord;
|
|
8752
|
+
playdashProductionHealthOverrides?: PlaydashOverrides & UnknownRecord;
|
|
8724
8753
|
webServerOverrides?: WebServerConfig[];
|
|
8725
8754
|
projectLaunchOptionsOverrides?: Partial<Record<ProjectName, ProjectLaunchOptionsConfig>>;
|
|
8726
8755
|
}
|
package/index.js
CHANGED
|
@@ -8660,8 +8660,8 @@ class OrganizationPage {
|
|
|
8660
8660
|
await codeInput.fill(totpToken);
|
|
8661
8661
|
expect(totp.validate({ token: totpToken })).not.toBeNull();
|
|
8662
8662
|
await Promise.all([
|
|
8663
|
-
expect(codeInput).toBeHidden(),
|
|
8664
|
-
expect(this.page.getByTestId(LOGIN_SELECTORS.enterOtpInputError)).toBeHidden(),
|
|
8663
|
+
expect(codeInput).toBeHidden({ timeout: 10_000 }),
|
|
8664
|
+
expect(this.page.getByTestId(LOGIN_SELECTORS.enterOtpInputError)).toBeHidden({ timeout: 10_000 }),
|
|
8665
8665
|
]);
|
|
8666
8666
|
}).toPass({ timeout: 2 * 60 * 1000 });
|
|
8667
8667
|
};
|
|
@@ -8821,22 +8821,25 @@ class Health {
|
|
|
8821
8821
|
constructor(page, neetoPlaywrightUtilities) {
|
|
8822
8822
|
this.page = page;
|
|
8823
8823
|
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
8824
|
-
if (!process.env.PLAYWRIGHT_PRODUCTION_EMAIL
|
|
8825
|
-
|
|
8824
|
+
if (!process.env.PLAYWRIGHT_PRODUCTION_EMAIL ||
|
|
8825
|
+
!process.env.PLAYWRIGHT_PRODUCTION_2FA_SECRET_KEY) {
|
|
8826
|
+
throw new Error("One or more required env variables are missing: PLAYWRIGHT_PRODUCTION_EMAIL, PLAYWRIGHT_PRODUCTION_2FA_SECRET_KEY");
|
|
8826
8827
|
}
|
|
8827
8828
|
this.loginPage = new OrganizationPage(page, neetoPlaywrightUtilities);
|
|
8828
8829
|
}
|
|
8830
|
+
loginToApp = async (route = ROUTES.adminPanel.index) => {
|
|
8831
|
+
await this.page.goto(route);
|
|
8832
|
+
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
8833
|
+
await this.loginPage.loginViaAuthenticatorApp(this.email);
|
|
8834
|
+
};
|
|
8835
|
+
verifyAppUI = async () => {
|
|
8836
|
+
await this.neetoPlaywrightUtilities.waitForFloatingMenu();
|
|
8837
|
+
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
8838
|
+
await Promise.all([COMMON_SELECTORS.neetoLogo, COMMON_SELECTORS.heading].map(selector => expect(this.page.getByTestId(selector)).toBeVisible()));
|
|
8839
|
+
};
|
|
8829
8840
|
verifyAppIsLive = async (customSteps) => {
|
|
8830
|
-
await test.step("1: Login to the application",
|
|
8831
|
-
|
|
8832
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
8833
|
-
await this.loginPage.loginViaAuthenticatorApp(this.email);
|
|
8834
|
-
});
|
|
8835
|
-
await test.step("2: Verify application is live", async () => {
|
|
8836
|
-
await this.neetoPlaywrightUtilities.waitForFloatingMenu();
|
|
8837
|
-
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
8838
|
-
await Promise.all([COMMON_SELECTORS.neetoLogo, COMMON_SELECTORS.heading].map(selector => expect(this.page.getByTestId(selector)).toBeVisible()));
|
|
8839
|
-
});
|
|
8841
|
+
await test.step("1: Login to the application", () => this.loginToApp());
|
|
8842
|
+
await test.step("2: Verify application UI", this.verifyAppUI);
|
|
8840
8843
|
await customSteps?.();
|
|
8841
8844
|
};
|
|
8842
8845
|
}
|
|
@@ -125293,19 +125296,13 @@ var mainExports = requireMain();
|
|
|
125293
125296
|
var dotenvExpand = /*@__PURE__*/getDefaultExportFromCjs(mainExports);
|
|
125294
125297
|
|
|
125295
125298
|
// @ts-check
|
|
125299
|
+
const loadEnv = (path) => dotenvExpand.expand(dotenv.config({ path, quiet: true }));
|
|
125300
|
+
const envBasePath = "./e2e/config/.env";
|
|
125301
|
+
const envLocalPath = `${envBasePath}.local`;
|
|
125302
|
+
const reporterPackageName = "@bigbinary/neeto-playwright-reporter";
|
|
125296
125303
|
process.env.TEST_ENV = process.env.TEST_ENV ?? ENVIRONMENT.development;
|
|
125297
|
-
|
|
125298
|
-
|
|
125299
|
-
quiet: true,
|
|
125300
|
-
});
|
|
125301
|
-
dotenvExpand.expand(env);
|
|
125302
|
-
if (require$$0$3.existsSync("./e2e/config/.env.local")) {
|
|
125303
|
-
const localEnv = dotenv.config({
|
|
125304
|
-
path: "./e2e/config/.env.local",
|
|
125305
|
-
quiet: true,
|
|
125306
|
-
});
|
|
125307
|
-
dotenvExpand.expand(localEnv);
|
|
125308
|
-
}
|
|
125304
|
+
loadEnv(`${envBasePath}.${process.env.TEST_ENV}`);
|
|
125305
|
+
require$$0$3.existsSync(envLocalPath) && loadEnv(envLocalPath);
|
|
125309
125306
|
const playdashStagingConfig = {
|
|
125310
125307
|
apiKey: process.env.PLAYDASH_STAGING_API_KEY,
|
|
125311
125308
|
ciBuildId: process.env.NEETO_CI_JOB_ID,
|
|
@@ -125322,6 +125319,11 @@ const playdashLighthouseConfig = {
|
|
|
125322
125319
|
ciBuildId: process.env.NEETO_CI_JOB_ID,
|
|
125323
125320
|
tags: process.env.TAG,
|
|
125324
125321
|
};
|
|
125322
|
+
const playdashProductionHealthConfig = {
|
|
125323
|
+
apiKey: process.env.PLAYDASH_PRODUCTION_HEALTH_API_KEY,
|
|
125324
|
+
ciBuildId: process.env.NEETO_CI_JOB_ID,
|
|
125325
|
+
tags: process.env.TAG,
|
|
125326
|
+
};
|
|
125325
125327
|
const isCI = isPresent(process.env.NEETO_CI_JOB_ID);
|
|
125326
125328
|
const railsPort = process.env.RAILS_SERVER_PORT;
|
|
125327
125329
|
const vitePort = process.env.VITE_PORT;
|
|
@@ -125331,9 +125333,10 @@ const PROJECT_NAMES = {
|
|
|
125331
125333
|
webkit: "webkit",
|
|
125332
125334
|
lighthouseAudits: "lighthouse-audits",
|
|
125333
125335
|
cleanupCredentials: "cleanup credentials",
|
|
125336
|
+
productionHealth: "production-health",
|
|
125334
125337
|
};
|
|
125335
125338
|
const definePlaywrightConfig = (overrides) => {
|
|
125336
|
-
const { globalOverrides = {}, useOverrides = {}, useCustomProjects = false, projectOverrides = [], playdashStagingOverrides = {}, playdashProductionOverrides = {}, playdashLighthouseOverrides = {}, webServerOverrides = [], projectLaunchOptionsOverrides = {}, } = overrides;
|
|
125339
|
+
const { globalOverrides = {}, useOverrides = {}, useCustomProjects = false, projectOverrides = [], playdashProductionHealthOverrides = {}, playdashStagingOverrides = {}, playdashProductionOverrides = {}, playdashLighthouseOverrides = {}, webServerOverrides = [], projectLaunchOptionsOverrides = {}, } = overrides;
|
|
125337
125340
|
const getProjectLaunchOptions = (projectName, defaultLaunchOptions) => {
|
|
125338
125341
|
const overrides = projectLaunchOptionsOverrides[projectName];
|
|
125339
125342
|
if (!overrides)
|
|
@@ -125352,29 +125355,31 @@ const definePlaywrightConfig = (overrides) => {
|
|
|
125352
125355
|
let reporter = !isEmpty(playdashStagingOverrides)
|
|
125353
125356
|
? [
|
|
125354
125357
|
[
|
|
125355
|
-
|
|
125356
|
-
{
|
|
125357
|
-
...playdashStagingConfig,
|
|
125358
|
-
...playdashStagingOverrides,
|
|
125359
|
-
},
|
|
125358
|
+
reporterPackageName,
|
|
125359
|
+
{ ...playdashStagingConfig, ...playdashStagingOverrides },
|
|
125360
125360
|
],
|
|
125361
125361
|
]
|
|
125362
125362
|
: [
|
|
125363
125363
|
[
|
|
125364
|
-
|
|
125365
|
-
{
|
|
125366
|
-
...playdashProductionConfig,
|
|
125367
|
-
...playdashProductionOverrides,
|
|
125368
|
-
},
|
|
125364
|
+
reporterPackageName,
|
|
125365
|
+
{ ...playdashProductionConfig, ...playdashProductionOverrides },
|
|
125369
125366
|
],
|
|
125370
125367
|
];
|
|
125371
125368
|
if (process.env.IS_LIGHTHOUSE_REPORT) {
|
|
125372
125369
|
reporter = [
|
|
125373
125370
|
[
|
|
125374
|
-
|
|
125371
|
+
reporterPackageName,
|
|
125372
|
+
{ ...playdashLighthouseConfig, ...playdashLighthouseOverrides },
|
|
125373
|
+
],
|
|
125374
|
+
];
|
|
125375
|
+
}
|
|
125376
|
+
if (process.env.TAG?.includes("production")) {
|
|
125377
|
+
reporter = [
|
|
125378
|
+
[
|
|
125379
|
+
reporterPackageName,
|
|
125375
125380
|
{
|
|
125376
|
-
...
|
|
125377
|
-
...
|
|
125381
|
+
...playdashProductionHealthConfig,
|
|
125382
|
+
...playdashProductionHealthOverrides,
|
|
125378
125383
|
},
|
|
125379
125384
|
],
|
|
125380
125385
|
];
|
|
@@ -125477,13 +125482,14 @@ const definePlaywrightConfig = (overrides) => {
|
|
|
125477
125482
|
}),
|
|
125478
125483
|
},
|
|
125479
125484
|
{
|
|
125480
|
-
name:
|
|
125485
|
+
name: PROJECT_NAMES.productionHealth,
|
|
125481
125486
|
testDir: "./e2e/health",
|
|
125482
125487
|
testMatch: "production.health.ts",
|
|
125483
125488
|
use: {
|
|
125484
125489
|
...devices["Desktop Chrome"],
|
|
125485
125490
|
baseURL: process.env.PLAYWRIGHT_PRODUCTION_BASE_URL,
|
|
125486
|
-
|
|
125491
|
+
screenshot: "on",
|
|
125492
|
+
trace: "on",
|
|
125487
125493
|
},
|
|
125488
125494
|
},
|
|
125489
125495
|
...projectOverrides,
|