@digital-ai/devops-page-object-release 0.0.0-snapshot-20260120112719 → 0.0.0-snapshot-20260121070533

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/dist/module.js CHANGED
@@ -2,7 +2,7 @@ import {Buffer as $hOLA6$Buffer} from "buffer";
2
2
  import {test as $hOLA6$test, expect as $hOLA6$expect} from "@playwright/test";
3
3
  import {execFile as $hOLA6$execFile} from "child_process";
4
4
  import $hOLA6$lodashisNil from "lodash/isNil";
5
- import {env as $hOLA6$env, stdout as $hOLA6$stdout} from "process";
5
+ import {env as $hOLA6$env} from "process";
6
6
  import $hOLA6$moment from "moment";
7
7
  import {promises as $hOLA6$promises} from "fs";
8
8
  import $hOLA6$lodashisUndefined from "lodash/isUndefined";
@@ -9384,53 +9384,87 @@ class $e72552cbf941ecfa$export$b8a61e5c71402559 {
9384
9384
 
9385
9385
 
9386
9386
 
9387
-
9388
9387
  class $4444bee76761dfb1$export$f14c0e3f98d164c0 extends (0, $9626bc9256ce31f7$export$2b65d1d97338f32b) {
9389
9388
  /**
9390
9389
  * Login with username and password
9391
9390
  * @param userName
9392
9391
  * @param password
9393
- * @param baseUrl
9394
- */ async login(userName, password) {
9395
- const baseUrl = undefined;
9396
- $hOLA6$stdout.write(`[ENV] TEST_ENV=${undefined}\n`);
9397
- $hOLA6$stdout.write(`[ENV] BASE_URL=${undefined}\n`);
9398
- $hOLA6$stdout.write(`[ENV] TEST_USERNAME=${undefined}\n`);
9399
- if (!baseUrl || !userName || !password) throw new Error("Missing BASE_URL or TEST_USERNAME or TEST_PASSWORD in environment variables");
9400
- await this.page.goto(baseUrl, {
9401
- waitUntil: "domcontentloaded"
9402
- });
9403
- const usernameInput = this.getUsernameInput();
9404
- const passwordInput = this.getPasswordInput();
9405
- await usernameInput.fill(userName);
9406
- await passwordInput.fill(password);
9407
- await this.page.getByRole("button", {
9408
- name: /log in|sign in/i
9409
- }).click();
9410
- (0, $hOLA6$expect)(this.page.getByText("Digital.ai Release Home"));
9411
- await this.closePendoModalWindow();
9412
- }
9413
- getUsernameInput() {
9414
- const env = undefined ?? "local";
9415
- switch(env){
9416
- case "local":
9417
- return this.page.getByPlaceholder("User");
9418
- case "saas":
9419
- return this.page.locator("input#username");
9420
- default:
9421
- throw new Error(`Unsupported TEST_ENV value: ${env}`);
9422
- }
9423
- }
9424
- getPasswordInput() {
9425
- const env = undefined ?? "local";
9426
- switch(env){
9427
- case "local":
9428
- return this.page.getByPlaceholder("Password");
9429
- case "saas":
9430
- return this.page.locator("input#password");
9431
- default:
9432
- throw new Error(`Unsupported TEST_ENV value: ${env}`);
9392
+ */ /*async login(
9393
+ userName: string | undefined = process.env.TEST_USERNAME,
9394
+ password: string | undefined = process.env.TEST_PASSWORD,
9395
+ ): Promise<void> {
9396
+ const baseUrl = process.env.BASE_URL;
9397
+ process.stdout.write(`[ENV] TEST_ENV=${process.env.TEST_ENV}\n`);
9398
+ process.stdout.write(`[ENV] BASE_URL=${process.env.BASE_URL}\n`);
9399
+ process.stdout.write(`[ENV] TEST_USERNAME=${process.env.TEST_USERNAME}\n`);
9400
+ if (!baseUrl || !userName || !password) {
9401
+ throw new Error('Missing BASE_URL or TEST_USERNAME or TEST_PASSWORD in environment variables');
9402
+ }
9403
+
9404
+ await this.page.goto(baseUrl, { waitUntil: 'domcontentloaded' });
9405
+ const usernameInput = this.getUsernameInput();
9406
+ const passwordInput = this.getPasswordInput();
9407
+
9408
+ await usernameInput.fill(userName);
9409
+ await passwordInput.fill(password);
9410
+ await this.page.getByRole('button', { name: /log in|sign in/i }).click();
9411
+ expect(this.page.getByText('Digital.ai Release Home'));
9412
+ await this.closePendoModalWindow();
9413
+ }
9414
+
9415
+ private getUsernameInput(): Locator {
9416
+ const env = process.env.TEST_ENV ?? 'local';
9417
+
9418
+ switch (env) {
9419
+ case 'local':
9420
+ return this.page.getByPlaceholder('User');
9421
+
9422
+ case 'saas':
9423
+ return this.page.locator('input#username');
9424
+
9425
+ default:
9426
+ throw new Error(`Unsupported TEST_ENV value: ${env}`);
9427
+ }
9428
+ }
9429
+
9430
+ private getPasswordInput(): Locator {
9431
+ const env = process.env.TEST_ENV ?? 'local';
9432
+
9433
+ switch (env) {
9434
+ case 'local':
9435
+ return this.page.getByPlaceholder('Password');
9436
+
9437
+ case 'saas':
9438
+ return this.page.locator('input#password');
9439
+
9440
+ default:
9441
+ throw new Error(`Unsupported TEST_ENV value: ${env}`);
9442
+ }
9443
+ }*/ async login(userName, password) {
9444
+ const testEnv = undefined ?? "local";
9445
+ await this.page.goto("./");
9446
+ if (testEnv === "saas") {
9447
+ await this.page.locator("input#username").fill(userName, {
9448
+ timeout: 10000
9449
+ });
9450
+ await this.page.locator("input#password").fill(password, {
9451
+ timeout: 10000
9452
+ });
9453
+ } else {
9454
+ await this.page.getByPlaceholder("User").fill(userName, {
9455
+ timeout: 10000
9456
+ });
9457
+ await this.page.getByPlaceholder("Password").fill(password, {
9458
+ timeout: 10000
9459
+ });
9433
9460
  }
9461
+ await this.page.locator('button[type="submit"]').click();
9462
+ //await expect(this.page).toHaveTitle('Digital.ai Release');
9463
+ //await this.page.locator('input#username').fill(userName, { timeout: 1000 });
9464
+ //await this.page.locator('input#password').fill(password, { timeout: 10000 });
9465
+ //await this.page.getByRole('button', { name: 'Log in' }).click({ timeout: 10000 });
9466
+ await this.page.waitForTimeout(1000);
9467
+ await this.closePendoModalWindow();
9434
9468
  }
9435
9469
  async loginWithoutReload(userName, password) {
9436
9470
  let loadTriggered = false;