mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACA-1928] e2e improvements - part1 (#883)
* refactor Mark as favourite tests rename method to be more clear create separate methods for some checks and actions * forgot some changes * refactor delete-undo tests * some more refactoring * fix
This commit is contained in:
committed by
Suzana Dirla
parent
0882686172
commit
b8ce533759
@@ -61,11 +61,14 @@ export class FavoritesApi extends RepoApi {
|
||||
}
|
||||
}
|
||||
};
|
||||
return await this.alfrescoJsApi.core.favoritesApi.addFavorite('-me-', data);
|
||||
try {
|
||||
return await this.alfrescoJsApi.core.favoritesApi.addFavorite('-me-', data);
|
||||
} catch (error) {
|
||||
// console.log('--- add favorite by id catch ');
|
||||
}
|
||||
}
|
||||
|
||||
async addFavoritesByIds(nodeType: 'file' | 'folder' | 'site', ids: string[]) {
|
||||
await this.apiAuth();
|
||||
return await ids.reduce(async (previous, current) => {
|
||||
await previous;
|
||||
await this.addFavoriteById(nodeType, current);
|
||||
@@ -107,13 +110,19 @@ export class FavoritesApi extends RepoApi {
|
||||
|
||||
async removeFavoriteById(nodeId: string) {
|
||||
await this.apiAuth();
|
||||
return await this.alfrescoJsApi.core.peopleApi.removeFavoriteSite('-me-', nodeId);
|
||||
try {
|
||||
return await this.alfrescoJsApi.core.peopleApi.removeFavoriteSite('-me-', nodeId);
|
||||
} catch (error) {
|
||||
// console.log('--- remove favorite by id catch ');
|
||||
}
|
||||
}
|
||||
|
||||
async removeFavorite(api: RepoClient, name: string) {
|
||||
const nodeId = (await api.nodes.getNodeByPath(name)).entry.id;
|
||||
return await this.removeFavoriteById(nodeId);
|
||||
}
|
||||
async removeFavoritesByIds(ids: string[]) {
|
||||
return await ids.reduce(async (previous, current) => {
|
||||
await previous;
|
||||
await this.removeFavoriteById(current);
|
||||
}, Promise.resolve());
|
||||
}
|
||||
|
||||
async waitForApi(data) {
|
||||
try {
|
||||
|
@@ -59,13 +59,26 @@ export class NodesApi extends RepoApi {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
async getSharedId(nodeId: string) {
|
||||
return await this.getNodeProperty(nodeId, 'qshare:sharedId');
|
||||
}
|
||||
|
||||
async getSharedExpiryDate(nodeId: string) {
|
||||
return await this.getNodeProperty(nodeId, 'qshare:expiryDate');
|
||||
}
|
||||
|
||||
async isFileShared(nodeId: string) {
|
||||
return (await this.getNodeProperty(nodeId, 'qshare:sharedId')) !== '';
|
||||
return (await this.getSharedId(nodeId)) !== '';
|
||||
}
|
||||
|
||||
async deleteNodeById(id: string, permanent: boolean = true) {
|
||||
await this.apiAuth();
|
||||
return await this.alfrescoJsApi.core.nodesApi.deleteNode(id, { permanent });
|
||||
try {
|
||||
return await this.alfrescoJsApi.core.nodesApi.deleteNode(id, { permanent });
|
||||
} catch (error) {
|
||||
console.log('------ deleteNodeById failed ');
|
||||
}
|
||||
}
|
||||
|
||||
async deleteNodeByPath(path: string, permanent: boolean = true) {
|
||||
|
Reference in New Issue
Block a user