mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[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:
@@ -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 () => {
|
||||
|
Reference in New Issue
Block a user