[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:
Katarzyna Kita
2024-05-07 11:00:27 +02:00
committed by GitHub
parent 995305fc13
commit 12742b3b90
11 changed files with 237 additions and 3 deletions

View File

@@ -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) {

View File

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