mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-6456] Migrated Share File e2es to Playwright (#3565)
* [AACS-6456] migrated share-file e2es to playwright * [ACS-6456] fixed code smells and removed duplication * [ACS-6456] cleanup, addressed review comments * [ACS-6456] addressed review comments * [ACS-6456] added return types, fixed typos
This commit is contained in:
committed by
GitHub
parent
683138ced1
commit
373a41bd16
@@ -409,4 +409,44 @@ export class NodesApi {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async getNodeProperty(nodeId: string, property: string): Promise<string> {
|
||||
try {
|
||||
const node = await this.getNodeById(nodeId);
|
||||
return node.entry.properties?.[property] || '';
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.getNodeProperty.name}`, error);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
async getSharedId(nodeId: string): Promise<string> {
|
||||
try {
|
||||
const sharedId = await this.getNodeProperty(nodeId, 'qshare:sharedId');
|
||||
return sharedId || '';
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.getSharedId.name}`, error);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
async getSharedExpiryDate(nodeId: string): Promise<string> {
|
||||
try {
|
||||
const expiryDate = await this.getNodeProperty(nodeId, 'qshare:expiryDate');
|
||||
return expiryDate || '';
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.getSharedExpiryDate.name}`, error);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
async isFileShared(nodeId: string): Promise<boolean> {
|
||||
try {
|
||||
const sharedId = await this.getSharedId(nodeId);
|
||||
return sharedId !== '';
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.isFileShared.name}`, error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -50,12 +50,12 @@ export class SharedLinksApi {
|
||||
}
|
||||
}
|
||||
|
||||
async shareFilesByIds(ids: string[]): Promise<SharedLinkEntry[]> {
|
||||
async shareFilesByIds(ids: string[], expireDate?: Date): Promise<SharedLinkEntry[]> {
|
||||
const sharedLinks: SharedLinkEntry[] = [];
|
||||
try {
|
||||
if (ids && ids.length > 0) {
|
||||
for (const id of ids) {
|
||||
const sharedLink = await this.shareFileById(id);
|
||||
const sharedLink = await this.shareFileById(id, expireDate);
|
||||
sharedLinks.push(sharedLink);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user