[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:
SheenaMalhotra182
2023-12-23 01:07:48 +05:30
committed by GitHub
parent 683138ced1
commit 373a41bd16
11 changed files with 457 additions and 271 deletions

View File

@@ -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;
}
}
}

View File

@@ -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);
}
}