mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACS-9795] [E2E] Fixing tests from ACS-9795 (#4676)
* [ACS-9795] [E2E] Included tests for verification * [ACS-9795] [E2E] fixes for e2es pt.1 * [ACS-9795] e2e fixes pt.2 * [ACS-9795] e2e fixes pt.3 * [ACS-9795] deleted dist for testing * [ACS-9795] tests excluded - local ACS issues * [ACS-9795] sonar fixes * [ACS-9795] excluded XAT-17182 * [ACS-9795] updated exclude URLs * [ACS-9795] review fixes 1
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
import * as fs from 'fs';
|
||||
import { ApiClientFactory } from './api-client-factory';
|
||||
import { Utils, waitForApi } from '../utils';
|
||||
import { NodeBodyCreate, NodeEntry, ResultSetPaging } from '@alfresco/js-api';
|
||||
import { NodeBodyCreate, NodeEntry, ResultSetPaging, SearchRequest } from '@alfresco/js-api';
|
||||
|
||||
export class FileActionsApi {
|
||||
private apiService: ApiClientFactory;
|
||||
@@ -159,6 +159,63 @@ export class FileActionsApi {
|
||||
|
||||
try {
|
||||
await waitForApi(apiCall, predicate, 30, 2500);
|
||||
console.log(`waitForNodes: Found ${data.expect} nodes with search term "${searchTerm}"`);
|
||||
} catch (error) {
|
||||
console.error(`Error: ${error}`);
|
||||
}
|
||||
}
|
||||
|
||||
private async queryNodesSearchHighlight(searchTerm: string): Promise<ResultSetPaging> {
|
||||
const data: SearchRequest = {
|
||||
query: {
|
||||
query: `cm:name:"${searchTerm}*"`,
|
||||
language: 'afts'
|
||||
},
|
||||
filterQueries: [{ query: `+TYPE:'cm:folder' OR +TYPE:'cm:content'` }],
|
||||
highlight: {
|
||||
prefix: "<span class='aca-highlight'>",
|
||||
postfix: '</span>',
|
||||
fields: [
|
||||
{
|
||||
field: 'cm:title'
|
||||
},
|
||||
{
|
||||
field: 'cm:name'
|
||||
},
|
||||
{
|
||||
field: 'cm:description',
|
||||
snippetCount: 1
|
||||
},
|
||||
{
|
||||
field: 'cm:content',
|
||||
snippetCount: 1
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
return this.apiService.search.search(data);
|
||||
} catch {
|
||||
return new ResultSetPaging();
|
||||
}
|
||||
}
|
||||
|
||||
async waitForNodesSearchHighlight(searchTerm: string, data: { expect: number }): Promise<void> {
|
||||
const predicate = (totalItems: number): boolean => totalItems === data.expect;
|
||||
|
||||
const apiCall = async (): Promise<number> => {
|
||||
try {
|
||||
return (await this.queryNodesSearchHighlight(searchTerm)).list.pagination.totalItems;
|
||||
} catch (error) {
|
||||
console.warn(`queryNodesSearchHighlight failed for "${searchTerm}":`, error);
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
await waitForApi(apiCall, predicate, 30, 2500);
|
||||
console.log(`waitForNodesSearchHighlight: Found ${data.expect} nodes with search term "${searchTerm}"`);
|
||||
} catch (error) {
|
||||
console.error(`Error: ${error}`);
|
||||
}
|
||||
|
@@ -90,9 +90,8 @@ export class SearchFiltersProperties extends BaseComponent {
|
||||
|
||||
if (fileTypeInputText) {
|
||||
await this.fileTypeInput?.fill(fileTypeInputText);
|
||||
const targetDropdownOption = this.page.locator(`mat-option`, { hasText: fileTypeInputText });
|
||||
|
||||
await targetDropdownOption.click();
|
||||
await this.dropdownOptions.getByText(fileTypeInputText).waitFor();
|
||||
await this.dropdownOptions.getByText(fileTypeInputText).click();
|
||||
}
|
||||
|
||||
await page.searchFilters.menuCardApply.click();
|
||||
|
@@ -63,6 +63,11 @@ export class ViewerComponent extends BaseComponent {
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
async isViewerOpened(): Promise<boolean> {
|
||||
await this.waitForViewerToOpen();
|
||||
return this.viewerLocator.isVisible();
|
||||
}
|
||||
|
||||
async waitForViewerToOpen(waitForViewerContent?: 'wait for viewer content'): Promise<void> {
|
||||
if (waitForViewerContent) {
|
||||
await this.waitForViewerLoaderToFinish();
|
||||
@@ -70,13 +75,13 @@ export class ViewerComponent extends BaseComponent {
|
||||
await this.viewerLocator.waitFor({ state: 'visible', timeout: timeouts.large });
|
||||
}
|
||||
|
||||
async isViewerOpened(): Promise<boolean> {
|
||||
await this.waitForViewerToOpen();
|
||||
return this.viewerLocator.isVisible();
|
||||
}
|
||||
|
||||
async waitForViewerLoaderToFinish(): Promise<void> {
|
||||
await this.viewerSpinner.waitFor({ state: 'hidden', timeout: timeouts.extraLarge });
|
||||
async waitForViewerLoaderToFinish(customTimeout?: number): Promise<void> {
|
||||
try {
|
||||
await this.viewerSpinner.waitFor({ state: 'hidden', timeout: customTimeout || timeouts.extraLarge });
|
||||
} catch (error) {
|
||||
this.logger.log('waitForViewerLoaderToFinish: Timeout reached while waiting for viewer loader to finish.');
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async checkViewerActivePage(pageNumber: number): Promise<void> {
|
||||
|
@@ -31,6 +31,8 @@ export const timeouts = {
|
||||
big: 7.5 * 1000,
|
||||
large: 10 * 1000,
|
||||
extraLarge: 20 * 1000,
|
||||
fortySeconds: 40 * 1000,
|
||||
sixtySeconds: 60 * 1000,
|
||||
globalTest: 85 * 1000,
|
||||
extendedTest: 150 * 1000,
|
||||
extendedLongTest: 200 * 1000,
|
||||
|
@@ -96,9 +96,9 @@ export class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
static async uploadFileNewVersion(personalFilesPage: PersonalFilesPage, fileFromOS: string): Promise<void> {
|
||||
static async uploadFileNewVersion(personalFilesPage: PersonalFilesPage, fileFromOS: string, fileType: string): Promise<void> {
|
||||
const fileInput = await personalFilesPage.page.$('#app-upload-file-version');
|
||||
await fileInput.setInputFiles(path.join(__dirname, `../resources/test-files/${fileFromOS}.docx`));
|
||||
await fileInput.setInputFiles(path.join(__dirname, `../resources/test-files/${fileFromOS}.${fileType}`));
|
||||
}
|
||||
|
||||
static async reloadPageIfRowNotVisible(
|
||||
|
Reference in New Issue
Block a user