mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
[ACS-11233] Testing week test cases automated in ACA (#5113)
* [ACS-11233] Testing week test cases automated in ACA * [ACS-11233] last test additions from testing week * [ACS-11233] sonar fix 1 * eslint configuration for e2e tests * [ACS-11233] sonar fix 2 * [ACS-11233] sonar fix 3 * [ACS-11233] added viewer actions as a seperate test suite * [ACS-11233] added viewer actions to pr yml * [ACS-11233] deleted autocorrection * [ACS-11233] review fix 1 * [ACS-11233] review fix 2 * [ACS-11233] small test fixes and report portal upload timeout change * [ACS-11233] reportportal fix 2 * [ACS-11233] viewer tests fixes * [ACS-11233] review fix 3 * [ACS-11233] review fix 4 * [ACS-11233] deleted angular inject test 1 * [ACS-11233] viewer tests fix 3
This commit is contained in:
@@ -2,15 +2,12 @@
|
||||
"all": {
|
||||
"XAT-5501": "https://hyland.atlassian.net/browse/ACS-9889",
|
||||
"XAT-5499": "https://hyland.atlassian.net/browse/ACS-9889",
|
||||
"XAT-5465": "https://hyland.atlassian.net/browse/ACS-9889",
|
||||
"XAT-17781": "https://hyland.atlassian.net/browse/ACS-9889",
|
||||
"XAT-17181": "https://hyland.atlassian.net/browse/ACS-9889",
|
||||
"XAT-17640": "https://hyland.atlassian.net/browse/ACS-9889",
|
||||
"XAT-17644": "https://hyland.atlassian.net/browse/ACS-9889",
|
||||
"XAT-17182": "https://hyland.atlassian.net/browse/ACS-9889"
|
||||
},
|
||||
"firefox": {
|
||||
"XAT-5417": "https://hyland.atlassian.net/browse/ACS-10917",
|
||||
"XAT-17177": "https://hyland.atlassian.net/browse/ACS-10917",
|
||||
"XAT-17178": "https://hyland.atlassian.net/browse/ACS-10917",
|
||||
"XAT-17179": "https://hyland.atlassian.net/browse/ACS-10917",
|
||||
@@ -26,7 +23,6 @@
|
||||
"XAT-5510": "https://hyland.atlassian.net/browse/ACS-10917"
|
||||
},
|
||||
"webkit": {
|
||||
"XAT-5417": "https://hyland.atlassian.net/browse/ACS-10917",
|
||||
"XAT-17177": "https://hyland.atlassian.net/browse/ACS-10917",
|
||||
"XAT-17178": "https://hyland.atlassian.net/browse/ACS-10917",
|
||||
"XAT-17179": "https://hyland.atlassian.net/browse/ACS-10917",
|
||||
|
||||
@@ -1,237 +0,0 @@
|
||||
/*!
|
||||
* Copyright © 2005-2025 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, getUserState, test, TEST_FILES, timeouts, Utils } from '@alfresco/aca-playwright-shared';
|
||||
|
||||
test.use({ storageState: getUserState('hruser') });
|
||||
|
||||
test.describe('viewer action file', () => {
|
||||
const apiClientFactory = new ApiClientFactory();
|
||||
const randomFolderName = `viewer-action-${Utils.random()}`;
|
||||
const randomDocxName = `${TEST_FILES.DOCX.name}-${Utils.random()}`;
|
||||
const randomDocxNameFavorite = `${TEST_FILES.DOCX.name}-${Utils.random()}`;
|
||||
const randomDocxNameShare = `${TEST_FILES.DOCX.name}-${Utils.random()}`;
|
||||
const randomDocxDelete = `${TEST_FILES.DOCX.name}-${Utils.random()}`;
|
||||
const fileForEditOffline = `playwright-file1-${Utils.random()}.docx`;
|
||||
const fileForCancelEditing = `playwright-file2-${Utils.random()}.docx`;
|
||||
let folderId: string;
|
||||
let fileDocxShareId: string;
|
||||
let randomDocxNameFavoriteId: string;
|
||||
let fileForCancelEditingId: string;
|
||||
const filePersonalFiles = `file3-${Utils.random()}.jpg`;
|
||||
let filePersonalFilesId: string;
|
||||
const filePersonalFiles2 = TEST_FILES.JPG_FILE.name;
|
||||
const fileNewVersionLocked = `file4-${Utils.random()}.jpg`;
|
||||
const fileNewVersionLocked2 = TEST_FILES.JPG_FILE.name;
|
||||
let fileNewVersionLockedId: string;
|
||||
const destination = `viewer-action-destRF-${Utils.random()}`;
|
||||
let destinationId: string;
|
||||
const docxRecentFiles = `docxRF-${Utils.random()}.docx`;
|
||||
|
||||
test.beforeAll(async ({ fileAction, favoritesPageAction, shareAction }) => {
|
||||
await apiClientFactory.setUpAcaBackend('hruser');
|
||||
const node = await apiClientFactory.nodes.createNode('-my-', { name: randomFolderName, nodeType: 'cm:folder', relativePath: '/' });
|
||||
destinationId = (await apiClientFactory.nodes.createNode('-my-', { name: destination, nodeType: 'cm:folder', relativePath: '/' })).entry.id;
|
||||
folderId = node.entry.id;
|
||||
|
||||
fileDocxShareId = (await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxNameShare, folderId)).entry.id;
|
||||
filePersonalFilesId = (await fileAction.uploadFile(TEST_FILES.JPG_FILE.path, filePersonalFiles, folderId)).entry.id;
|
||||
fileNewVersionLockedId = (await fileAction.uploadFileWithRename(TEST_FILES.JPG_FILE.path, fileNewVersionLocked, folderId)).entry.id;
|
||||
await fileAction.uploadFileWithRename(TEST_FILES.DOCX.path, docxRecentFiles, folderId);
|
||||
await shareAction.shareFileById(fileDocxShareId);
|
||||
fileForCancelEditingId = (await fileAction.uploadFile(TEST_FILES.DOCX.path, fileForCancelEditing, folderId)).entry.id;
|
||||
await fileAction.lockNodes([fileForCancelEditingId, fileNewVersionLockedId]);
|
||||
await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxName, folderId);
|
||||
await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxDelete, folderId);
|
||||
const fileFavoritesNode = await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxNameFavorite, folderId);
|
||||
randomDocxNameFavoriteId = fileFavoritesNode.entry.id;
|
||||
await fileAction.uploadFile(TEST_FILES.DOCX.path, fileForEditOffline, folderId);
|
||||
await favoritesPageAction.addFavoriteById('file', randomDocxNameFavoriteId);
|
||||
await favoritesPageAction.isFavoriteWithRetry('hruser', randomDocxNameFavoriteId, { expect: true });
|
||||
await fileAction.isFileLockedWriteWithRetry(fileForCancelEditingId, true);
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ personalFiles }) => {
|
||||
await personalFiles.navigate({ remoteUrl: `#/personal-files/${folderId}` });
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await apiClientFactory.nodes.deleteNode(folderId, { permanent: true });
|
||||
await apiClientFactory.nodes.deleteNode(destinationId, { permanent: true });
|
||||
});
|
||||
|
||||
test('[XAT-5417] Viewer - Download action - Personal Files', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(randomDocxName);
|
||||
await personalFiles.viewer.waitForViewerToOpen();
|
||||
const downloadPromise = personalFiles.page.waitForEvent('download');
|
||||
await personalFiles.acaHeader.downloadButtonViewer.click();
|
||||
const download = await downloadPromise;
|
||||
expect(download.suggestedFilename()).toBe(randomDocxName);
|
||||
});
|
||||
|
||||
test('[XAT-5421] Viewer - Delete action - Personal Files', async ({ personalFiles, trashPage }) => {
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(randomDocxDelete);
|
||||
await personalFiles.viewer.waitForViewerToOpen();
|
||||
|
||||
await personalFiles.acaHeader.clickViewerMoreActions();
|
||||
await personalFiles.viewerDialog.deleteMenuButton.click();
|
||||
await personalFiles.snackBar.getByMessageLocator(randomDocxDelete).waitFor({ state: 'attached' });
|
||||
const deleteName = await personalFiles.snackBar.getByMessageLocator(randomDocxDelete).innerText();
|
||||
expect(deleteName).toContain(`${randomDocxDelete} deleted`);
|
||||
await personalFiles.dataTable.getCellLinkByName(randomDocxName).waitFor({ state: 'attached' });
|
||||
await expect(personalFiles.dataTable.getCellLinkByName(randomDocxDelete), 'file should not visible').toBeHidden();
|
||||
await trashPage.navigate({ waitUntil: 'domcontentloaded' });
|
||||
expect(await trashPage.dataTable.isItemPresent(randomDocxDelete), 'Item should be present in Trash').toBe(true);
|
||||
});
|
||||
|
||||
test('[XAT-5423] Viewer - Edit Offline action - Personal Files', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(fileForEditOffline);
|
||||
await personalFiles.viewer.waitForViewerToOpen();
|
||||
await personalFiles.acaHeader.clickViewerMoreActions();
|
||||
await personalFiles.matMenu.clickMenuItem('Edit Offline');
|
||||
|
||||
const downloadPromise = personalFiles.page.waitForEvent('download');
|
||||
await personalFiles.acaHeader.downloadButtonViewer.click();
|
||||
const download = await downloadPromise;
|
||||
expect(download.suggestedFilename(), 'File should found in download location').toBe(fileForEditOffline);
|
||||
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is closed after pressing Full screen').toBe(true);
|
||||
await personalFiles.acaHeader.clickViewerMoreActions();
|
||||
expect(await personalFiles.matMenu.isMenuItemVisible('Cancel Editing'), 'Cancel Editing menu should be visible').toBe(true);
|
||||
});
|
||||
|
||||
test('[XAT-5424] Viewer - Cancel Editing action - Personal Files', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(fileForCancelEditing);
|
||||
await personalFiles.viewer.waitForViewerToOpen();
|
||||
await personalFiles.acaHeader.clickViewerMoreActions();
|
||||
await personalFiles.matMenu.clickMenuItem('Cancel Editing');
|
||||
await personalFiles.acaHeader.clickViewerMoreActions();
|
||||
expect(await personalFiles.matMenu.isMenuItemVisible('Edit Offline'), 'Edit offline menu should be visible').toBe(true);
|
||||
});
|
||||
|
||||
test('[XAT-5415] Full screen action', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(randomDocxName);
|
||||
await personalFiles.viewer.waitForViewerToOpen();
|
||||
await personalFiles.acaHeader.fullScreenButton.click();
|
||||
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is closed after pressing Full screen').toBe(true);
|
||||
});
|
||||
|
||||
test('[XAT-5416] Pressing ESC in the viewer closes only the action dialog', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(randomDocxName);
|
||||
await personalFiles.viewer.waitForViewerToOpen();
|
||||
await personalFiles.acaHeader.clickViewerMoreActions();
|
||||
await personalFiles.viewerDialog.clickActionsCopy();
|
||||
expect(await personalFiles.viewerDialog.isCopyDialogOpen(), 'Dialog is not open').toBe(true);
|
||||
await personalFiles.page.keyboard.press('Escape');
|
||||
expect(await personalFiles.viewerDialog.isCopyDialogClose(), 'Dialog is not open').toBe(false);
|
||||
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer should be opened').toBe(true);
|
||||
});
|
||||
|
||||
test('[XAT-5442] 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);
|
||||
|
||||
await sharedPage.acaHeader.clickViewerMoreActions();
|
||||
|
||||
await favoritePage.viewerDialog.favoriteMenuButton.waitFor({ state: 'attached', timeout: timeouts.normal });
|
||||
await sharedPage.viewerDialog.favoriteMenuButton.click();
|
||||
await favoritePage.viewerDialog.favoriteMenuButton.waitFor({ state: 'detached', timeout: timeouts.normal });
|
||||
|
||||
await sharedPage.acaHeader.clickViewerMoreActions();
|
||||
await favoritePage.viewerDialog.removeFavoriteMenuButton.waitFor({ state: 'attached', timeout: timeouts.normal });
|
||||
await expect(sharedPage.viewerDialog.removeFavoriteMenuButton, 'Item should be remove favorite').toBeVisible();
|
||||
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);
|
||||
});
|
||||
|
||||
test('[XAT-5462] Share action from Favorites', async ({ favoritePage }) => {
|
||||
await favoritePage.navigate({ waitUntil: 'domcontentloaded' });
|
||||
await favoritePage.dataTable.performClickFolderOrFileToOpen(randomDocxNameFavorite);
|
||||
expect(await favoritePage.viewer.isViewerOpened(), 'Viewer should be opened').toBe(true);
|
||||
await favoritePage.viewer.shareButton.waitFor({ state: 'attached', timeout: timeouts.normal });
|
||||
await favoritePage.viewer.shareButton.click();
|
||||
await favoritePage.viewerDialog.shareDialogTitle.waitFor({ state: 'attached', timeout: timeouts.normal });
|
||||
await expect(favoritePage.viewerDialog.shareDialogTitle, 'Share dialog should be open').toBeVisible();
|
||||
await favoritePage.viewerDialog.shareDialogClose.click();
|
||||
await favoritePage.viewerDialog.shareDialogClose.waitFor({ state: 'detached', timeout: timeouts.large });
|
||||
await expect(favoritePage.viewerDialog.shareDialogTitle, 'Share dialog should be open').toBeHidden();
|
||||
});
|
||||
|
||||
test('[XAT-5465] Upload new version action - major', async ({ personalFiles, nodesApiAction }) => {
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(filePersonalFiles);
|
||||
await personalFiles.viewer.waitForViewerToOpen('wait for viewer content');
|
||||
|
||||
await Utils.uploadFileNewVersion(personalFiles, filePersonalFiles2, 'jpg');
|
||||
|
||||
await personalFiles.uploadNewVersionDialog.majorOption.click();
|
||||
await personalFiles.uploadNewVersionDialog.description.fill('new major version description');
|
||||
await personalFiles.uploadNewVersionDialog.uploadButton.click();
|
||||
await personalFiles.uploadNewVersionDialog.uploadButton.waitFor({ state: 'detached' });
|
||||
await expect(personalFiles.uploadNewVersionDialog.cancelButton).toHaveCount(0);
|
||||
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is not open').toBe(true);
|
||||
await Utils.waitForApiResponse(personalFiles, 'content', 200);
|
||||
|
||||
expect(await personalFiles.viewer.getFileTitle()).toContain(filePersonalFiles2);
|
||||
expect(await nodesApiAction.getNodeProperty(filePersonalFilesId, 'cm:versionType'), 'File has incorrect version type').toEqual('MAJOR');
|
||||
expect(await nodesApiAction.getNodeProperty(filePersonalFilesId, 'cm:versionLabel'), 'File has incorrect version label').toEqual('2.0');
|
||||
});
|
||||
|
||||
test('[XAT-17781] Upload new version action when node is locked', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(fileNewVersionLocked);
|
||||
await personalFiles.viewer.waitForViewerToOpen('wait for viewer content');
|
||||
|
||||
await Utils.uploadFileNewVersion(personalFiles, fileNewVersionLocked2, 'jpg');
|
||||
|
||||
await personalFiles.uploadNewVersionDialog.uploadButton.click();
|
||||
await personalFiles.uploadNewVersionDialog.uploadButton.waitFor({ state: 'detached' });
|
||||
await expect(personalFiles.uploadNewVersionDialog.cancelButton).toHaveCount(0);
|
||||
|
||||
await personalFiles.viewer.waitForViewerToOpen();
|
||||
await Utils.waitForApiResponse(personalFiles, 'content', 200);
|
||||
expect(await personalFiles.viewer.getFileTitle()).toContain(fileNewVersionLocked2);
|
||||
|
||||
await personalFiles.acaHeader.clickViewerMoreActions();
|
||||
await expect(personalFiles.matMenu.getMenuItemFromHeaderMenu('Cancel Editing'), `'Cancel Editing' button shouldn't be shown`).toBeHidden();
|
||||
await expect(personalFiles.matMenu.getMenuItemFromHeaderMenu('Edit Offline'), `'Edit Offline' should be shown`).toBeVisible();
|
||||
});
|
||||
|
||||
test('[XAT-5448] Copy action from Recent Files', async ({ recentFilesPage, personalFiles }) => {
|
||||
await recentFilesPage.navigate();
|
||||
await recentFilesPage.dataTable.performClickFolderOrFileToOpen(docxRecentFiles);
|
||||
expect(await recentFilesPage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
|
||||
|
||||
await recentFilesPage.acaHeader.clickViewerMoreActions();
|
||||
await recentFilesPage.matMenu.clickMenuItem('Copy');
|
||||
await expect(recentFilesPage.contentNodeSelector.actionButton, 'Dialog is not open').toBeVisible();
|
||||
await recentFilesPage.contentNodeSelector.selectLocation('Personal Files');
|
||||
await recentFilesPage.contentNodeSelector.selectDestination(destination);
|
||||
await recentFilesPage.contentNodeSelector.actionButton.click();
|
||||
expect(await recentFilesPage.snackBar.message.innerText()).toContain('Copied 1 item');
|
||||
await recentFilesPage.viewer.closeButtonLocator.click();
|
||||
await personalFiles.navigate({ remoteUrl: `#/personal-files/${destinationId}` });
|
||||
expect(await personalFiles.dataTable.isItemPresent(docxRecentFiles), 'Item is not present in destination').toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -81,9 +81,10 @@ test.describe('viewer file', () => {
|
||||
});
|
||||
|
||||
test('[XAT-5470] Refresh the page while Password dialog is open', async ({ personalFiles }) => {
|
||||
await personalFiles.viewer.viewerLocator.waitFor({ state: 'visible' });
|
||||
await personalFiles.passwordDialog.enterPassword(TEST_FILES.PDF_PROTECTED.password);
|
||||
await personalFiles.reload({ waitUntil: 'domcontentloaded' });
|
||||
await personalFiles.viewer.waitForViewerToOpen();
|
||||
|
||||
await personalFiles.page.waitForLoadState('networkidle');
|
||||
|
||||
expect(await personalFiles.viewer.isPdfViewerContentDisplayed(), 'file content is displayed').toBe(false);
|
||||
expect(await personalFiles.passwordDialog.isDialogOpen(), 'Password dialog not open').toBe(true);
|
||||
|
||||
@@ -60,7 +60,7 @@ test.describe('Version actions', () => {
|
||||
await page.dataTable.selectItems(filenameAfterUpdate);
|
||||
await page.acaHeader.clickMoreActions();
|
||||
await page.matMenu.clickMenuItem('Manage Versions');
|
||||
await page.manageVersionsDialog.viewFileVersion('1.0');
|
||||
await page.manageVersionsDialog.clickListActionButtonForVersion('1.0');
|
||||
await page.matMenu.clickMenuItem('View');
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ test.describe('Version actions', () => {
|
||||
test('[XAT-5497] Previous document version title should be the same in Preview mode as in Version Manager - Personal Files', async ({
|
||||
personalFiles
|
||||
}) => {
|
||||
await personalFiles.viewer.waitForViewerToOpen('wait for viewer content');
|
||||
await personalFiles.viewer.waitForViewerToOpen();
|
||||
expect(await personalFiles.viewer.getFileTitle()).toContain(filenameBeforeUpdate);
|
||||
});
|
||||
|
||||
@@ -133,7 +133,7 @@ test.describe('Version actions', () => {
|
||||
test('[XAT-5500] Previous document version title should be the same in Preview mode as in Version Manager - Recent Files', async ({
|
||||
recentFilesPage
|
||||
}) => {
|
||||
await recentFilesPage.viewer.waitForViewerToOpen('wait for viewer content');
|
||||
await recentFilesPage.viewer.waitForViewerToOpen();
|
||||
expect(await recentFilesPage.viewer.getFileTitle()).toContain(filenameBeforeUpdate);
|
||||
});
|
||||
|
||||
@@ -157,7 +157,7 @@ test.describe('Version actions', () => {
|
||||
test('[XAT-5503] Previous document version title should be the same in Preview mode as in Version Manager - Favorites', async ({
|
||||
favoritePage
|
||||
}) => {
|
||||
await favoritePage.viewer.waitForViewerToOpen('wait for viewer content');
|
||||
await favoritePage.viewer.waitForViewerToOpen();
|
||||
expect(await favoritePage.viewer.getFileTitle()).toContain(filenameBeforeUpdate);
|
||||
});
|
||||
|
||||
@@ -205,7 +205,7 @@ test.describe('Version actions', () => {
|
||||
test('[XAT-5509] Previous document version title should be the same in Preview mode as in Version Manager - Search Results', async ({
|
||||
searchPage
|
||||
}) => {
|
||||
await searchPage.viewer.waitForViewerToOpen('wait for viewer content');
|
||||
await searchPage.viewer.waitForViewerToOpen();
|
||||
expect(await searchPage.viewer.getFileTitle()).toContain(filenameBeforeUpdate);
|
||||
});
|
||||
|
||||
|
||||
@@ -38,195 +38,504 @@ import {
|
||||
} from '@alfresco/aca-playwright-shared';
|
||||
import { Site } from '@alfresco/js-api';
|
||||
|
||||
async function initializeApis(username: string): Promise<{ nodesApi: NodesApi; trashcanApi: TrashcanApi; fileActionsApi: FileActionsApi }> {
|
||||
const apiClientFactory = new ApiClientFactory();
|
||||
await apiClientFactory.setUpAcaBackend('admin');
|
||||
await apiClientFactory.createUser({ username });
|
||||
const nodesApi = await NodesApi.initialize(username, username);
|
||||
const trashcanApi = await TrashcanApi.initialize(username, username);
|
||||
const fileActionsApi = await FileActionsApi.initialize(username, username);
|
||||
return { nodesApi, trashcanApi, fileActionsApi };
|
||||
}
|
||||
|
||||
test.describe('viewer file', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
const randomDocxName = `${TEST_FILES.DOCX.name}-${Utils.random()}`;
|
||||
const randomJpgName = `${TEST_FILES.JPG_FILE.name}-${Utils.random()}`;
|
||||
const siteUser = `siteUser-${Utils.random()}`;
|
||||
const fileInSite = TEST_FILES.DOCX.name;
|
||||
const siteAdmin = `siteAdmin-${Utils.random()}`;
|
||||
const fileAdmin = TEST_FILES.XLSX.name;
|
||||
let fileAdminId: string;
|
||||
let docLibId: string;
|
||||
let docLibSiteUserId: string;
|
||||
let folderId: string;
|
||||
let fileDocxId: string;
|
||||
let fileJpgId: string;
|
||||
let nodesApi: NodesApi;
|
||||
let trashcanApi: TrashcanApi;
|
||||
let siteActionsAdmin: SitesApi;
|
||||
let siteActionsUser: SitesApi;
|
||||
test.describe('Open viewer from Personal Files', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
const randomDocxName = `${TEST_FILES.DOCX.name}-${Utils.random()}`;
|
||||
let folderViewerId: string;
|
||||
let nodesApiViewer: NodesApi;
|
||||
let trashcanApiViewer: TrashcanApi;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
test.setTimeout(timeouts.extendedTest);
|
||||
const randomFolderName = `viewer-${Utils.random()}`;
|
||||
const apiClientFactory = new ApiClientFactory();
|
||||
await apiClientFactory.setUpAcaBackend('admin');
|
||||
try {
|
||||
await apiClientFactory.createUser({ username });
|
||||
} catch (exception) {
|
||||
if (JSON.parse(exception.message).error.statusCode !== 409) {
|
||||
throw new Error(`----- beforeAll failed : ${exception}`);
|
||||
test.beforeAll(async () => {
|
||||
try {
|
||||
const apis = await initializeApis(username);
|
||||
nodesApiViewer = apis.nodesApi;
|
||||
trashcanApiViewer = apis.trashcanApi;
|
||||
const { fileActionsApi } = apis;
|
||||
folderViewerId = (await nodesApiViewer.createFolder(`viewer-${Utils.random()}`)).entry.id;
|
||||
await fileActionsApi.uploadFile(TEST_FILES.DOCX.path, randomDocxName, folderViewerId);
|
||||
await fileActionsApi.waitForNodes(randomDocxName, { expect: 1 });
|
||||
} catch (error) {
|
||||
console.error(`beforeAll failed: ${error}`);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
nodesApi = await NodesApi.initialize(username, username);
|
||||
const fileActionApi = await FileActionsApi.initialize(username, username);
|
||||
trashcanApi = await TrashcanApi.initialize(username, username);
|
||||
const shareActions = await SharedLinksApi.initialize(username, username);
|
||||
const favoritesActions = await FavoritesPageApi.initialize(username, username);
|
||||
siteActionsUser = await SitesApi.initialize(username, username);
|
||||
siteActionsAdmin = await SitesApi.initialize('admin');
|
||||
const fileActionApiAdmin = await FileActionsApi.initialize('admin');
|
||||
const node = await nodesApi.createFolder(randomFolderName);
|
||||
folderId = node.entry.id;
|
||||
const fileDoc = await fileActionApi.uploadFile(TEST_FILES.DOCX.path, randomDocxName, folderId);
|
||||
fileDocxId = fileDoc.entry.id;
|
||||
const fileJpg = await fileActionApi.uploadFile(TEST_FILES.JPG_FILE.path, randomJpgName, folderId);
|
||||
fileJpgId = fileJpg.entry.id;
|
||||
const consumerFavoritesTotalItems = await favoritesActions.getFavoritesTotalItems(username);
|
||||
await shareActions.shareFileById(fileDocxId);
|
||||
await favoritesActions.addFavoriteById('file', fileDocxId);
|
||||
});
|
||||
|
||||
try {
|
||||
await siteActionsAdmin.createSite(siteAdmin, Site.VisibilityEnum.PRIVATE);
|
||||
} catch (exception) {
|
||||
if (JSON.parse(exception.message).error.statusCode !== 409) {
|
||||
throw new Error(`----- beforeAll failed : ${exception}`);
|
||||
test.beforeEach(async ({ personalFiles, loginPage }) => {
|
||||
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed');
|
||||
await personalFiles.navigate({ remoteUrl: `#/personal-files/${folderViewerId}` });
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApiViewer, trashcanApiViewer, 'afterAll failed');
|
||||
});
|
||||
|
||||
test('[XAT-5471] Viewer opens on double clicking on a file from Personal Files', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(randomDocxName);
|
||||
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
|
||||
});
|
||||
|
||||
test('[XAT-5472] Viewer opens when clicking the View action for a file', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.getRowByName(randomDocxName).click();
|
||||
await personalFiles.acaHeader.viewButton.click();
|
||||
await personalFiles.dataTable.spinnerWaitForReload();
|
||||
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
|
||||
});
|
||||
|
||||
test('[XAT-5473] The viewer general elements are displayed correctly', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(randomDocxName);
|
||||
expect(await personalFiles.viewer.isViewerOpened()).toBe(true);
|
||||
await personalFiles.dataTable.spinnerWaitForReload();
|
||||
expect(await personalFiles.viewer.isCloseButtonDisplayed(), 'Close button is not displayed').toBe(true);
|
||||
expect(await personalFiles.viewer.isFileTitleDisplayed(), 'File title is not displayed').toBe(true);
|
||||
});
|
||||
|
||||
test('[XAT-5474] 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();
|
||||
await expect(personalFiles.dataTable.getCellLinkByName(randomDocxName), 'Viewer did not close').toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Navigate between files', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
const file1 = `file-${Utils.random()}.txt`;
|
||||
const file2 = `file2-${Utils.random()}.txt`;
|
||||
const file3 = `file3-${Utils.random()}.txt`;
|
||||
let folder2Id: string;
|
||||
let folder3Id: string;
|
||||
let nodesApi: NodesApi;
|
||||
let trashcanApi: TrashcanApi;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
try {
|
||||
const apis = await initializeApis(username);
|
||||
nodesApi = apis.nodesApi;
|
||||
trashcanApi = apis.trashcanApi;
|
||||
folder2Id = (await nodesApi.createFolder(`viewer2-${Utils.random()}`)).entry.id;
|
||||
folder3Id = (await nodesApi.createFolder(`viewer3-${Utils.random()}`)).entry.id;
|
||||
await nodesApi.createFile(file1, folder2Id);
|
||||
await nodesApi.createFile(file2, folder2Id);
|
||||
await nodesApi.createFile(file3, folder3Id);
|
||||
} catch (error) {
|
||||
console.error(`beforeAll failed: ${error}`);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
docLibId = await siteActionsAdmin.getDocLibId(siteAdmin);
|
||||
test.beforeEach(async ({ loginPage }) => {
|
||||
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed');
|
||||
});
|
||||
|
||||
try {
|
||||
fileAdminId = (await fileActionApiAdmin.uploadFile(TEST_FILES.DOCX.path, fileAdmin, docLibId)).entry.id;
|
||||
} catch (exception) {
|
||||
if (JSON.parse(exception.message).error.statusCode !== 409) {
|
||||
throw new Error(`----- beforeAll failed : ${exception}`);
|
||||
test.afterAll(async () => {
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed');
|
||||
});
|
||||
|
||||
test('[XAT-5408] Next / Previous File buttons are displayed and work when viewer is opened for a file from a list of files', async ({
|
||||
personalFiles
|
||||
}) => {
|
||||
await personalFiles.navigate({ remoteUrl: `#/personal-files/${folder2Id}` });
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(file1);
|
||||
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
|
||||
expect(await personalFiles.viewer.fileTitleButtonLocator.textContent()).toContain(file1);
|
||||
await personalFiles.viewer.nextFileButton.or(personalFiles.viewer.previousFileButton).first().click();
|
||||
await personalFiles.viewer.waitForViewerLoaderToFinish();
|
||||
expect(await personalFiles.viewer.fileTitleButtonLocator.textContent()).not.toContain(file1);
|
||||
await personalFiles.viewer.nextFileButton.or(personalFiles.viewer.previousFileButton).first().click();
|
||||
await personalFiles.viewer.waitForViewerLoaderToFinish();
|
||||
expect(await personalFiles.viewer.fileTitleButtonLocator.textContent()).toContain(file1);
|
||||
});
|
||||
|
||||
test('[XAT-5409] Previous File button is not displayed when file is first in the list', async ({ personalFiles }) => {
|
||||
await personalFiles.navigate({ remoteUrl: `#/personal-files/${folder2Id}` });
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(file1);
|
||||
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
|
||||
if (await personalFiles.viewer.previousFileButton.isVisible()) {
|
||||
await personalFiles.viewer.previousFileButton.click();
|
||||
await personalFiles.viewer.waitForViewerLoaderToFinish();
|
||||
}
|
||||
}
|
||||
await expect(personalFiles.viewer.nextFileButton).toBeVisible();
|
||||
await expect(personalFiles.viewer.previousFileButton).toBeHidden();
|
||||
});
|
||||
|
||||
try {
|
||||
await siteActionsUser.createSite(siteUser, Site.VisibilityEnum.PUBLIC);
|
||||
} catch (exception) {
|
||||
if (JSON.parse(exception.message).error.statusCode !== 409) {
|
||||
throw new Error(`----- beforeAll failed : ${exception}`);
|
||||
test('[XAT-5410] Next File button is not displayed when file is last in the list view', async ({ personalFiles }) => {
|
||||
await personalFiles.navigate({ remoteUrl: `#/personal-files/${folder2Id}` });
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(file1);
|
||||
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
|
||||
if (await personalFiles.viewer.nextFileButton.isVisible()) {
|
||||
await personalFiles.viewer.nextFileButton.click();
|
||||
await personalFiles.viewer.waitForViewerLoaderToFinish();
|
||||
}
|
||||
}
|
||||
await expect(personalFiles.viewer.previousFileButton).toBeVisible();
|
||||
await expect(personalFiles.viewer.nextFileButton).toBeHidden();
|
||||
});
|
||||
|
||||
docLibSiteUserId = await siteActionsUser.getDocLibId(siteUser);
|
||||
test('[XAT-5411] Next / Previous File buttons are not displayed when no other files', async ({ personalFiles }) => {
|
||||
await personalFiles.navigate({ remoteUrl: `#/personal-files/${folder3Id}` });
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(file3);
|
||||
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
|
||||
await expect(personalFiles.viewer.fileTitleButtonLocator).toBeVisible();
|
||||
await expect(personalFiles.viewer.previousFileButton).toBeHidden();
|
||||
await expect(personalFiles.viewer.nextFileButton).toBeHidden();
|
||||
});
|
||||
});
|
||||
|
||||
try {
|
||||
await fileActionApi.uploadFile(TEST_FILES.DOCX.path, fileInSite, docLibSiteUserId);
|
||||
} catch (exception) {
|
||||
if (JSON.parse(exception.message).error.statusCode !== 409) {
|
||||
throw new Error(`----- beforeAll failed : ${exception}`);
|
||||
test.describe('Navigate between files - permissions', () => {
|
||||
const username1 = `user1-${Utils.random()}`;
|
||||
const username2 = `user2-${Utils.random()}`;
|
||||
const file1 = `file-${Utils.random()}.txt`;
|
||||
const file2 = `file2-${Utils.random()}.txt`;
|
||||
const file3 = `file3-${Utils.random()}.txt`;
|
||||
let folderId: string;
|
||||
let nodesApi1: NodesApi;
|
||||
let trashcanApi1: TrashcanApi;
|
||||
let sitesApi1: SitesApi;
|
||||
let site1Id: string;
|
||||
let user2Id: string;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
try {
|
||||
const apiClientFactory = new ApiClientFactory();
|
||||
await apiClientFactory.setUpAcaBackend('admin');
|
||||
await apiClientFactory.createUser({ username: username1 });
|
||||
user2Id = (await apiClientFactory.createUser({ username: username2 })).entry.id;
|
||||
nodesApi1 = await NodesApi.initialize(username1, username1);
|
||||
trashcanApi1 = await TrashcanApi.initialize(username1, username1);
|
||||
sitesApi1 = await SitesApi.initialize(username1, username1);
|
||||
site1Id = (await sitesApi1.createSite(`viewer-site-${Utils.random()}`, 'PRIVATE')).entry.id;
|
||||
const site1DocLibId = await sitesApi1.getDocLibId(site1Id);
|
||||
await sitesApi1.addSiteMember(site1Id, user2Id, 'SiteConsumer');
|
||||
folderId = (await nodesApi1.createFolder(`viewer-permissions-${Utils.random()}`, site1DocLibId)).entry.id;
|
||||
await nodesApi1.createFile(file1, folderId);
|
||||
await nodesApi1.createFile(file2, folderId);
|
||||
await nodesApi1.createFile(file3, folderId);
|
||||
} catch (error) {
|
||||
console.error(`beforeAll failed: ${error}`);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
await Promise.all([
|
||||
favoritesActions.isFavoriteWithRetry(username, fileDocxId, { expect: true }),
|
||||
favoritesActions.waitForApi(username, { expect: consumerFavoritesTotalItems + 2 })
|
||||
]);
|
||||
await shareActions.waitForFilesToBeShared([fileDocxId]);
|
||||
await fileActionApi.waitForNodes(randomDocxName, { expect: 1 });
|
||||
test.beforeEach(async ({ loginPage }) => {
|
||||
await Utils.tryLoginUser(loginPage, username2, username2, 'beforeEach failed');
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi1, trashcanApi1, 'afterAll failed');
|
||||
await sitesApi1.deleteSites([site1Id]);
|
||||
});
|
||||
|
||||
test('[XAT-5412] Next/Previous File buttons when user has insufficient permissions', async ({ personalFiles }) => {
|
||||
await personalFiles.navigate({ remoteUrl: `#/libraries/${folderId}` });
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(file2);
|
||||
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
|
||||
await expect(personalFiles.viewer.fileTitleButtonLocator).toBeVisible();
|
||||
await expect(personalFiles.viewer.previousFileButton.or(personalFiles.viewer.nextFileButton).first()).toBeVisible();
|
||||
await sitesApi1.deleteSiteMember(site1Id, user2Id);
|
||||
await personalFiles.viewer.previousFileButton.or(personalFiles.viewer.nextFileButton).first().click();
|
||||
await expect(personalFiles.viewer.noPermissionsView.or(personalFiles.dataTable.noPermissionsView)).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ personalFiles, loginPage }) => {
|
||||
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed');
|
||||
await personalFiles.navigate({ remoteUrl: `#/personal-files/${folderId}` });
|
||||
test.describe('Open viewer via preview URL', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
const randomJpgName = `${TEST_FILES.JPG_FILE.name}-${Utils.random()}`;
|
||||
let folderId: string;
|
||||
let fileJpgId: string;
|
||||
let nodesApi: NodesApi;
|
||||
let trashcanApi: TrashcanApi;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
try {
|
||||
const apis = await initializeApis(username);
|
||||
nodesApi = apis.nodesApi;
|
||||
trashcanApi = apis.trashcanApi;
|
||||
const { fileActionsApi } = apis;
|
||||
folderId = (await nodesApi.createFolder(`viewer-${Utils.random()}`)).entry.id;
|
||||
fileJpgId = (await fileActionsApi.uploadFile(TEST_FILES.JPG_FILE.path, randomJpgName, folderId)).entry.id;
|
||||
} catch (error) {
|
||||
console.error(`beforeAll failed: ${error}`);
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ loginPage }) => {
|
||||
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed');
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed');
|
||||
});
|
||||
|
||||
test('[XAT-5476] Viewer opens when accessing the preview URL for a file', async ({ personalFiles }) => {
|
||||
const previewURL = `#/personal-files/${folderId}/(viewer:view/${fileJpgId})`;
|
||||
await personalFiles.navigate({ remoteUrl: previewURL });
|
||||
await personalFiles.viewer.waitForViewerLoaderToFinish(timeouts.fortySeconds);
|
||||
await expect(personalFiles.viewer.fileTitleButtonLocator).toContainText(randomJpgName);
|
||||
});
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed', siteActionsUser, [docLibSiteUserId]);
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed', siteActionsAdmin, [docLibId]);
|
||||
test.describe('Open viewer from Recent Files', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
const randomDocxName = `${TEST_FILES.DOCX.name}-${Utils.random()}`;
|
||||
let folderRecentId: string;
|
||||
let nodesApiRecent: NodesApi;
|
||||
let trashcanApiRecent: TrashcanApi;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
try {
|
||||
const apis = await initializeApis(username);
|
||||
nodesApiRecent = apis.nodesApi;
|
||||
trashcanApiRecent = apis.trashcanApi;
|
||||
const { fileActionsApi } = apis;
|
||||
folderRecentId = (await nodesApiRecent.createFolder(`viewer-${Utils.random()}`)).entry.id;
|
||||
await fileActionsApi.uploadFile(TEST_FILES.DOCX.path, randomDocxName, folderRecentId);
|
||||
await fileActionsApi.waitForNodes(randomDocxName, { expect: 1 });
|
||||
} catch (error) {
|
||||
console.error(`beforeAll failed: ${error}`);
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ personalFiles, loginPage }) => {
|
||||
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed');
|
||||
await personalFiles.navigate({ remoteUrl: `#/personal-files/${folderRecentId}` });
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApiRecent, trashcanApiRecent, 'afterAll failed');
|
||||
});
|
||||
|
||||
test('[XAT-5479] Viewer opens for a file from Recent Files', async ({ personalFiles, recentFilesPage }) => {
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(randomDocxName);
|
||||
expect(await personalFiles.viewer.getCloseButtonTooltip()).toEqual('Close');
|
||||
await recentFilesPage.navigate();
|
||||
await recentFilesPage.reload();
|
||||
await recentFilesPage.dataTable.performClickFolderOrFileToOpen(randomDocxName);
|
||||
expect(await recentFilesPage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
|
||||
expect(await recentFilesPage.viewer.isCloseButtonDisplayed(), 'Close button is not displayed').toBe(true);
|
||||
expect(await recentFilesPage.viewer.isFileTitleDisplayed(), 'File title is not displayed').toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
test('[XAT-5471] Viewer opens on double clicking on a file from Personal Files', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(randomDocxName);
|
||||
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
|
||||
test.describe('Open viewer from Search Results', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
const randomDocxName = `${TEST_FILES.DOCX.name}-${Utils.random()}`;
|
||||
let nodesApi: NodesApi;
|
||||
let trashcanApi: TrashcanApi;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
try {
|
||||
const apis = await initializeApis(username);
|
||||
nodesApi = apis.nodesApi;
|
||||
trashcanApi = apis.trashcanApi;
|
||||
const { fileActionsApi } = apis;
|
||||
const folderId = (await nodesApi.createFolder(`viewer-${Utils.random()}`)).entry.id;
|
||||
await fileActionsApi.uploadFile(TEST_FILES.DOCX.path, randomDocxName, folderId);
|
||||
await fileActionsApi.waitForNodes(randomDocxName, { expect: 1 });
|
||||
} catch (error) {
|
||||
console.error(`beforeAll failed: ${error}`);
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ loginPage }) => {
|
||||
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed');
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed');
|
||||
});
|
||||
|
||||
test('[XAT-5482] Viewer opens for a file from Search Results', async ({ searchPage }) => {
|
||||
await searchPage.searchWithin(randomDocxName, 'filesAndFolders');
|
||||
await searchPage.dataTable.goThroughPagesLookingForRowWithName(randomDocxName);
|
||||
await searchPage.dataTable.performClickFolderOrFileToOpen(randomDocxName);
|
||||
expect(await searchPage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
|
||||
expect(await searchPage.viewer.isCloseButtonDisplayed(), 'Close button is not displayed').toBe(true);
|
||||
expect(await searchPage.viewer.isFileTitleDisplayed(), 'File title is not displayed').toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
test('[XAT-5472] Viewer opens when clicking the View action for a file', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.getRowByName(randomDocxName).click();
|
||||
await personalFiles.acaHeader.viewButton.click();
|
||||
await personalFiles.dataTable.spinnerWaitForReload();
|
||||
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
|
||||
test.describe('Open viewer from Shared Files', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
const randomDocxName = `${TEST_FILES.DOCX.name}-${Utils.random()}`;
|
||||
let nodesApi: NodesApi;
|
||||
let trashcanApi: TrashcanApi;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
try {
|
||||
const apis = await initializeApis(username);
|
||||
nodesApi = apis.nodesApi;
|
||||
trashcanApi = apis.trashcanApi;
|
||||
const { fileActionsApi } = apis;
|
||||
const shareActions = await SharedLinksApi.initialize(username, username);
|
||||
const folderId = (await nodesApi.createFolder(`viewer-${Utils.random()}`)).entry.id;
|
||||
const fileDocxId = (await fileActionsApi.uploadFile(TEST_FILES.DOCX.path, randomDocxName, folderId)).entry.id;
|
||||
await shareActions.shareFileById(fileDocxId);
|
||||
await shareActions.waitForFilesToBeShared([fileDocxId]);
|
||||
} catch (error) {
|
||||
console.error(`beforeAll failed: ${error}`);
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ loginPage }) => {
|
||||
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed');
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed');
|
||||
});
|
||||
|
||||
test('[XAT-5480] Viewer opens for a file from Shared Files', async ({ sharedPage }) => {
|
||||
await sharedPage.navigate();
|
||||
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);
|
||||
expect(await sharedPage.viewer.isCloseButtonDisplayed(), 'Close button is not displayed').toBe(true);
|
||||
expect(await sharedPage.viewer.isFileTitleDisplayed(), 'File title is not displayed').toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
test('[XAT-5473] The viewer general elements are displayed correctly', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(randomDocxName);
|
||||
expect(await personalFiles.viewer.isViewerOpened()).toBe(true);
|
||||
await personalFiles.dataTable.spinnerWaitForReload();
|
||||
expect(await personalFiles.viewer.isCloseButtonDisplayed(), 'Close button is not displayed').toBe(true);
|
||||
expect(await personalFiles.viewer.isFileTitleDisplayed(), 'File title is not displayed').toBe(true);
|
||||
test.describe('Open viewer from Favorites', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
const randomDocxName = `${TEST_FILES.DOCX.name}-${Utils.random()}`;
|
||||
let nodesApi: NodesApi;
|
||||
let trashcanApi: TrashcanApi;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
try {
|
||||
const apis = await initializeApis(username);
|
||||
nodesApi = apis.nodesApi;
|
||||
trashcanApi = apis.trashcanApi;
|
||||
const { fileActionsApi } = apis;
|
||||
const favoritesActions = await FavoritesPageApi.initialize(username, username);
|
||||
const folderId = (await nodesApi.createFolder(`viewer-${Utils.random()}`)).entry.id;
|
||||
const fileDocxId = (await fileActionsApi.uploadFile(TEST_FILES.DOCX.path, randomDocxName, folderId)).entry.id;
|
||||
const consumerFavoritesTotalItems = await favoritesActions.getFavoritesTotalItems(username);
|
||||
await favoritesActions.addFavoriteById('file', fileDocxId);
|
||||
await Promise.all([
|
||||
favoritesActions.isFavoriteWithRetry(username, fileDocxId, { expect: true }),
|
||||
favoritesActions.waitForApi(username, { expect: consumerFavoritesTotalItems + 1 })
|
||||
]);
|
||||
} catch (error) {
|
||||
console.error(`beforeAll failed: ${error}`);
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ loginPage }) => {
|
||||
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed');
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed');
|
||||
});
|
||||
|
||||
test('[XAT-5481] Viewer opens for a file from Favorites', async ({ favoritePage }) => {
|
||||
await favoritePage.navigate({ waitUntil: 'domcontentloaded' });
|
||||
await favoritePage.dataTable.goThroughPagesLookingForRowWithName(randomDocxName);
|
||||
await favoritePage.dataTable.performClickFolderOrFileToOpen(randomDocxName);
|
||||
expect(await favoritePage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
|
||||
expect(await favoritePage.viewer.isCloseButtonDisplayed(), 'Close button is not displayed').toBe(true);
|
||||
expect(await favoritePage.viewer.isFileTitleDisplayed(), 'File title is not displayed').toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
test('[XAT-5474] 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();
|
||||
await expect(personalFiles.dataTable.getCellLinkByName(randomDocxName), 'Viewer did not close').toBeVisible();
|
||||
test.describe('Viewer does not open without permissions', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
const siteAdmin = `siteAdmin-${Utils.random()}`;
|
||||
const fileAdmin = TEST_FILES.XLSX.name;
|
||||
let docLibId: string;
|
||||
let fileAdminId: string;
|
||||
let nodesApi: NodesApi;
|
||||
let trashcanApi: TrashcanApi;
|
||||
let siteActionsAdmin: SitesApi;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
try {
|
||||
const apis = await initializeApis(username);
|
||||
nodesApi = apis.nodesApi;
|
||||
trashcanApi = apis.trashcanApi;
|
||||
siteActionsAdmin = await SitesApi.initialize('admin');
|
||||
const fileActionsApiAdmin = await FileActionsApi.initialize('admin');
|
||||
await siteActionsAdmin.createSite(siteAdmin, Site.VisibilityEnum.PRIVATE);
|
||||
docLibId = await siteActionsAdmin.getDocLibId(siteAdmin);
|
||||
fileAdminId = (await fileActionsApiAdmin.uploadFile(TEST_FILES.DOCX.path, fileAdmin, docLibId)).entry.id;
|
||||
} catch (error) {
|
||||
console.error(`beforeAll failed: ${error}`);
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ loginPage }) => {
|
||||
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed');
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed', siteActionsAdmin, [docLibId]);
|
||||
});
|
||||
|
||||
test('[XAT-5477] Viewer does not open when accessing the preview URL for a file without permissions', async ({ personalFiles }) => {
|
||||
const previewURL = `#/libraries/${docLibId}/(viewer:view/${fileAdminId})`;
|
||||
await personalFiles.navigate({ remoteUrl: `${previewURL}` });
|
||||
await expect(personalFiles.viewer.viewerLocator, 'Viewer should not be opened!').toBeHidden();
|
||||
});
|
||||
});
|
||||
|
||||
test('[XAT-5479] Viewer opens for a file from Recent Files', async ({ personalFiles, recentFilesPage }) => {
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(randomDocxName);
|
||||
expect(await personalFiles.viewer.getCloseButtonTooltip()).toEqual('Close');
|
||||
await recentFilesPage.navigate();
|
||||
await recentFilesPage.reload();
|
||||
await recentFilesPage.dataTable.performClickFolderOrFileToOpen(randomDocxName);
|
||||
expect(await recentFilesPage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
|
||||
expect(await recentFilesPage.viewer.isCloseButtonDisplayed(), 'Close button is not displayed').toBe(true);
|
||||
expect(await recentFilesPage.viewer.isFileTitleDisplayed(), 'File title is not displayed').toBe(true);
|
||||
});
|
||||
test.describe('Open viewer from File Libraries', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
const siteUser = `siteUser-${Utils.random()}`;
|
||||
const fileInSite = TEST_FILES.DOCX.name;
|
||||
let docLibSiteUserId: string;
|
||||
let nodesApi: NodesApi;
|
||||
let trashcanApi: TrashcanApi;
|
||||
let siteActionsUser: SitesApi;
|
||||
|
||||
test('[XAT-5482] Viewer opens for a file from Search Results', async ({ searchPage }) => {
|
||||
await searchPage.searchWithin(randomDocxName, 'filesAndFolders');
|
||||
await searchPage.dataTable.goThroughPagesLookingForRowWithName(randomDocxName);
|
||||
await searchPage.dataTable.performClickFolderOrFileToOpen(randomDocxName);
|
||||
expect(await searchPage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
|
||||
expect(await searchPage.viewer.isCloseButtonDisplayed(), 'Close button is not displayed').toBe(true);
|
||||
expect(await searchPage.viewer.isFileTitleDisplayed(), 'File title is not displayed').toBe(true);
|
||||
});
|
||||
test.beforeAll(async () => {
|
||||
try {
|
||||
const apis = await initializeApis(username);
|
||||
nodesApi = apis.nodesApi;
|
||||
trashcanApi = apis.trashcanApi;
|
||||
const { fileActionsApi } = apis;
|
||||
siteActionsUser = await SitesApi.initialize(username, username);
|
||||
await siteActionsUser.createSite(siteUser, Site.VisibilityEnum.PUBLIC);
|
||||
docLibSiteUserId = await siteActionsUser.getDocLibId(siteUser);
|
||||
await fileActionsApi.uploadFile(TEST_FILES.DOCX.path, fileInSite, docLibSiteUserId);
|
||||
} catch (error) {
|
||||
console.error(`beforeAll failed: ${error}`);
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
|
||||
test('[XAT-5476] Viewer opens when accessing the preview URL for a file', async ({ personalFiles }) => {
|
||||
const previewURL = `#/personal-files/${folderId}/(viewer:view/${fileJpgId})`;
|
||||
await personalFiles.navigate({ remoteUrl: previewURL });
|
||||
await personalFiles.viewer.waitForViewerLoaderToFinish(timeouts.fortySeconds);
|
||||
await expect(personalFiles.viewer.fileTitleButtonLocator).toContainText(randomJpgName);
|
||||
});
|
||||
test.beforeEach(async ({ loginPage }) => {
|
||||
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed');
|
||||
});
|
||||
|
||||
test('[XAT-5480] Viewer opens for a file from Shared Files', async ({ sharedPage }) => {
|
||||
await sharedPage.navigate();
|
||||
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);
|
||||
expect(await sharedPage.viewer.isCloseButtonDisplayed(), 'Close button is not displayed').toBe(true);
|
||||
expect(await sharedPage.viewer.isFileTitleDisplayed(), 'File title is not displayed').toBe(true);
|
||||
});
|
||||
test.afterAll(async () => {
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed', siteActionsUser, [docLibSiteUserId]);
|
||||
});
|
||||
|
||||
test('[XAT-5481] Viewer opens for a file from Favorites', async ({ favoritePage }) => {
|
||||
await favoritePage.navigate({ waitUntil: 'domcontentloaded' });
|
||||
await favoritePage.dataTable.goThroughPagesLookingForRowWithName(randomDocxName);
|
||||
await favoritePage.dataTable.performClickFolderOrFileToOpen(randomDocxName);
|
||||
expect(await favoritePage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
|
||||
expect(await favoritePage.viewer.isCloseButtonDisplayed(), 'Close button is not displayed').toBe(true);
|
||||
expect(await favoritePage.viewer.isFileTitleDisplayed(), 'File title is not displayed').toBe(true);
|
||||
});
|
||||
|
||||
test('[XAT-5477] Viewer does not open when accessing the preview URL for a file without permissions', async ({ personalFiles }) => {
|
||||
const previewURL = `#/libraries/${docLibId}/(viewer:view/${fileAdminId})`;
|
||||
await personalFiles.navigate({ remoteUrl: `${previewURL}` });
|
||||
await expect(personalFiles.viewer.viewerLocator, 'Viewer should not be opened!').toBeHidden();
|
||||
});
|
||||
|
||||
test('[XAT-5478] Viewer opens for a file from File Libraries', async ({ myLibrariesPage }) => {
|
||||
await myLibrariesPage.navigate();
|
||||
await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(siteUser);
|
||||
await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(fileInSite);
|
||||
expect(await myLibrariesPage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
|
||||
expect(await myLibrariesPage.viewer.isCloseButtonDisplayed(), 'Close button is not displayed').toBe(true);
|
||||
expect(await myLibrariesPage.viewer.isFileTitleDisplayed(), 'File title is not displayed').toBe(true);
|
||||
test('[XAT-5478] Viewer opens for a file from File Libraries', async ({ myLibrariesPage }) => {
|
||||
await myLibrariesPage.navigate();
|
||||
await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(siteUser);
|
||||
await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(fileInSite);
|
||||
expect(await myLibrariesPage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
|
||||
expect(await myLibrariesPage.viewer.isCloseButtonDisplayed(), 'Close button is not displayed').toBe(true);
|
||||
expect(await myLibrariesPage.viewer.isFileTitleDisplayed(), 'File title is not displayed').toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user