[ACS-6066] viewer special permissions playwright (#3453)

* [ACS-5923] sidenav and singleclick test

* [ACS-5923] remove protractor test and fix flaky test

* [ACS-5923] test fix

* [ACS-5639] fix exclude test  in viewer

* [ACS-5923] remove exclude test and fix test

* [ACS-6066] viewer special permissions playwright test

* [ACS-6066] viewer protractor test remove

* [ACS-6066] viewer failed test fix

* [ACS-5923] review changes added

* [ACS-5923] fix error in script
This commit is contained in:
Akash Rathod
2023-10-05 12:19:57 +02:00
committed by GitHub
parent 4059a3d219
commit f2d09e8b1a
30 changed files with 1515 additions and 39 deletions

View File

@@ -26,7 +26,7 @@ import * as fs from 'fs';
import { ApiClientFactory } from './api-client-factory';
import { Utils } from '../utils';
import { ApiUtil, Logger } from '@alfresco/adf-testing';
import { NodeEntry } from '@alfresco/js-api';
import { NodeBodyCreate, NodeEntry, ResultSetPaging } from '@alfresco/js-api';
export class FileActionsApi {
private apiService: ApiClientFactory;
@@ -50,6 +50,27 @@ export class FileActionsApi {
});
}
async uploadFileWithRename(fileLocation: string, parentId: string = '-my-', newName: string, title: string = '', description: string = '') {
const file = fs.createReadStream(fileLocation);
const nodeProps = {
properties: {
'cm:title': title,
'cm:description': description
}
} as NodeBodyCreate;
const opts = {
name: newName,
nodeType: 'cm:content'
};
try {
return await this.apiService.upload.uploadFile(file, '', parentId, nodeProps, opts);
} catch (error) {
Logger.error(`${this.constructor.name} ${this.uploadFileWithRename.name}`, error);
}
}
async lockNodes(nodeIds: string[], lockType: string = 'ALLOW_OWNER_CHANGES') {
try {
for (const nodeId of nodeIds) {
@@ -111,7 +132,7 @@ export class FileActionsApi {
return isLocked;
}
private async queryNodesNames(searchTerm: string) {
private async queryNodesNames(searchTerm: string): Promise<ResultSetPaging> {
const data = {
query: {
query: `cm:name:\"${searchTerm}*\"`,
@@ -124,10 +145,11 @@ export class FileActionsApi {
return this.apiService.search.search(data);
} catch (error) {
Logger.error(`SearchApi queryNodesNames : catch : `, error);
return null;
return new ResultSetPaging;
}
}
async waitForNodes(searchTerm: string, data: { expect: number }) {
async waitForNodes(searchTerm: string, data: { expect: number }): Promise<void> {
const predicate = (totalItems: number) => totalItems === data.expect;
const apiCall = async () => {