@alfresco/aca-playwright-shared 7.5.0-26019417572 → 7.5.0-26220284331

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.
@@ -41,5 +41,6 @@ export declare class FileActionsApi {
41
41
  waitForNodesSearchHighlight(searchTerm: string, data: {
42
42
  expect: number;
43
43
  }): Promise<void>;
44
- updateNodeContent(nodeId: string, content: string, majorVersion?: boolean, comment?: string, newName?: string): Promise<NodeEntry>;
44
+ updateNodeContent(nodeId: string, content: string | Buffer, majorVersion?: boolean, comment?: string, newName?: string): Promise<NodeEntry>;
45
+ updateNodeContentFromFile(nodeId: string, fileLocation: string, majorVersion?: boolean, comment?: string, newName?: string): Promise<NodeEntry>;
45
46
  }
@@ -679,18 +679,12 @@ class SnackBarComponent extends BaseComponent {
679
679
  this.message = this.getChild('[data-automation-id="adf-snackbar-message-content"]').first();
680
680
  this.actionButton = this.getChild('[data-automation-id="adf-snackbar-message-content-action-button"]');
681
681
  this.closeIcon = this.getChild('.adf-snackbar-message-content-action-icon');
682
- this.getByMessageLocator = (message) => this.getChild(`[data-automation-id='adf-snackbar-message-content']`, { hasText: message }).first();
683
682
  }
684
683
  async getSnackBarMessage() {
685
684
  return this.message.innerText();
686
685
  }
687
686
  async getSnackBarActionText() {
688
- if (await this.actionButton.isVisible()) {
689
- return this.actionButton.textContent();
690
- }
691
- else {
692
- return '';
693
- }
687
+ return this.actionButton.innerText();
694
688
  }
695
689
  async verifySnackBarActionText(text) {
696
690
  expect(await this.message.textContent()).toContain(text);
@@ -1040,7 +1034,6 @@ class DataTableComponent extends BaseComponent {
1040
1034
  return this.contextMenuActions.getButtonByText(action);
1041
1035
  }
1042
1036
  async goThroughPagesLookingForRowWithName(name) {
1043
- await this.spinnerWaitForReload();
1044
1037
  if (await this.getRowByName(name).isVisible()) {
1045
1038
  return;
1046
1039
  }
@@ -2161,11 +2154,13 @@ class ManageRules extends BaseComponent {
2161
2154
  async countConditionsInGroup() {
2162
2155
  return this.ruleConditionsInGroup.count();
2163
2156
  }
2164
- async turnOffRuleToggle() {
2157
+ async turnOffRuleToggle(skipExpect) {
2165
2158
  await expect(async () => {
2166
2159
  await this.ruleToggle.hover({ timeout: 1000 });
2167
2160
  await this.ruleToggle.click();
2168
- await expect(this.ruleToggleFalse).toBeVisible();
2161
+ if (skipExpect !== 'skip expect') {
2162
+ await expect(this.ruleToggleFalse).toBeVisible();
2163
+ }
2169
2164
  }).toPass({
2170
2165
  intervals: [2_000],
2171
2166
  timeout: 20_000
@@ -2444,6 +2439,7 @@ class ConditionComponent extends ManageRulesDialogComponent {
2444
2439
  this.getOptionLocator = (optionName) => this.page.locator('[role=listbox] [role=option]', { hasText: optionName }).first();
2445
2440
  }
2446
2441
  async selectField(fields, index) {
2442
+ await this.fieldDropDown.nth(index).scrollIntoViewIfNeeded();
2447
2443
  await this.fieldDropDown.nth(index).click();
2448
2444
  const option = this.getOptionLocator(fields);
2449
2445
  await option.click();
@@ -2459,7 +2455,12 @@ class ConditionComponent extends ManageRulesDialogComponent {
2459
2455
  if (comparators) {
2460
2456
  await this.selectComparator(comparators, index);
2461
2457
  }
2462
- await this.valueField.nth(index).fill(value);
2458
+ if ((await this.valueField.count()) === 1) {
2459
+ await this.valueField.last().fill(value);
2460
+ }
2461
+ else {
2462
+ await this.valueField.nth(index).fill(value);
2463
+ }
2463
2464
  }
2464
2465
  async addConditionGroup(fields, value, index, comparators) {
2465
2466
  await this.addConditionGroupButton.last().click();
@@ -2702,7 +2703,7 @@ class ViewerComponent extends BaseComponent {
2702
2703
  this.thumbnailsCloseButton = this.getChild('[data-automation-id="adf-thumbnails-close"]');
2703
2704
  this.viewerPage = this.getChild('[data-automation-id="adf-page-selector"]');
2704
2705
  this.viewerMedia = this.getChild('adf-media-player');
2705
- this.viewerSpinner = this.getChild('.adf-viewer-render__loading-screen');
2706
+ this.viewerSpinner = this.getChild('.adf-viewer-render__loading-screen__spinner');
2706
2707
  this.zoomInButton = this.getChild('#viewer-zoom-in-button');
2707
2708
  this.zoomOutButton = this.getChild('#viewer-zoom-out-button');
2708
2709
  this.zoomScale = this.getChild('[data-automation-id="adf-page-scale"]');
@@ -2723,16 +2724,11 @@ class ViewerComponent extends BaseComponent {
2723
2724
  }
2724
2725
  async waitForViewerToOpen() {
2725
2726
  await this.waitForViewerLoaderToFinish();
2726
- await this.viewerLocator.waitFor({ state: 'visible', timeout: timeouts.large });
2727
+ await this.viewerLocator.waitFor({ state: 'visible', timeout: timeouts.extraLarge });
2727
2728
  }
2728
- async waitForViewerLoaderToFinish(customTimeout) {
2729
- try {
2730
- await this.viewerSpinner.waitFor({ state: 'hidden', timeout: customTimeout || timeouts.extraLarge });
2731
- }
2732
- catch (error) {
2733
- this.logger.log('waitForViewerLoaderToFinish: Timeout reached while waiting for viewer loader to finish.');
2734
- throw error;
2735
- }
2729
+ async waitForViewerLoaderToFinish() {
2730
+ await this.viewerSpinner.waitFor({ state: 'attached', timeout: timeouts.medium }).catch(() => { });
2731
+ await this.viewerSpinner.waitFor({ state: 'detached', timeout: timeouts.fortySeconds }).catch(() => { });
2736
2732
  }
2737
2733
  async checkViewerActivePage(pageNumber) {
2738
2734
  await expect(this.viewerPage).toHaveValue(pageNumber.toString());
@@ -2751,7 +2747,7 @@ class ViewerComponent extends BaseComponent {
2751
2747
  async waitForZoomPercentageToDisplay() {
2752
2748
  await this.zoomScale.waitFor({ state: 'visible', timeout: timeouts.normal });
2753
2749
  const startTime = Date.now();
2754
- let textContent;
2750
+ let textContent = '';
2755
2751
  while (Date.now() - startTime <= timeouts.medium) {
2756
2752
  textContent = await this.zoomScale.innerText();
2757
2753
  if (textContent.trim() !== '') {
@@ -2766,11 +2762,23 @@ class ViewerComponent extends BaseComponent {
2766
2762
  async getFileTitle() {
2767
2763
  await this.fileTitleButtonLocator.waitFor({ state: 'visible', timeout: timeouts.normal });
2768
2764
  await this.waitForViewerLoaderToFinish();
2769
- return this.fileTitleButtonLocator.textContent();
2765
+ const title = await this.fileTitleButtonLocator.textContent();
2766
+ if (!title) {
2767
+ const errorMessage = 'File title is not displayed in the viewer';
2768
+ this.logger.error(errorMessage);
2769
+ throw new Error(errorMessage);
2770
+ }
2771
+ return title;
2770
2772
  }
2771
2773
  async getCloseButtonTooltip() {
2772
2774
  await this.closeButtonLocator.waitFor({ state: 'visible', timeout: timeouts.normal });
2773
- return this.closeButtonLocator.getAttribute('title');
2775
+ const tooltip = await this.closeButtonLocator.getAttribute('title');
2776
+ if (!tooltip) {
2777
+ const errorMessage = 'Close button tooltip is not available';
2778
+ this.logger.error(errorMessage);
2779
+ throw new Error(errorMessage);
2780
+ }
2781
+ return tooltip;
2774
2782
  }
2775
2783
  async verifyViewerPrimaryActions(expectedToolbarPrimary) {
2776
2784
  const toRemove = ['Close', 'Previous File', 'Next File', 'View details'];
@@ -3184,6 +3192,7 @@ class SearchInputComponent extends BaseComponent {
3184
3192
  this.getCellLinkByName = (name) => this.getChild('.adf-datatable-row[role="row"]', { hasText: name });
3185
3193
  }
3186
3194
  async searchFor(searchText) {
3195
+ await this.searchInput.click();
3187
3196
  await this.searchInput.fill(searchText);
3188
3197
  await this.searchButton.click();
3189
3198
  }
@@ -3966,8 +3975,8 @@ class SearchInDialogComponent extends BaseComponent {
3966
3975
  super(page, rootElement);
3967
3976
  this.filesAndFoldersRadioButton = this.getChild('.aca-search-in-panel__radio label').getByText('Files and folders');
3968
3977
  this.librariesRadioButton = this.getChild('.aca-search-in-panel__radio label').getByText('Libraries');
3969
- this.filesCheckbox = this.getChild('.aca-search-in-panel__checkboxes').getByLabel('Files');
3970
- this.foldersCheckbox = this.getChild('.aca-search-in-panel__checkboxes').getByLabel('Folders');
3978
+ this.filesCheckbox = this.getChild('#content [type="checkbox"]');
3979
+ this.foldersCheckbox = this.getChild('#folder [type="checkbox"]');
3971
3980
  this.applyButton = this.getChild('button', { hasText: 'Apply' });
3972
3981
  this.resetButton = this.getChild('button', { hasText: 'Reset' });
3973
3982
  }
@@ -4066,6 +4075,7 @@ class SearchPage extends BasePage {
4066
4075
  if (!(await this.searchInputComponent.searchInput.isVisible())) {
4067
4076
  await this.acaHeader.searchButton.click();
4068
4077
  }
4078
+ await this.searchInputComponent.searchFor(searchText);
4069
4079
  await this.searchInputComponent.searchInButton.click();
4070
4080
  switch (searchType) {
4071
4081
  case 'files':
@@ -4084,13 +4094,8 @@ class SearchPage extends BasePage {
4084
4094
  break;
4085
4095
  }
4086
4096
  await this.searchInDialog.applyButton.click();
4087
- await this.clickSearchButton();
4088
- await this.searchInputComponent.searchFor(searchText);
4089
4097
  await this.dataTable.spinnerWaitForReload();
4090
4098
  }
4091
- async clickSearchButton() {
4092
- await this.searchInputComponent.searchButton.click({ force: true });
4093
- }
4094
4099
  }
4095
4100
 
4096
4101
  /*!
@@ -5217,13 +5222,17 @@ class FileActionsApi {
5217
5222
  if (newName !== undefined) {
5218
5223
  opts['name'] = newName;
5219
5224
  }
5220
- return await this.apiService.nodes.updateNodeContent(nodeId, content, opts);
5225
+ return await this.apiService.nodes.updateNodeContent(nodeId, content, opts); // NOSONAR
5221
5226
  }
5222
5227
  catch (error) {
5223
5228
  logger.error(`${this.constructor.name} ${this.updateNodeContent.name}: ${error}`);
5224
5229
  return Promise.reject(error);
5225
5230
  }
5226
5231
  }
5232
+ async updateNodeContentFromFile(nodeId, fileLocation, majorVersion = true, comment, newName) {
5233
+ const fileContent = await fs.promises.readFile(fileLocation);
5234
+ return this.updateNodeContent(nodeId, fileContent, majorVersion, comment, newName);
5235
+ }
5227
5236
  }
5228
5237
 
5229
5238
  /*!