mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-6435] playwright e2e for list views personal files (#3551)
* [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
This commit is contained in:
@@ -73,7 +73,7 @@ export class SharedLinksApi {
|
||||
return await this.apiService.share.listSharedLinks(opts);
|
||||
} catch (error) {
|
||||
console.error(`SharedLinksApi getSharedLinks : catch : `, error);
|
||||
return new SharedLinkPaging;
|
||||
return new SharedLinkPaging();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,4 +95,47 @@ export class SharedLinksApi {
|
||||
console.error(`\tWait timeout reached waiting for files to be shared`);
|
||||
}
|
||||
}
|
||||
|
||||
private async getSharedIdOfNode(fileId: string): Promise<string> {
|
||||
try {
|
||||
const sharedLinksEntries = (await this.getSharedLinks())?.list.entries;
|
||||
const found = sharedLinksEntries.find((sharedLink) => sharedLink.entry.nodeId === fileId);
|
||||
return found?.entry.id;
|
||||
} catch (error) {
|
||||
console.error(`SharedLinksApi getSharedIdOfNode : catch : `, error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async unshareFileById(fileId: string): Promise<void> {
|
||||
try {
|
||||
const sharedId = await this.getSharedIdOfNode(fileId);
|
||||
return await this.apiService.share.deleteSharedLink(sharedId);
|
||||
} catch (error) {
|
||||
console.error(`SharedLinksApi unshareFileById : catch : `, error);
|
||||
}
|
||||
}
|
||||
|
||||
async waitForFilesToNotBeShared(filesIds: string[]): Promise<any> {
|
||||
try {
|
||||
const sharedFile = async () => {
|
||||
const sharedFiles = (await this.getSharedLinks()).list.entries.map((link) => link.entry.nodeId);
|
||||
|
||||
const foundItems = filesIds.some((id) => {
|
||||
return sharedFiles.includes(id);
|
||||
});
|
||||
|
||||
if (foundItems) {
|
||||
return Promise.reject(foundItems);
|
||||
} else {
|
||||
return Promise.resolve(foundItems);
|
||||
}
|
||||
};
|
||||
|
||||
return await Utils.retryCall(sharedFile);
|
||||
} catch (error) {
|
||||
console.error(`SharedLinksApi waitForFilesToNotBeShared : catch : ${error}`);
|
||||
console.error(`\tWait timeout reached waiting for files to no longer be shared`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user