@alfresco/aca-playwright-shared 8.0.0-16317431307 → 8.0.0-16366381341

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.
@@ -37,5 +37,9 @@ export declare class FileActionsApi {
37
37
  waitForNodes(searchTerm: string, data: {
38
38
  expect: number;
39
39
  }): Promise<void>;
40
+ private queryNodesSearchHighlight;
41
+ waitForNodesSearchHighlight(searchTerm: string, data: {
42
+ expect: number;
43
+ }): Promise<void>;
40
44
  updateNodeContent(nodeId: string, content: string, majorVersion?: boolean, comment?: string, newName?: string): Promise<NodeEntry>;
41
45
  }
@@ -72,6 +72,8 @@ const timeouts = {
72
72
  big: 7.5 * 1000,
73
73
  large: 10 * 1000,
74
74
  extraLarge: 20 * 1000,
75
+ fortySeconds: 40 * 1000,
76
+ sixtySeconds: 60 * 1000,
75
77
  globalTest: 85 * 1000,
76
78
  extendedTest: 150 * 1000,
77
79
  extendedLongTest: 200 * 1000,
@@ -220,9 +222,9 @@ class Utils {
220
222
  console.error(`${errorMessage}: ${error}`);
221
223
  }
222
224
  }
223
- static async uploadFileNewVersion(personalFilesPage, fileFromOS) {
225
+ static async uploadFileNewVersion(personalFilesPage, fileFromOS, fileType) {
224
226
  const fileInput = await personalFilesPage.page.$('#app-upload-file-version');
225
- await fileInput.setInputFiles(path.join(__dirname, `../resources/test-files/${fileFromOS}.docx`));
227
+ await fileInput.setInputFiles(path.join(__dirname, `../resources/test-files/${fileFromOS}.${fileType}`));
226
228
  }
227
229
  static async reloadPageIfRowNotVisible(pageContext, nodeName, errorMessage = 'reloadPageIfRowNotVisible Error ') {
228
230
  try {
@@ -2805,18 +2807,24 @@ class ViewerComponent extends BaseComponent {
2805
2807
  const count = await this.pdfViewerContentPages.count();
2806
2808
  return count > 0;
2807
2809
  }
2810
+ async isViewerOpened() {
2811
+ await this.waitForViewerToOpen();
2812
+ return this.viewerLocator.isVisible();
2813
+ }
2808
2814
  async waitForViewerToOpen(waitForViewerContent) {
2809
2815
  if (waitForViewerContent) {
2810
2816
  await this.waitForViewerLoaderToFinish();
2811
2817
  }
2812
2818
  await this.viewerLocator.waitFor({ state: 'visible', timeout: timeouts.large });
2813
2819
  }
2814
- async isViewerOpened() {
2815
- await this.waitForViewerToOpen();
2816
- return this.viewerLocator.isVisible();
2817
- }
2818
- async waitForViewerLoaderToFinish() {
2819
- await this.viewerSpinner.waitFor({ state: 'hidden', timeout: timeouts.extraLarge });
2820
+ async waitForViewerLoaderToFinish(customTimeout) {
2821
+ try {
2822
+ await this.viewerSpinner.waitFor({ state: 'hidden', timeout: customTimeout || timeouts.extraLarge });
2823
+ }
2824
+ catch (error) {
2825
+ this.logger.log('waitForViewerLoaderToFinish: Timeout reached while waiting for viewer loader to finish.');
2826
+ throw error;
2827
+ }
2820
2828
  }
2821
2829
  async checkViewerActivePage(pageNumber) {
2822
2830
  await expect(this.viewerPage).toHaveValue(pageNumber.toString());
@@ -3406,8 +3414,8 @@ class SearchFiltersProperties extends BaseComponent {
3406
3414
  }
3407
3415
  if (fileTypeInputText) {
3408
3416
  await this.fileTypeInput?.fill(fileTypeInputText);
3409
- const targetDropdownOption = this.page.locator(`mat-option`, { hasText: fileTypeInputText });
3410
- await targetDropdownOption.click();
3417
+ await this.dropdownOptions.getByText(fileTypeInputText).waitFor();
3418
+ await this.dropdownOptions.getByText(fileTypeInputText).click();
3411
3419
  }
3412
3420
  await page.searchFilters.menuCardApply.click();
3413
3421
  await page.dataTable.progressBarWaitForReload();
@@ -5080,6 +5088,61 @@ class FileActionsApi {
5080
5088
  };
5081
5089
  try {
5082
5090
  await waitForApi(apiCall, predicate, 30, 2500);
5091
+ console.log(`waitForNodes: Found ${data.expect} nodes with search term "${searchTerm}"`);
5092
+ }
5093
+ catch (error) {
5094
+ console.error(`Error: ${error}`);
5095
+ }
5096
+ }
5097
+ async queryNodesSearchHighlight(searchTerm) {
5098
+ const data = {
5099
+ query: {
5100
+ query: `cm:name:"${searchTerm}*"`,
5101
+ language: 'afts'
5102
+ },
5103
+ filterQueries: [{ query: `+TYPE:'cm:folder' OR +TYPE:'cm:content'` }],
5104
+ highlight: {
5105
+ prefix: "<span class='aca-highlight'>",
5106
+ postfix: '</span>',
5107
+ fields: [
5108
+ {
5109
+ field: 'cm:title'
5110
+ },
5111
+ {
5112
+ field: 'cm:name'
5113
+ },
5114
+ {
5115
+ field: 'cm:description',
5116
+ snippetCount: 1
5117
+ },
5118
+ {
5119
+ field: 'cm:content',
5120
+ snippetCount: 1
5121
+ }
5122
+ ]
5123
+ }
5124
+ };
5125
+ try {
5126
+ return this.apiService.search.search(data);
5127
+ }
5128
+ catch {
5129
+ return new ResultSetPaging();
5130
+ }
5131
+ }
5132
+ async waitForNodesSearchHighlight(searchTerm, data) {
5133
+ const predicate = (totalItems) => totalItems === data.expect;
5134
+ const apiCall = async () => {
5135
+ try {
5136
+ return (await this.queryNodesSearchHighlight(searchTerm)).list.pagination.totalItems;
5137
+ }
5138
+ catch (error) {
5139
+ console.warn(`queryNodesSearchHighlight failed for "${searchTerm}":`, error);
5140
+ return 0;
5141
+ }
5142
+ };
5143
+ try {
5144
+ await waitForApi(apiCall, predicate, 30, 2500);
5145
+ console.log(`waitForNodesSearchHighlight: Found ${data.expect} nodes with search term "${searchTerm}"`);
5083
5146
  }
5084
5147
  catch (error) {
5085
5148
  console.error(`Error: ${error}`);