@digital-ai/devops-page-object-release 1.0.14 → 1.0.15

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
@@ -4,6 +4,7 @@ import $hOLA6$lodashisNil from "lodash/isNil";
4
4
  import {env as $hOLA6$env} from "process";
5
5
  import $hOLA6$moment from "moment";
6
6
  import {promises as $hOLA6$promises} from "fs";
7
+ import {camelCase as $hOLA6$camelCase} from "lodash";
7
8
  import $hOLA6$lodashisUndefined from "lodash/isUndefined";
8
9
  import $hOLA6$lodasheach from "lodash/each";
9
10
  import $hOLA6$lodashforEach from "lodash/forEach";
@@ -5028,9 +5029,9 @@ class $d13e78163af94d50$export$9b9454a7f137e99b extends (0, $9626bc9256ce31f7$ex
5028
5029
  }
5029
5030
  async createNewPattern(patternName, patternDescription, duration) {
5030
5031
  await this.clickNewDeliveryPattern();
5031
- await this.setPatternName(patternName);
5032
5032
  await this.setPatternDescription(patternDescription);
5033
5033
  if (duration) await this.setDuration(duration);
5034
+ await this.setPatternName(patternName);
5034
5035
  await (0, $hOLA6$expect)(this.page.locator('.action-toolbar-actions button').filter({
5035
5036
  hasText: 'Create'
5036
5037
  })).toBeEnabled();
@@ -5143,11 +5144,11 @@ class $d13e78163af94d50$export$9b9454a7f137e99b extends (0, $9626bc9256ce31f7$ex
5143
5144
  await this.page.getByRole('button', {
5144
5145
  name: 'New delivery'
5145
5146
  }).click();
5146
- await this.addName.fill(deliveryName);
5147
5147
  await this.addDescription.click();
5148
5148
  if (deliveryDes) await this.addDescription.fill(deliveryDes);
5149
5149
  else await this.addDescription.fill('Description');
5150
5150
  if (setAutoComplete) await this.page.getByRole('checkbox').check();
5151
+ await this.addName.fill(deliveryName);
5151
5152
  await (0, $hOLA6$expect)(this.page.locator('.action-toolbar-actions button').filter({
5152
5153
  hasText: 'Create'
5153
5154
  })).toBeEnabled();
@@ -6927,17 +6928,40 @@ class $3a340a3f4fd8f04d$export$61be9a231bfbe7b9 extends (0, $9626bc9256ce31f7$ex
6927
6928
 
6928
6929
 
6929
6930
 
6931
+
6930
6932
  class $cc2d15e53de5cef7$export$b6fbc3e67030138f extends (0, $9626bc9256ce31f7$export$2b65d1d97338f32b) {
6931
6933
  async setStatus(status) {
6934
+ try {
6935
+ // do not try to change status while we have a possible pending request
6936
+ await this.page.waitForResponse((r)=>r.url().includes(this.apiPath), {
6937
+ timeout: 5000
6938
+ });
6939
+ } catch {
6940
+ // nothing to do, no request was pending
6941
+ }
6932
6942
  await this.page.locator('.react-tagsinput').click({
6933
6943
  force: true
6934
6944
  });
6935
- await this.page.getByText('Clear all').click();
6945
+ await Promise.all([
6946
+ this.page.getByText('Clear all').click(),
6947
+ this.page.waitForResponse((r)=>r.url().includes(this.apiPath))
6948
+ ]);
6936
6949
  await this.page.locator('.react-tagsinput').click({
6937
6950
  force: true
6938
6951
  });
6939
- if (status === 'Select all') await this.page.getByText(status).click();
6940
- else await this.page.getByTitle(status).locator('i').first().click();
6952
+ if (status === 'Select all') await Promise.all([
6953
+ this.page.getByText(status).click(),
6954
+ this.page.waitForResponse((r)=>r.url().includes(this.apiPath))
6955
+ ]);
6956
+ else // retry the click until the url matches the state selected
6957
+ await (0, $hOLA6$expect)(async ()=>{
6958
+ await this.page.getByTitle(status).locator('i').first().click({
6959
+ timeout: 1000
6960
+ });
6961
+ await this.page.waitForURL((url)=>url.hash.toLowerCase().includes((0, $hOLA6$camelCase)(status).toLowerCase()), {
6962
+ timeout: 1000
6963
+ });
6964
+ }).toPass();
6941
6965
  }
6942
6966
  async openReleaseGroup(title) {
6943
6967
  await this.page.locator('xlr-release-group-row').filter({
@@ -6962,13 +6986,10 @@ class $cc2d15e53de5cef7$export$b6fbc3e67030138f extends (0, $9626bc9256ce31f7$ex
6962
6986
  async searchReleaseGroupByTitle(title) {
6963
6987
  await this.page.getByPlaceholder('Search for groups...', {
6964
6988
  exact: true
6965
- }).click();
6989
+ }).clear();
6966
6990
  await this.page.getByPlaceholder('Search for groups...', {
6967
6991
  exact: true
6968
6992
  }).fill(title);
6969
- await this.page.getByPlaceholder('Search for groups...', {
6970
- exact: true
6971
- }).press('Enter');
6972
6993
  }
6973
6994
  async deleteReleaseGroup(title) {
6974
6995
  await this.page.locator('.fc-list-item-line').filter({
@@ -6996,6 +7017,9 @@ class $cc2d15e53de5cef7$export$b6fbc3e67030138f extends (0, $9626bc9256ce31f7$ex
6996
7017
  name: 'Cancel'
6997
7018
  }).click();
6998
7019
  }
7020
+ constructor(...args){
7021
+ super(...args), this.apiPath = '/api/v1/release-groups';
7022
+ }
6999
7023
  }
7000
7024
 
7001
7025
 
@@ -8344,28 +8368,34 @@ class $171d52b372748c0b$export$7e1d435fa474ee21 extends (0, $9626bc9256ce31f7$ex
8344
8368
  await (0, $hOLA6$expect)(this.page.getByTestId('template-workflow-pill').getByText('Template')).toBeVisible();
8345
8369
  }
8346
8370
  async move(templateName, targetFolder) {
8371
+ const dialog = this.page.getByRole('dialog');
8347
8372
  await this.page.locator('.template').filter({
8348
8373
  hasText: templateName
8349
8374
  }).locator('.template-actions .move').click();
8350
- await (0, $hOLA6$expect)(this.page.getByText('Move template to')).toBeVisible();
8351
- if (await this.page.getByRole('button', {
8352
- name: 'Expand'
8353
- }).isEnabled()) await this.page.getByRole('button', {
8354
- name: 'Expand'
8355
- }).click();
8356
- await this.page.getByPlaceholder('Search folder...').click();
8357
- await this.page.getByPlaceholder('Search folder...').fill(targetFolder);
8358
- await this.page.getByRole('button', {
8375
+ await (0, $hOLA6$expect)(dialog.getByText('Move template to')).toBeVisible();
8376
+ try {
8377
+ await dialog.getByRole('button', {
8378
+ name: 'Expand'
8379
+ }).click({
8380
+ timeout: 5000
8381
+ });
8382
+ } catch {
8383
+ // it might be that can't expand anything
8384
+ // so we ignore the error
8385
+ }
8386
+ await dialog.getByPlaceholder('Search folder...').click();
8387
+ await dialog.getByPlaceholder('Search folder...').fill(targetFolder);
8388
+ await dialog.getByRole('button', {
8359
8389
  name: targetFolder
8360
8390
  }).click();
8361
- await this.page.getByRole('button', {
8391
+ await dialog.getByRole('button', {
8362
8392
  name: 'Move'
8363
8393
  }).click();
8364
- await (0, $hOLA6$expect)(this.page.getByText('Add', {
8394
+ await (0, $hOLA6$expect)(dialog.getByText('Add', {
8365
8395
  exact: true
8366
8396
  })).toBeVisible();
8367
- await (0, $hOLA6$expect)(this.page.getByText('Remove')).toBeVisible();
8368
- await this.page.getByRole('button', {
8397
+ await (0, $hOLA6$expect)(dialog.getByText('Remove')).toBeVisible();
8398
+ await dialog.getByRole('button', {
8369
8399
  name: 'Move'
8370
8400
  }).click();
8371
8401
  }
@@ -8427,17 +8457,21 @@ class $171d52b372748c0b$export$7e1d435fa474ee21 extends (0, $9626bc9256ce31f7$ex
8427
8457
  name: 'New template'
8428
8458
  });
8429
8459
  await (0, $hOLA6$expect)(async ()=>{
8430
- if (await newTemplateFromActionBarLocator.isVisible({
8431
- timeout: 1000
8432
- })) {
8460
+ try {
8461
+ // wait for new template button from toolbar is visible
8462
+ await (0, $hOLA6$expect)(newTemplateFromActionBarLocator).toBeVisible({
8463
+ timeout: 1000
8464
+ });
8433
8465
  await newTemplateFromActionBarLocator.click();
8434
8466
  await this.page.locator('.action-toolbar-actions').getByRole('menuitem', {
8435
8467
  name: 'Create new template'
8436
8468
  }).click();
8437
- } else // click on empty state
8438
- await this.page.getByRole('button', {
8439
- name: 'New template'
8440
- }).click();
8469
+ } catch {
8470
+ // there is no button, so we click on the empty state one
8471
+ await this.page.getByRole('button', {
8472
+ name: 'New template'
8473
+ }).click();
8474
+ }
8441
8475
  }).toPass();
8442
8476
  }
8443
8477
  async openTemplateByName(templateName) {
@@ -8467,6 +8501,12 @@ class $171d52b372748c0b$export$7e1d435fa474ee21 extends (0, $9626bc9256ce31f7$ex
8467
8501
  async filterByTitle(templateName) {
8468
8502
  await this.searchBy(templateName);
8469
8503
  }
8504
+ async expectOnlyOneTemplateVisible(templateName) {
8505
+ await (0, $hOLA6$expect)(this.page.locator('xlr-template-row-component')).toHaveCount(1);
8506
+ await (0, $hOLA6$expect)(this.page.locator('xlr-template-row-component').filter({
8507
+ hasText: templateName
8508
+ })).toBeVisible();
8509
+ }
8470
8510
  }
8471
8511
 
8472
8512