mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-5019] Migrated e2e tests - Actions - download (#3829)
* [ACS-5019] Migrated Tests Protractor2Playwright Actions - download --------- Co-authored-by: akash.rathod@hyland.com <akash.rathod@hyland.com>
This commit is contained in:
@@ -36,7 +36,8 @@ export class AcaHeader extends BaseComponent {
|
||||
public searchButton = this.getChild('button[title="Search"]');
|
||||
public fullScreenButton = this.getChild('button[id="app.viewer.fullscreen"]');
|
||||
public shareButton = this.getChild('button[id="share-action-button"]');
|
||||
public downloadButton = this.getChild('button[id="app.viewer.download"]');
|
||||
public downloadButtonViewer = this.getChild('button[id="app.viewer.download"]');
|
||||
public downloadButton = this.getChild('button[id="app.toolbar.download"]');
|
||||
public sharedDownloadButton = this.getChild('button[id="app.viewer.shared.download"]');
|
||||
|
||||
constructor(page: Page) {
|
||||
|
@@ -27,6 +27,7 @@ import * as path from 'path';
|
||||
import { LoginPage, MyLibrariesPage, PersonalFilesPage, FavoritesLibrariesPage, SearchPage, SharedPage, TrashPage } from '../';
|
||||
import { NodesApi, TrashcanApi, SitesApi } from '@alfresco/playwright-shared';
|
||||
import { format, subDays, subMonths, endOfMonth } from 'date-fns';
|
||||
import StreamZip from 'node-stream-zip';
|
||||
|
||||
export class Utils {
|
||||
static string257Long = 'x'.repeat(257);
|
||||
@@ -146,4 +147,26 @@ export class Utils {
|
||||
|
||||
return { currentDate: formattedDate, previousDate: formattedDate2 };
|
||||
}
|
||||
|
||||
static async verifyZipFileContent(filePath: string, fileOrFolderName: string[]): Promise<boolean> {
|
||||
const zip = new StreamZip({
|
||||
file: filePath,
|
||||
storeEntries: true
|
||||
});
|
||||
|
||||
return new Promise<boolean>((resolve) => {
|
||||
zip.on('ready', () => {
|
||||
const entries = zip.entries();
|
||||
const found = this.isFileOrFolderInEntries(entries, fileOrFolderName);
|
||||
zip.close();
|
||||
resolve(found);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private static isFileOrFolderInEntries(entries: { [name: string]: StreamZip.ZipEntry }, fileOrFolderName: string[]): boolean {
|
||||
return fileOrFolderName.some((name) => {
|
||||
return Object.keys(entries).some((entry) => entry.includes(name));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user