mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-6510] playwright List View e2e test (#3566)
* [ACS-6435] playwright e2e for list views personal files * e2e test for trash page * e2e test for trash page * e2e test for file-libraries page * e2e test for file-libraries page fix * e2e test for file-libraries page fix * e2e test shared recent page * e2e test shared recent page fix * e2e test review comment fix * e2e test review fix flaky test fix * e2e test fail test fix * e2e test fail fix * test code fix * protractor list-view test enable * [ACS-6510] listview playwright e2e test * code fix * code fix * code fix * code fix * code fix * code fix * code fix for review * code fix for review
This commit is contained in:
@@ -41,7 +41,7 @@ export class FileActionsApi {
|
||||
return classObj;
|
||||
}
|
||||
|
||||
async uploadFile(fileLocation: string, fileName: string, parentFolderId: string): Promise<any> {
|
||||
async uploadFile(fileLocation: string, fileName: string, parentFolderId: string): Promise<NodeEntry> {
|
||||
const file = fs.createReadStream(fileLocation);
|
||||
return this.apiService.upload.uploadFile(file, '', parentFolderId, null, {
|
||||
name: fileName,
|
||||
@@ -50,7 +50,13 @@ export class FileActionsApi {
|
||||
});
|
||||
}
|
||||
|
||||
async uploadFileWithRename(fileLocation: string, newName: string, parentId: string = '-my-', title: string = '', description: string = '') {
|
||||
async uploadFileWithRename(
|
||||
fileLocation: string,
|
||||
newName: string,
|
||||
parentId: string = '-my-',
|
||||
title: string = '',
|
||||
description: string = ''
|
||||
): Promise<NodeEntry> {
|
||||
const file = fs.createReadStream(fileLocation);
|
||||
const nodeProps = {
|
||||
properties: {
|
||||
@@ -68,10 +74,11 @@ export class FileActionsApi {
|
||||
return await this.apiService.upload.uploadFile(file, '', parentId, nodeProps, opts);
|
||||
} catch (error) {
|
||||
Logger.error(`${this.constructor.name} ${this.uploadFileWithRename.name}`, error);
|
||||
return Promise.reject(error);
|
||||
}
|
||||
}
|
||||
|
||||
async lockNodes(nodeIds: string[], lockType: string = 'ALLOW_OWNER_CHANGES') {
|
||||
async lockNodes(nodeIds: string[], lockType: string = 'ALLOW_OWNER_CHANGES'): Promise<void> {
|
||||
try {
|
||||
for (const nodeId of nodeIds) {
|
||||
await this.apiService.nodes.lockNode(nodeId, { type: lockType });
|
||||
@@ -93,7 +100,7 @@ export class FileActionsApi {
|
||||
async getNodeProperty(nodeId: string, property: string): Promise<string> {
|
||||
try {
|
||||
const node = await this.getNodeById(nodeId);
|
||||
return (node.entry.properties?.[property]) || '';
|
||||
return node.entry.properties?.[property] || '';
|
||||
} catch (error) {
|
||||
Logger.error(`${this.constructor.name} ${this.getNodeProperty.name}`, error);
|
||||
return '';
|
||||
@@ -145,7 +152,7 @@ export class FileActionsApi {
|
||||
return this.apiService.search.search(data);
|
||||
} catch (error) {
|
||||
Logger.error(`SearchApi queryNodesNames : catch : `, error);
|
||||
return new ResultSetPaging;
|
||||
return new ResultSetPaging();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,4 +174,18 @@ export class FileActionsApi {
|
||||
Logger.error(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
}
|
||||
}
|
||||
|
||||
async updateNodeContent(nodeId: string, content: string, majorVersion: boolean = true, comment?: string, newName?: string): Promise<NodeEntry> {
|
||||
try {
|
||||
const opts: { [key: string]: string | boolean } = {
|
||||
majorVersion: majorVersion,
|
||||
comment: comment,
|
||||
name: newName
|
||||
};
|
||||
return await this.apiService.nodes.updateNodeContent(nodeId, content, opts);
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.updateNodeContent.name}`, error);
|
||||
return Promise.reject(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -81,6 +81,14 @@ export class NodesApi {
|
||||
}
|
||||
}
|
||||
|
||||
async deleteDeletedNode(name: string): Promise<void> {
|
||||
try {
|
||||
await this.apiService.trashCan.deleteDeletedNode(name);
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.deleteDeletedNode.name}: ${error}`);
|
||||
}
|
||||
}
|
||||
|
||||
private async createNode(
|
||||
nodeType: string,
|
||||
name: string,
|
||||
|
@@ -23,7 +23,16 @@
|
||||
*/
|
||||
|
||||
import { ApiClientFactory } from './api-client-factory';
|
||||
import { Site, SiteBodyCreate, SiteEntry, SiteMemberEntry, SiteMembershipBodyCreate, SiteMembershipBodyUpdate, SiteMembershipRequestBodyCreate, SiteMembershipRequestEntry } from '@alfresco/js-api';
|
||||
import {
|
||||
Site,
|
||||
SiteBodyCreate,
|
||||
SiteEntry,
|
||||
SiteMemberEntry,
|
||||
SiteMembershipBodyCreate,
|
||||
SiteMembershipBodyUpdate,
|
||||
SiteMembershipRequestBodyCreate,
|
||||
SiteMembershipRequestEntry
|
||||
} from '@alfresco/js-api';
|
||||
|
||||
export class SitesApi {
|
||||
private apiService: ApiClientFactory;
|
||||
@@ -88,7 +97,7 @@ export class SitesApi {
|
||||
return await this.apiService.sites.updateSiteMembership(siteId, userId, siteRole);
|
||||
} catch (error) {
|
||||
console.error(`SitesApi updateSiteMember : catch : `, error);
|
||||
return new SiteMemberEntry;
|
||||
return new SiteMemberEntry();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +114,7 @@ export class SitesApi {
|
||||
return this.updateSiteMember(siteId, userId, role);
|
||||
} else {
|
||||
console.error(`SitesApi addSiteMember : catch : `, error);
|
||||
return new SiteMemberEntry;
|
||||
return new SiteMemberEntry();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -141,4 +150,12 @@ export class SitesApi {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async deleteSiteMember(siteId: string, userId: string) {
|
||||
try {
|
||||
return await this.apiService.sites.deleteSiteMembership(siteId, userId);
|
||||
} catch (error) {
|
||||
console.error(`SitesApi deleteSiteMember : catch : `, error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user