mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACS-5639] fix viewer exclude test from protractor and playwright (#3443)
* [ACS-5923] sidenav and singleclick test * remove protractor test and fix flaky test * test fix * [ACS-5639] fix exclude test in viewer * remove exclude test and fix test
This commit is contained in:
@@ -64,7 +64,6 @@ describe('Viewer actions', () => {
|
||||
const userActions = new UserActions();
|
||||
|
||||
const uploadFilesDialog = new UploadFilesDialog();
|
||||
const downloadButton = element(By.css(`button[id='app.viewer.download']`));
|
||||
const shareButton = element(By.css(`adf-viewer [data-automation-id="share-action-button"]`));
|
||||
|
||||
beforeAll(async () => {
|
||||
@@ -85,8 +84,6 @@ describe('Viewer actions', () => {
|
||||
const filePersonalFiles = docxFile2;
|
||||
let filePersonalFilesId: string;
|
||||
|
||||
const fileForEditOffline = `file1-${Utils.random()}.docx`;
|
||||
let fileForEditOfflineId: string;
|
||||
const fileForCancelEditing = `file2-${Utils.random()}.docx`;
|
||||
let fileForCancelEditingId: string;
|
||||
const fileForUploadNewVersion = `file3-${Utils.random()}.docx`;
|
||||
@@ -105,7 +102,6 @@ describe('Viewer actions', () => {
|
||||
await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxPersonalFiles);
|
||||
await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfPersonalFiles);
|
||||
|
||||
fileForEditOfflineId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForEditOffline)).entry.id;
|
||||
fileForCancelEditingId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForCancelEditing)).entry.id;
|
||||
fileForUploadNewVersionId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForUploadNewVersion)).entry.id;
|
||||
fileForUploadNewVersionId2 = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForUploadNewVersion2)).entry.id;
|
||||
@@ -142,37 +138,6 @@ describe('Viewer actions', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('[C268129] Download action', async () => {
|
||||
await dataTable.doubleClickOnRowByName(docxPersonalFiles);
|
||||
await viewer.waitForViewerToOpen();
|
||||
|
||||
await downloadButton.click();
|
||||
|
||||
expect(await Utils.fileExistsOnOS(docxPersonalFiles)).toBe(true, 'File not found in download location');
|
||||
});
|
||||
|
||||
it('[C268133] Delete action', async () => {
|
||||
await dataTable.doubleClickOnRowByName(pdfPersonalFiles);
|
||||
await viewer.waitForViewerToOpen();
|
||||
|
||||
await toolbar.clickMoreActionsDelete();
|
||||
expect(await page.getSnackBarMessage()).toContain(`${pdfPersonalFiles} deleted`);
|
||||
expect(await viewer.isViewerOpened()).toBe(false, 'Viewer is opened');
|
||||
await Utils.pressEscape();
|
||||
await page.clickTrashAndWait();
|
||||
expect(await dataTable.isItemPresent(pdfPersonalFiles)).toBe(true, 'Item is not present in Trash');
|
||||
});
|
||||
|
||||
it('[C297584] Edit Offline action', async () => {
|
||||
await dataTable.doubleClickOnRowByName(fileForEditOffline);
|
||||
await viewer.waitForViewerToOpen();
|
||||
await toolbar.clickMoreActionsEditOffline();
|
||||
|
||||
expect(await Utils.fileExistsOnOS(fileForEditOffline)).toBe(true, 'File not found in download location');
|
||||
expect(await apis.user.nodes.isFileLockedWrite(fileForEditOfflineId)).toBe(true, `${fileForEditOffline} is not locked`);
|
||||
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
|
||||
});
|
||||
|
||||
it('[C297585] Cancel Editing action', async () => {
|
||||
await dataTable.doubleClickOnRowByName(fileForCancelEditing);
|
||||
await viewer.waitForViewerToOpen();
|
||||
@@ -216,106 +181,6 @@ describe('Viewer actions', () => {
|
||||
expect(await toolbar.menu.cancelEditingAction.isPresent()).toBe(false, `'Cancel Editing' button shouldn't be shown`);
|
||||
expect(await toolbar.menu.editOfflineAction.isPresent()).toBe(true, `'Edit Offline' should be shown`);
|
||||
});
|
||||
|
||||
it('[C279282] Full screen action', async () => {
|
||||
await dataTable.doubleClickOnRowByName(docxPersonalFiles);
|
||||
await viewer.waitForViewerToOpen();
|
||||
|
||||
await toolbar.fullScreenButton.click();
|
||||
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is closed after pressing Full screen');
|
||||
});
|
||||
|
||||
it('[C286314] Pressing ESC in the viewer closes only the action dialog', async () => {
|
||||
await dataTable.doubleClickOnRowByName(docxPersonalFiles);
|
||||
await viewer.waitForViewerToOpen();
|
||||
|
||||
await toolbar.clickMoreActionsCopy();
|
||||
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
|
||||
await Utils.pressEscape();
|
||||
expect(await shareDialog.isDialogOpen()).toBe(false, 'Dialog is still open');
|
||||
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
|
||||
});
|
||||
});
|
||||
|
||||
describe('from File Libraries', () => {
|
||||
const siteName = `site-${Utils.random()}`;
|
||||
const destination = `destFL-${Utils.random()}`;
|
||||
let destinationId: string;
|
||||
|
||||
const xlsxLibraries = `xlsxFL-${Utils.random()}.xlsx`;
|
||||
const pdfLibraries = `pdfFL-${Utils.random()}.pdf`;
|
||||
|
||||
const fileForEditOffline = `file1-${Utils.random()}.docx`;
|
||||
const fileForCancelEditing = `file2-${Utils.random()}.docx`;
|
||||
let fileForCancelEditingId: string;
|
||||
const fileForUploadNewVersion = `file3-${Utils.random()}.docx`;
|
||||
let fileForUploadNewVersionId: string;
|
||||
|
||||
beforeAll(async () => {
|
||||
try {
|
||||
await apis.user.sites.createSite(siteName);
|
||||
const docLibId = await apis.user.sites.getDocLibId(siteName);
|
||||
destinationId = await apis.user.createFolder(destination);
|
||||
|
||||
await apis.user.upload.uploadFile(docxFile2, docLibId);
|
||||
|
||||
await apis.user.upload.uploadFileWithRename(xlsxFileForMove, docLibId, xlsxLibraries);
|
||||
await apis.user.upload.uploadFileWithRename(pdfFileForDelete, docLibId, pdfLibraries);
|
||||
|
||||
await apis.user.upload.uploadFileWithRename(docxFile, docLibId, fileForEditOffline);
|
||||
fileForCancelEditingId = (await apis.user.upload.uploadFileWithRename(docxFile, docLibId, fileForCancelEditing)).entry.id;
|
||||
fileForUploadNewVersionId = (await apis.user.upload.uploadFileWithRename(docxFile, docLibId, fileForUploadNewVersion)).entry.id;
|
||||
|
||||
await userActions.lockNodes([fileForCancelEditingId, fileForUploadNewVersionId]);
|
||||
|
||||
await loginPage.loginWith(username);
|
||||
} catch (error) {
|
||||
Logger.error(`----- beforeAll failed : ${error}`);
|
||||
}
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await page.goToMyLibrariesAndWait();
|
||||
await dataTable.doubleClickOnRowByName(siteName);
|
||||
await dataTable.waitForHeader();
|
||||
} catch (error) {
|
||||
Logger.error(`----- beforeEach failed : ${error}`);
|
||||
}
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await Utils.pressEscape();
|
||||
await uploadFilesDialog.closeUploadDialog();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
try {
|
||||
await userActions.login(username, username);
|
||||
await userActions.deleteSites([siteName]);
|
||||
await userActions.deleteNodes([destinationId]);
|
||||
await userActions.emptyTrashcan();
|
||||
} catch (error) {
|
||||
Logger.error(`----- afterAll failed : ${error}`);
|
||||
}
|
||||
});
|
||||
|
||||
it('[C286371] Move action', async () => {
|
||||
await dataTable.doubleClickOnRowByName(xlsxLibraries);
|
||||
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
|
||||
|
||||
await toolbar.clickMoreActionsMove();
|
||||
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
|
||||
await copyMoveDialog.selectLocation('Personal Files');
|
||||
await copyMoveDialog.selectDestination(destination);
|
||||
await copyMoveDialog.moveButton.click();
|
||||
expect(await page.getSnackBarMessage()).toContain('Moved 1 item');
|
||||
await viewer.closeButton.click();
|
||||
expect(await dataTable.isItemPresent(xlsxLibraries)).toBe(false, 'Item was not moved');
|
||||
await page.clickPersonalFilesAndWait();
|
||||
await dataTable.doubleClickOnRowByName(destination);
|
||||
expect(await dataTable.isItemPresent(xlsxLibraries)).toBe(true, 'Item is not present in destination');
|
||||
});
|
||||
});
|
||||
|
||||
describe('from Recent Files', () => {
|
||||
|
@@ -48,9 +48,8 @@ describe('Viewer general', () => {
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const page = new BrowsingPage();
|
||||
const { dataTable, toolbar } = page;
|
||||
const { dataTable } = page;
|
||||
const viewer = new Viewer();
|
||||
const { searchInput } = page.pageLayoutHeader;
|
||||
|
||||
const adminApiActions = new AdminActions();
|
||||
const userActions = new UserActions();
|
||||
@@ -114,24 +113,6 @@ describe('Viewer general', () => {
|
||||
expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed');
|
||||
});
|
||||
|
||||
it('[C284636] Viewer opens for a file from Recent Files', async () => {
|
||||
await page.clickRecentFilesAndWait();
|
||||
await dataTable.doubleClickOnRowByName(xlsxFile);
|
||||
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
|
||||
expect(await viewer.isViewerToolbarDisplayed()).toBe(true, 'Toolbar not displayed');
|
||||
expect(await viewer.isCloseButtonDisplayed()).toBe(true, 'Close button is not displayed');
|
||||
expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed');
|
||||
});
|
||||
|
||||
it('[C284635] Viewer opens for a file from Shared Files', async () => {
|
||||
await page.clickSharedFilesAndWait();
|
||||
await dataTable.doubleClickOnRowByName(xlsxFile);
|
||||
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
|
||||
expect(await viewer.isViewerToolbarDisplayed()).toBe(true, 'Toolbar not displayed');
|
||||
expect(await viewer.isCloseButtonDisplayed()).toBe(true, 'Close button is not displayed');
|
||||
expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed');
|
||||
});
|
||||
|
||||
it('[C284634] Viewer opens for a file from Favorites', async () => {
|
||||
await page.clickFavoritesAndWait();
|
||||
await dataTable.doubleClickOnRowByName(xlsxFile);
|
||||
@@ -140,18 +121,4 @@ describe('Viewer general', () => {
|
||||
expect(await viewer.isCloseButtonDisplayed()).toBe(true, 'Close button is not displayed');
|
||||
expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed');
|
||||
});
|
||||
|
||||
it('[C279175] Viewer opens for a file from Search Results', async () => {
|
||||
await toolbar.clickSearchIconButton();
|
||||
await searchInput.clickSearchButton();
|
||||
await searchInput.checkFilesAndFolders();
|
||||
await searchInput.searchFor(xlsxFile);
|
||||
await dataTable.waitForBody();
|
||||
|
||||
await dataTable.doubleClickOnRowByName(xlsxFile);
|
||||
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
|
||||
expect(await viewer.isViewerToolbarDisplayed()).toBe(true, 'Toolbar not displayed');
|
||||
expect(await viewer.isCloseButtonDisplayed()).toBe(true, 'Close button is not displayed');
|
||||
expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed');
|
||||
});
|
||||
});
|
||||
|
@@ -1,109 +0,0 @@
|
||||
/*!
|
||||
* 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 { AdminActions, LoginPage, BrowsingPage, FILES, RepoClient, Utils, Viewer, PasswordDialog } from '@alfresco/aca-testing-shared';
|
||||
import { BrowserActions } from '@alfresco/adf-testing';
|
||||
|
||||
describe('Viewer - password protected file', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
|
||||
const parent = `parent-${Utils.random()}`;
|
||||
let parentId: string;
|
||||
|
||||
const protectedFile = FILES.protectedFile;
|
||||
|
||||
const apis = {
|
||||
user: new RepoClient(username, username)
|
||||
};
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const page = new BrowsingPage();
|
||||
const { dataTable } = page;
|
||||
const viewer = new Viewer();
|
||||
const passwordDialog = new PasswordDialog();
|
||||
const adminApiActions = new AdminActions();
|
||||
|
||||
beforeAll(async () => {
|
||||
await adminApiActions.createUser({ username });
|
||||
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
|
||||
await apis.user.upload.uploadFile(protectedFile.name, parentId);
|
||||
|
||||
await loginPage.loginWith(username);
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
await page.header.expandSideNav();
|
||||
await page.clickPersonalFilesAndWait();
|
||||
await dataTable.doubleClickOnRowByName(parent);
|
||||
await dataTable.waitForHeader();
|
||||
await dataTable.doubleClickOnRowByName(protectedFile.name);
|
||||
await viewer.waitForViewerToOpen();
|
||||
await passwordDialog.waitForDialogToOpen();
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await page.closeOpenDialogs();
|
||||
await Utils.pressEscape();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await apis.user.nodes.deleteNodeById(parentId);
|
||||
});
|
||||
|
||||
it('[C268958] Password dialog appears when opening a protected file', async () => {
|
||||
expect(await passwordDialog.isDialogOpen()).toBe(true, 'Password dialog not open');
|
||||
expect(await passwordDialog.isPasswordInputDisplayed()).toBe(true, 'Password input not displayed');
|
||||
expect(await passwordDialog.isSubmitEnabled()).toBe(false, 'Submit button not disabled');
|
||||
expect(await passwordDialog.isCloseEnabled()).toBe(true, 'Close button not enabled');
|
||||
expect(await viewer.isPdfViewerContentDisplayed()).toBe(false, 'file content is displayed');
|
||||
});
|
||||
|
||||
it('[C268959] File content is displayed when entering the correct password', async () => {
|
||||
await passwordDialog.enterPassword(protectedFile.password);
|
||||
expect(await passwordDialog.isSubmitEnabled()).toBe(true, 'Submit button not enabled');
|
||||
|
||||
await BrowserActions.click(passwordDialog.submitButton);
|
||||
await passwordDialog.waitForDialogToClose();
|
||||
|
||||
expect(await viewer.isPdfViewerContentDisplayed()).toBe(true, 'file content not displayed');
|
||||
});
|
||||
|
||||
it('[C268960] Error appears when entering an incorrect password', async () => {
|
||||
await passwordDialog.enterPassword('incorrect');
|
||||
expect(await passwordDialog.isSubmitEnabled()).toBe(true, 'Submit button not enabled');
|
||||
await BrowserActions.click(passwordDialog.submitButton);
|
||||
|
||||
expect(await passwordDialog.getErrorMessage()).toBe('Password is wrong');
|
||||
expect(await viewer.isPdfViewerContentDisplayed()).toBe(false, 'file content is displayed');
|
||||
});
|
||||
|
||||
it('[C268961] Refresh the page while Password dialog is open', async () => {
|
||||
await passwordDialog.enterPassword(protectedFile.password);
|
||||
await page.refresh();
|
||||
await viewer.waitForViewerToOpen();
|
||||
|
||||
expect(await viewer.isPdfViewerContentDisplayed()).toBe(false, 'file content is displayed');
|
||||
expect(await passwordDialog.isDialogOpen()).toBe(true, 'Password dialog not open');
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user