@digital-ai/devops-page-object-release 0.0.0-snapshot-20260122094725 → 0.0.0-snapshot-20260122153133

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
@@ -9389,84 +9389,31 @@ class $4444bee76761dfb1$export$f14c0e3f98d164c0 extends (0, $9626bc9256ce31f7$ex
9389
9389
  * Login with username and password
9390
9390
  * @param userName
9391
9391
  * @param password
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
- }*/ /* private async waitForKeycloakLogin(): Promise<void> {
9444
- await this.page.waitForSelector('form#kc-form-login', {
9445
- state: 'visible',
9446
- timeout: 15000,
9447
- });
9448
- }*/ /*async login(userName: string, password: string): Promise<void> {
9449
- await this.page.goto('./');
9450
-
9451
- const localPassword = this.page.getByPlaceholder('Password');
9452
-
9453
- if (await localPassword.isVisible({ timeout: 3000 }).catch(() => false)) {
9454
- await this.page.getByPlaceholder('User').fill(userName);
9455
- await localPassword.fill(password);
9456
- } else {
9457
- const usernameInput = this.page.locator('input[name="username"]');
9458
- await usernameInput.waitFor({ state: 'visible', timeout: 10000 });
9459
- await usernameInput.fill(userName);
9460
-
9461
- const passwordInput = this.page.locator('input[type="password"]');
9462
- await passwordInput.waitFor({ state: 'visible', timeout: 10000 });
9463
- await passwordInput.fill(password);
9464
- }
9465
- await this.page.getByRole('button', { name: /log in|sign in/i }).click();
9466
- await this.page.waitForTimeout(1000);
9467
- await this.closePendoModalWindow();
9468
- }*/ async login(userName, password) {
9469
- throw new Error("TEST_ENV is not defined. Aborting login.");
9392
+ */ async login(userName, password) {
9393
+ await this.page.goto("./");
9394
+ const localPassword = this.page.getByPlaceholder("Password");
9395
+ if (this.page.url().includes("/auth/realms")) {
9396
+ const usernameInput = this.page.locator('input[name="username"]');
9397
+ await usernameInput.waitFor({
9398
+ state: "visible",
9399
+ timeout: 10000
9400
+ });
9401
+ await usernameInput.fill(userName);
9402
+ const passwordInput = this.page.locator('input[name="password"]');
9403
+ await passwordInput.waitFor({
9404
+ state: "visible",
9405
+ timeout: 10000
9406
+ });
9407
+ await passwordInput.fill(password);
9408
+ } else {
9409
+ await this.page.getByPlaceholder("User").fill(userName);
9410
+ await localPassword.fill(password);
9411
+ }
9412
+ await this.page.getByRole("button", {
9413
+ name: /log in|sign in/i
9414
+ }).click();
9415
+ await this.page.waitForTimeout(1000);
9416
+ await this.closePendoModalWindow();
9470
9417
  }
9471
9418
  async loginWithoutReload(userName, password) {
9472
9419
  let loadTriggered = false;