[ACS-5650] viewer action files e2e migration (#3367)

* viewer action files e2e migration

* viewer action files e2e remove comment

* review code fix

* [ci:force]
This commit is contained in:
Akash Rathod
2023-08-03 18:29:10 +02:00
committed by GitHub
parent 26cd95ccbd
commit 4cee6563f5
22 changed files with 402 additions and 76 deletions

View File

@@ -25,7 +25,7 @@
import { expect } from '@playwright/test';
import { ApiClientFactory, getUserState, test, TEST_FILES, Utils } from '@alfresco/playwright-shared';
test.use({ storageState: getUserState('admin') });
test.use({ storageState: getUserState('hruser') });
test.describe('viewer file', () => {
const apiClientFactory = new ApiClientFactory();
const randomFolderName = `playwright-folder-${Utils.random()}`;
@@ -33,19 +33,18 @@ test.describe('viewer file', () => {
let folderId: string;
test.beforeAll(async ({ fileAction }) => {
await apiClientFactory.setUpAcaBackend('admin');
await apiClientFactory.setUpAcaBackend('hruser');
const node = await apiClientFactory.nodes.createNode('-my-', { name: randomFolderName, nodeType: 'cm:folder', relativePath: '/' });
folderId = await node.entry.id;
folderId = node.entry.id;
await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxName, folderId);
});
test.beforeEach(async ({ personalFiles }) => {
const gotoNodeURL = `#/personal-files/${folderId}`;
await personalFiles.navigate({ remoteUrl: gotoNodeURL });
await personalFiles.navigate({ remoteUrl: `#/personal-files/${folderId}` });
});
test.afterAll(async () => {
await apiClientFactory.nodes.deleteNode(folderId);
await apiClientFactory.nodes.deleteNode(folderId, { permanent: true });
});
test('[C279269] Viewer opens on double clicking on a file from Personal Files', async ({ personalFiles }) => {
@@ -71,15 +70,11 @@ test.describe('viewer file', () => {
test('[C279271] Close the viewer', async ({ personalFiles }) => {
await personalFiles.dataTable.performClickFolderOrFileToOpen(randomDocxName);
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
expect(await personalFiles.viewer.getCloseButtonTooltip()).toEqual('Close');
await personalFiles.viewer.closeButtonLocator.click();
expect(await personalFiles.dataTable.getCellLinkByName(randomDocxName).isVisible(), 'Viewer did not close').toBe(true);
});
test('[C284632] Close button tooltip', async ({ personalFiles }) => {
await personalFiles.dataTable.performClickFolderOrFileToOpen(randomDocxName);
expect(await personalFiles.viewer.getCloseButtonTooltip()).toEqual('Close');
});
test('[C284636] Viewer opens for a file from Recent Files', async ({ personalFiles, recentFilesPage }) => {
await personalFiles.dataTable.performClickFolderOrFileToOpen(randomDocxName);
expect(await personalFiles.viewer.getCloseButtonTooltip()).toEqual('Close');
@@ -113,17 +108,17 @@ test.describe('viewer file', () => {
let fileDocxId: string;
test.beforeAll(async ({ fileAction, shareAction, favoritesPageAction: favoritesPageAction }) => {
await apiClientFactory.setUpAcaBackend('admin');
await apiClientFactory.setUpAcaBackend('hruser');
const node = await apiClientFactory.nodes.createNode('-my-', { name: randomFolderName, nodeType: 'cm:folder', relativePath: '/' });
folderId = await node.entry.id;
folderId = node.entry.id;
const fileDoc = await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxName, folderId);
fileDocxId = await fileDoc.entry.id;
fileDocxId = fileDoc.entry.id;
await shareAction.shareFileById(fileDocxId);
await favoritesPageAction.addFavoriteById('file', fileDocxId);
});
test.afterAll(async () => {
await apiClientFactory.nodes.deleteNode(folderId);
await apiClientFactory.nodes.deleteNode(folderId, { permanent: true });
});
test('[C279285] Viewer opens when accessing the preview URL for a file', async ({ personalFiles }) => {
@@ -136,7 +131,7 @@ test.describe('viewer file', () => {
test('[C284635] Viewer opens for a file from Shared Files', async ({ sharedPage }) => {
await sharedPage.navigate();
await sharedPage.reload();
await sharedPage.reload({ waitUntil: 'domcontentloaded' });
await sharedPage.dataTable.goThroughPagesLookingForRowWithName(randomDocxName);
await sharedPage.dataTable.performClickFolderOrFileToOpen(randomDocxName);
expect(await sharedPage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);