@digital-ai/devops-page-object-release 0.0.0-snapshot-20260122084417 → 0.0.0-snapshot-20260122113824

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,83 +9389,25 @@ 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, password) {
9392
+ */ async login(userName, password) {
9449
9393
  await this.page.goto("./");
9450
9394
  const localPassword = this.page.getByPlaceholder("Password");
9451
- if (await localPassword.isVisible({
9452
- timeout: 3000
9453
- }).catch(()=>false)) {
9454
- await this.page.getByPlaceholder("User").fill(userName);
9455
- await localPassword.fill(password);
9456
- } else {
9395
+ if (this.page.url().includes("/auth/realms")) {
9457
9396
  const usernameInput = this.page.locator('input[name="username"]');
9458
9397
  await usernameInput.waitFor({
9459
9398
  state: "visible",
9460
9399
  timeout: 10000
9461
9400
  });
9462
9401
  await usernameInput.fill(userName);
9463
- const passwordInput = this.page.locator('input[type="password"]');
9402
+ const passwordInput = this.page.locator('input[name="password"]');
9464
9403
  await passwordInput.waitFor({
9465
9404
  state: "visible",
9466
9405
  timeout: 10000
9467
9406
  });
9468
9407
  await passwordInput.fill(password);
9408
+ } else {
9409
+ await this.page.getByPlaceholder("User").fill(userName);
9410
+ await localPassword.fill(password);
9469
9411
  }
9470
9412
  await this.page.getByRole("button", {
9471
9413
  name: /log in|sign in/i