@alfresco/aca-playwright-shared 7.0.1 → 7.1.0-17240832907

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
  }
@@ -21,7 +21,6 @@
21
21
  * You should have received a copy of the GNU Lesser General Public License
22
22
  * from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
23
23
  */
24
- import { AcaFolderRulesModule } from '@alfresco/aca-content/folder-rules';
25
24
  export declare class RulesApi {
26
25
  private apiService;
27
26
  constructor();
@@ -46,7 +45,7 @@ export interface Rule {
46
45
  errorScript: string;
47
46
  isShared: boolean;
48
47
  triggers: RuleTrigger[];
49
- conditions: AcaFolderRulesModule;
48
+ conditions: any;
50
49
  actions: RuleAction[];
51
50
  }
52
51
  export interface RuleAction {
@@ -67,12 +66,12 @@ export declare class ActionTypes {
67
66
  }
68
67
  export declare class ConditionsTypes {
69
68
  key: string;
70
- value: AcaFolderRulesModule;
69
+ value: any;
71
70
  static readonly MIMETYPE: ConditionsTypes;
72
71
  static readonly CMNAME: ConditionsTypes;
73
72
  static readonly SIZE: ConditionsTypes;
74
73
  static readonly TAG: ConditionsTypes;
75
- static readonly conditions: AcaFolderRulesModule[];
76
- constructor(key: string, value: AcaFolderRulesModule);
74
+ static readonly conditions: any[];
75
+ constructor(key: string, value: any);
77
76
  }
78
77
  export {};
@@ -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,7 +3414,8 @@ class SearchFiltersProperties extends BaseComponent {
3406
3414
  }
3407
3415
  if (fileTypeInputText) {
3408
3416
  await this.fileTypeInput?.fill(fileTypeInputText);
3409
- await this.dropdownOptions.first().click();
3417
+ await this.dropdownOptions.getByText(fileTypeInputText).waitFor();
3418
+ await this.dropdownOptions.getByText(fileTypeInputText).click();
3410
3419
  }
3411
3420
  await page.searchFilters.menuCardApply.click();
3412
3421
  await page.dataTable.progressBarWaitForReload();
@@ -5079,6 +5088,61 @@ class FileActionsApi {
5079
5088
  };
5080
5089
  try {
5081
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}"`);
5082
5146
  }
5083
5147
  catch (error) {
5084
5148
  console.error(`Error: ${error}`);