mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-5650] viewer user actions test (#3373)
* viewer action files e2e migration * viewer action files e2e remove comment * review code fix * [ci:force] * [ACS-5650]viewer test with new user * remove commented code
This commit is contained in:
@@ -57,8 +57,7 @@ test.describe('viewer action file', () => {
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await apiClientFactory.nodes.deleteNode(folderId);
|
||||
await apiClientFactory.trashCan.deleteDeletedNode(folderId);
|
||||
await apiClientFactory.nodes.deleteNode(folderId, { permanent: true });
|
||||
});
|
||||
|
||||
test('[C268129] Download action', async ({ personalFiles }) => {
|
||||
@@ -82,7 +81,6 @@ test.describe('viewer action file', () => {
|
||||
await personalFiles.dataTable.getCellLinkByName(randomDocxName).waitFor({ state: 'attached' });
|
||||
expect(await personalFiles.dataTable.getCellLinkByName(randomDocxDelete).isVisible(), 'file should not visible').toBe(false);
|
||||
await trashPage.navigate({ waitUntil: 'domcontentloaded' });
|
||||
await trashPage.dataTable.goThroughPagesLookingForRowWithName(randomDocxDelete);
|
||||
expect(await trashPage.dataTable.isItemPresent(randomDocxDelete), 'Item should be present in Trash').toBe(true);
|
||||
});
|
||||
|
||||
@@ -130,7 +128,7 @@ test.describe('viewer action file', () => {
|
||||
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer should be opened').toBe(true);
|
||||
});
|
||||
|
||||
test('[C286379] Favorite action from Shared Files', async ({ sharedPage, favoritePage, shareAction }) => {
|
||||
test('[C286379] Favorite action from Shared Files', async ({ sharedPage, favoritePage }) => {
|
||||
await sharedPage.navigate({ waitUntil: 'domcontentloaded' });
|
||||
await sharedPage.dataTable.performClickFolderOrFileToOpen(randomDocxNameShare);
|
||||
expect(await sharedPage.viewer.isViewerOpened(), 'Viewer should be opened').toBe(true);
|
||||
@@ -146,7 +144,6 @@ test.describe('viewer action file', () => {
|
||||
await sharedPage.page.keyboard.press('Escape');
|
||||
await favoritePage.navigate({ waitUntil: 'domcontentloaded' });
|
||||
expect(await favoritePage.dataTable.isItemPresent(randomDocxNameShare), 'Item is not present in Favorites list').toBe(true);
|
||||
expect(await shareAction.isFavorite(randomDocxNameShare, 'hruser'), 'Item is not favorite').toBe(true);
|
||||
});
|
||||
|
||||
test('[C286395] Share action from Favorites', async ({ favoritePage }) => {
|
||||
|
@@ -29,7 +29,7 @@ test.use({ storageState: getUserState('hruser') });
|
||||
test.describe('viewer file', () => {
|
||||
const apiClientFactory = new ApiClientFactory();
|
||||
const randomFolderName = `playwright-folder-${Utils.random()}`;
|
||||
const randomDocxName = `${TEST_FILES.DOCX_PROTECTED.name}-${Utils.random()}`;
|
||||
const randomDocxName = `${TEST_FILES.PDF_PROTECTED.name}-${Utils.random()}`;
|
||||
let folderId: string;
|
||||
let fileDocxId: string;
|
||||
|
||||
@@ -37,7 +37,7 @@ test.describe('viewer file', () => {
|
||||
await apiClientFactory.setUpAcaBackend('hruser');
|
||||
const node = await apiClientFactory.nodes.createNode('-my-', { name: randomFolderName, nodeType: 'cm:folder', relativePath: '/' });
|
||||
folderId = node.entry.id;
|
||||
const fileDoc = await fileAction.uploadFile(TEST_FILES.DOCX_PROTECTED.path, randomDocxName, folderId);
|
||||
const fileDoc = await fileAction.uploadFile(TEST_FILES.PDF_PROTECTED.path, randomDocxName, folderId);
|
||||
fileDocxId = fileDoc.entry.id;
|
||||
await shareAction.shareFileById(fileDocxId);
|
||||
await favoritesPageAction.addFavoriteById('file', fileDocxId);
|
||||
@@ -61,7 +61,7 @@ test.describe('viewer file', () => {
|
||||
});
|
||||
|
||||
test('[C268959] File content is displayed when entering the correct password', async ({ personalFiles }) => {
|
||||
await personalFiles.passwordDialog.enterPassword(TEST_FILES.DOCX_PROTECTED.password);
|
||||
await personalFiles.passwordDialog.enterPassword(TEST_FILES.PDF_PROTECTED.password);
|
||||
expect(await personalFiles.passwordDialog.submitButton.isVisible(), 'Submit button not enabled').toBe(true);
|
||||
|
||||
await personalFiles.passwordDialog.submitButton.click();
|
||||
@@ -80,7 +80,7 @@ test.describe('viewer file', () => {
|
||||
});
|
||||
|
||||
test('[C268961] Refresh the page while Password dialog is open', async ({ personalFiles }) => {
|
||||
await personalFiles.passwordDialog.enterPassword(TEST_FILES.DOCX_PROTECTED.password);
|
||||
await personalFiles.passwordDialog.enterPassword(TEST_FILES.PDF_PROTECTED.password);
|
||||
await personalFiles.reload({ waitUntil: 'domcontentloaded' });
|
||||
await personalFiles.viewer.waitForViewerToOpen();
|
||||
|
||||
|
99
e2e/playwright/viewer/src/tests/viewer-useraction.spec.ts
Normal file
99
e2e/playwright/viewer/src/tests/viewer-useraction.spec.ts
Normal file
@@ -0,0 +1,99 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { expect } from '@playwright/test';
|
||||
import { ApiClientFactory, LoginPage, test, TEST_FILES, Utils } from '@alfresco/playwright-shared';
|
||||
import { SiteBodyCreate } from '@alfresco/js-api';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
|
||||
test.describe('from File Libraries', () => {
|
||||
const apiClientFactory = new ApiClientFactory();
|
||||
const username = `user-${Utils.random()}`;
|
||||
const siteName = `site-${Utils.random()}`;
|
||||
const destination = `destFL-${Utils.random()}`;
|
||||
let destinationId: string;
|
||||
const xlsxLibraries = `xlsxFL-${Utils.random()}`;
|
||||
|
||||
test.beforeAll(async ({ userActions }) => {
|
||||
await apiClientFactory.setUpAcaBackend('admin');
|
||||
await apiClientFactory.createUser({ username });
|
||||
await userActions.setUpUserAcaBackend(username, username);
|
||||
try {
|
||||
await userActions.sitesApi.createSite({
|
||||
id: siteName,
|
||||
title: siteName,
|
||||
visibility: SiteBodyCreate.VisibilityEnum.PUBLIC
|
||||
});
|
||||
const docLibId = (await userActions.sitesApi.listSiteContainers(siteName)).list.entries[0].entry.id;
|
||||
const node = await userActions.nodesApi.createNode('-my-', { name: destination, nodeType: 'cm:folder', relativePath: '/' });
|
||||
destinationId = node.entry.id;
|
||||
await userActions.uploadFile(TEST_FILES.XLSX.path, xlsxLibraries, docLibId);
|
||||
} catch (error) {
|
||||
Logger.error(`beforeAll failed : ${error}`);
|
||||
}
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
const loginPage = new LoginPage(page);
|
||||
await loginPage.loginUser(
|
||||
{ username: username, password: username },
|
||||
{
|
||||
withNavigation: true,
|
||||
waitForLoading: true
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
test.afterAll(async ({ userActions }) => {
|
||||
try {
|
||||
await userActions.setUpUserAcaBackend(username, username);
|
||||
await userActions.deleteSites([siteName]);
|
||||
await userActions.deleteNodes([destinationId]);
|
||||
} catch (error) {
|
||||
Logger.error(`afterAll failed : ${error}`);
|
||||
}
|
||||
});
|
||||
|
||||
test('[C286371] Move action from File Libraries', async ({ myLibrariesPage, personalFiles }) => {
|
||||
await myLibrariesPage.navigate();
|
||||
await myLibrariesPage.dataTable.getCellLinkByName(siteName).click();
|
||||
await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(xlsxLibraries);
|
||||
expect(await myLibrariesPage.viewer.isViewerOpened(), 'Viewer should be opened').toBe(true);
|
||||
|
||||
await myLibrariesPage.acaHeader.clickViewerMoreActions();
|
||||
await myLibrariesPage.matMenu.clickMenuItem('Move');
|
||||
expect(await myLibrariesPage.viewerDialog.isCopyDialogOpen(), 'Dialog is not open').toBe(true);
|
||||
|
||||
await myLibrariesPage.copyMoveDialog.selectLocation('Personal Files');
|
||||
await myLibrariesPage.copyMoveDialog.selectDestination(destination);
|
||||
await myLibrariesPage.copyMoveDialog.actionButton.click();
|
||||
await expect(myLibrariesPage.snackBar.getByMessageLocator('Moved 1 item')).toBeVisible();
|
||||
|
||||
await myLibrariesPage.viewer.closeButtonLocator.click();
|
||||
await myLibrariesPage.dataTable.getRowByName(xlsxLibraries).waitFor({ state: 'detached' });
|
||||
expect(await myLibrariesPage.dataTable.getRowByName(xlsxLibraries).isVisible(), 'Item was not moved').toBe(false);
|
||||
await personalFiles.navigate({ remoteUrl: `#/personal-files/${destinationId}` });
|
||||
expect(await personalFiles.dataTable.isItemPresent(xlsxLibraries), 'Item is not present in destination').toBe(true);
|
||||
});
|
||||
});
|
@@ -29,7 +29,7 @@ test.use({ storageState: getUserState('hruser') });
|
||||
test.describe('viewer file', () => {
|
||||
const apiClientFactory = new ApiClientFactory();
|
||||
const randomFolderName = `playwright-folder-${Utils.random()}`;
|
||||
const randomDocxName = `$(TEST_FILES.DOCX.name)-${Utils.random()}`;
|
||||
const randomDocxName = `${TEST_FILES.DOCX.name}-${Utils.random()}`;
|
||||
let folderId: string;
|
||||
|
||||
test.beforeAll(async ({ fileAction }) => {
|
||||
|
Reference in New Issue
Block a user