Protractor cleanup for demo shell (#9019)

* [ci:force] cleanup protractor tests

* [ci:force] cleanup insights test

* [ci:force] cleanup dead demo shell e2e

* [ci:force] cleanup e2e

* [ci:force] cleanup e2e

* cleanup files component

* [ci:force] cleanup e2e

* [ci:force] remove user info SSO protractor e2e

* [ci:force] remove viewer e2e already covered by other tests

* [ci:force] remove custom font from demo shell

* [ci:force] demo shell viewer cleanup

* [ci:force] cleanup viewer in demo shell

* [ci:force] rollback model changes

* [ci:force] remove site picker from content demo

* [ci:force] cleanup files demo shell component

* [ci:force] cleanup e2e and dead code

* [ci:force] cleanup dead code

* [ci:force] fix linting

* [ci:force] standalone home component

* [ci:force] cleanup demo shell app layout

* [ci:force] cleanup css

* [ci:force] cleanup demo shell logout

* Update demo-shell/src/app/components/app-layout/app-layout.component.html

Co-authored-by: Mykyta Maliarchuk <84377976+nikita-web-ua@users.noreply.github.com>

---------

Co-authored-by: Mykyta Maliarchuk <84377976+nikita-web-ua@users.noreply.github.com>
This commit is contained in:
Denys Vuika
2023-10-27 16:56:53 +01:00
committed by GitHub
parent 1f94c592da
commit 620911cf70
70 changed files with 102 additions and 3343 deletions

View File

@@ -1,119 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { createApiService,
LocalStorageUtil,
LoginPage,
StringUtil,
UploadActions,
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { FolderModel } from '../models/ACS/folder.model';
import { ContentServicesPage } from './pages/content-services.page';
import { InfinitePaginationPage } from './pages/infinite-pagination.page';
import { NavigationBarPage } from './pages/navigation-bar.page';
import { NodeEntry } from '@alfresco/js-api';
describe('Enable infinite scrolling', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const infinitePaginationPage = new InfinitePaginationPage();
const navigationBarPage = new NavigationBarPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const acsUser = new UserModel();
const folderModel = new FolderModel({ name: 'folderOne' });
let fileNames = [];
const nrOfFiles = 30;
let deleteFileNames = [];
const nrOfDeletedFiles = 22;
let deleteUploaded: NodeEntry;
const pageSize = 20;
let emptyFolderModel: NodeEntry;
const files = {
base: 'newFile',
extension: '.txt'
};
beforeAll(async () => {
const uploadActions = new UploadActions(apiService);
await apiService.loginWithProfile('admin');
await usersActions.createUser(acsUser);
await loginPage.login(acsUser.username, acsUser.password);
fileNames = StringUtil.generateFilesNames(1, nrOfFiles, files.base, files.extension);
deleteFileNames = StringUtil.generateFilesNames(1, nrOfDeletedFiles, files.base, files.extension);
await apiService.login(acsUser.username, acsUser.password);
const folderUploadedModel = await uploadActions.createFolder(folderModel.name, '-my-');
emptyFolderModel = await uploadActions.createFolder('emptyFolder', '-my-');
await uploadActions.createEmptyFiles(fileNames, folderUploadedModel.entry.id);
deleteUploaded = await uploadActions.createFolder('deleteFolder', '-my-');
await uploadActions.createEmptyFiles(deleteFileNames, deleteUploaded.entry.id);
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
});
beforeEach(async () => {
await navigationBarPage.navigateToContentServices();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
});
it('[C299201] Should use default pagination settings for infinite pagination', async () => {
await contentServicesPage.openFolder(folderModel.name);
await contentServicesPage.enableInfiniteScrolling();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoadedInfinitePagination();
await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(pageSize);
await infinitePaginationPage.clickLoadMoreButton();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoadedInfinitePagination();
await infinitePaginationPage.checkLoadMoreButtonIsNotDisplayed();
await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(nrOfFiles);
});
it('[C299202] Should not display load more button when all the files are already displayed', async () => {
await LocalStorageUtil.setUserPreference('paginationSize', '30');
await contentServicesPage.openFolder(folderModel.name);
await contentServicesPage.enableInfiniteScrolling();
await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(nrOfFiles);
await infinitePaginationPage.checkLoadMoreButtonIsNotDisplayed();
});
it('[C299203] Should not display load more button when a folder is empty', async () => {
await contentServicesPage.openFolder(emptyFolderModel.entry.name);
await infinitePaginationPage.checkLoadMoreButtonIsNotDisplayed();
});
});

View File

@@ -16,7 +16,7 @@
*/
import { DropActions, BrowserActions, BrowserVisibility, DocumentListPage, DropdownPage, Logger } from '@alfresco/adf-testing';
import { $$, browser, by, element, protractor, $ } from 'protractor';
import { $$, browser, protractor, $ } from 'protractor';
import { FolderDialogPage } from './dialog/folder-dialog.page';
import { NavigationBarPage } from './navigation-bar.page';
import * as path from 'path';
@@ -51,17 +51,11 @@ export class ContentServicesPage {
createdByColumnHeader = 'createdByUser.displayName';
createdColumnHeader = 'createdAt';
deleteContentElement = $('button[data-automation-id="Delete"]');
metadataAction = $('button[data-automation-id="Info"]');
versionManagerAction = $('button[data-automation-id="Manage versions"]');
downloadContent = $('button[data-automation-id="Download"]');
downloadButton = $('button[title="Download"]');
multiSelectToggle = $('[data-automation-id="multiSelectToggle"]');
selectionModeDropdown = $('.mat-select[placeholder="Selection Mode"]');
siteListDropdown = new DropdownPage($(`mat-select[data-automation-id='site-my-files-option']`));
async pressContextMenuActionNamed(actionName: string): Promise<void> {
await BrowserActions.clickExecuteScript(`button[data-automation-id="context-${actionName}"]`);
}
async isContextActionEnabled(actionName: string): Promise<boolean> {
const actionButton = $(`button[data-automation-id="context-${actionName}"`);
@@ -73,43 +67,17 @@ export class ContentServicesPage {
return this.contentList;
}
async checkDeleteIsDisabled(content: string): Promise<void> {
await this.contentList.clickOnActionMenu(content);
const disabledDelete = $(`button[data-automation-id='Delete'][disabled='true']`);
await BrowserVisibility.waitUntilElementIsVisible(disabledDelete);
}
async deleteContent(content: string): Promise<void> {
await this.contentList.clickOnActionMenu(content);
await BrowserActions.click(this.deleteContentElement);
await this.checkContentIsNotDisplayed(content);
}
async metadataContent(content: string): Promise<void> {
await this.contentList.clickOnActionMenu(content);
await BrowserActions.click(this.metadataAction);
}
async versionManagerContent(content: string): Promise<void> {
await this.contentList.clickOnActionMenu(content);
await BrowserActions.click(this.versionManagerAction);
}
async clickFileHyperlink(fileName: string): Promise<void> {
const hyperlink = this.contentList.dataTablePage().getFileHyperlink(fileName);
await BrowserActions.click(hyperlink);
}
async checkFileHyperlinkIsEnabled(fileName: string): Promise<void> {
const hyperlink = this.contentList.dataTablePage().getFileHyperlink(fileName);
await BrowserVisibility.waitUntilElementIsVisible(hyperlink);
}
async clickHyperlinkNavigationToggle(): Promise<void> {
const hyperlinkToggle = element(by.cssContainingText('.mat-slide-toggle-content', 'Hyperlink navigation'));
await BrowserActions.click(hyperlinkToggle);
}
async getElementsDisplayedId() {
return this.contentList.dataTablePage().getAllRowsColumnValues(this.columns.nodeId);
}
@@ -267,25 +235,11 @@ export class ContentServicesPage {
await BrowserVisibility.waitUntilElementIsClickable(this.uploadFileButton);
}
async uploadButtonIsEnabled(): Promise<boolean> {
return this.uploadFileButton.isEnabled();
}
async enableInfiniteScrolling(): Promise<void> {
const infiniteScrollButton = element(by.cssContainingText('.mat-slide-toggle-content', 'Enable Infinite Scrolling'));
await BrowserActions.click(infiniteScrollButton);
}
async enableMediumTimeFormat(): Promise<void> {
const mediumTimeFormat = $('#enableMediumTimeFormat');
await BrowserActions.click(mediumTimeFormat);
}
async enableThumbnails(): Promise<void> {
const thumbnailSlide = $('#adf-thumbnails-upload-switch');
await BrowserActions.click(thumbnailSlide);
}
async checkPaginationIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.emptyPagination);
}
@@ -339,11 +293,6 @@ export class ContentServicesPage {
await expect(await BrowserActions.getAttribute(this.emptyFolderImage, 'src')).toContain(url);
}
async getRowIconImageUrl(fileName: string): Promise<string> {
const iconRow = $(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${fileName}"] img`);
return BrowserActions.getAttribute(iconRow, 'src');
}
async getAttributeValueForElement(elementName: string, propertyName: string): Promise<string> {
const elementSize = $(
`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"][title="${propertyName}"] span`
@@ -351,10 +300,6 @@ export class ContentServicesPage {
return BrowserActions.getText(elementSize);
}
async checkSelectedSiteIsDisplayed(siteName: string): Promise<void> {
await this.siteListDropdown.checkOptionIsSelected(siteName);
}
async clickDownloadButton(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(this.downloadButton);

View File

@@ -27,7 +27,6 @@ export class UploadTogglesPage {
versioningToggle = $('#adf-version-upload-switch');
extensionAcceptedField = $('input[data-automation-id="accepted-files-type"]');
maxSizeField = $('input[data-automation-id="max-files-size"]');
disableUploadCheckbox = $('[id="adf-disable-upload"]');
async enableMultipleFileUpload(): Promise<void> {
await browser.executeScript('arguments[0].scrollIntoView()', this.multipleFileUploadToggle);
@@ -79,10 +78,6 @@ export class UploadTogglesPage {
await this.togglePage.disableToggle(this.versioningToggle);
}
async clickCheckboxDisableUpload(): Promise<void> {
await BrowserActions.click(this.disableUploadCheckbox);
}
async addExtension(extension: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.extensionAcceptedField);
await this.extensionAcceptedField.sendKeys(',' + extension);

View File

@@ -1,41 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ElementFinder, $, $$ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class InfinitePaginationPage {
rootElement: ElementFinder;
loadMoreButton: ElementFinder;
loading = $('[data-automation-id="adf-infinite-pagination-spinner"]');
constructor(rootElement = $$('adf-infinite-pagination').first()) {
this.rootElement = rootElement;
this.loadMoreButton = this.rootElement.$('button[data-automation-id="adf-infinite-pagination-button"]');
}
async clickLoadMoreButton(): Promise<void> {
await BrowserActions.click(this.loadMoreButton);
await BrowserVisibility.waitUntilElementIsNotVisible(this.loading);
}
async checkLoadMoreButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.loadMoreButton);
}
}

View File

@@ -38,7 +38,6 @@ export class MetadataViewPage {
displayEmptySwitch = $(`#adf-metadata-empty`);
readonlySwitch = $(`#adf-metadata-readonly`);
multiSwitch = $(`#adf-metadata-multi`);
presetSwitch = $('#adf-toggle-custom-preset');
defaultPropertiesSwitch = $('#adf-metadata-default-properties');
closeButton = element(by.cssContainingText('button.mat-button span', 'Close'));
displayAspect = $(`input[data-placeholder='Display Aspect']`);
@@ -143,25 +142,12 @@ export class MetadataViewPage {
await BrowserVisibility.waitUntilElementIsPresent(editPropertyIcon);
}
async clickResetButton(): Promise<void> {
const clearPropertyIcon = $('button[data-automation-id="reset-metadata"]');
await BrowserActions.click(clearPropertyIcon);
}
async enterPropertyText(propertyName: string, text: string | number): Promise<void> {
const textField = $('input[data-automation-id="card-textitem-value-' + propertyName + '"]');
await BrowserActions.clearSendKeys(textField, text.toString());
await textField.sendKeys(protractor.Key.ENTER);
}
async enterPresetText(text: string): Promise<void> {
const presetField = $('input[data-automation-id="adf-text-custom-preset"]');
await BrowserActions.clearSendKeys(presetField, text.toString());
await presetField.sendKeys(protractor.Key.ENTER);
const applyButton = $('button[id="adf-metadata-aplly"]');
await BrowserActions.click(applyButton);
}
async enterDescriptionText(text: string): Promise<void> {
const textField = $('textarea[data-automation-id="card-textitem-value-properties.cm:description"]');
await BrowserActions.clearSendKeys(textField, text);
@@ -205,13 +191,6 @@ export class MetadataViewPage {
await expect(await BrowserActions.getAttribute(group, 'class')).not.toContain('mat-expanded');
}
async getMetadataGroupTitle(groupName: string): Promise<string> {
const group = $(
'mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"] > mat-expansion-panel-header > span > mat-panel-title'
);
return BrowserActions.getText(group);
}
async checkPropertyIsVisible(propertyName: string, type: string): Promise<void> {
const property = $('[data-automation-id="card-' + type + '-label-' + propertyName + '"]');
await BrowserVisibility.waitUntilElementIsVisible(property);
@@ -292,10 +271,6 @@ export class MetadataViewPage {
await TestElement.byCss('div[data-automation-id="card-' + type + '-label-' + propertyName + '"]').waitNotVisible();
}
async clickCloseButton(): Promise<void> {
await BrowserActions.click(this.closeButton);
}
async typeAspectName(aspectName): Promise<void> {
await BrowserActions.clearSendKeys(this.displayAspect, aspectName);
}

View File

@@ -24,7 +24,7 @@ export class NavigationBarPage {
processServicesNestedButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="App"]');
processServicesCloudHomeButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="Home"]');
formButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="Form"]');
logoutSection = $('div[data-automation-id="adf-logout-section"]');
logoutSection = $('[data-automation-id="adf-logout-section"]');
personalFiles = $('div [title="Personal Files"]');
getMenuItemLocator = (title: string) => $(`.app-sidenav-link[data-automation-id="${title}"]`);

View File

@@ -1,56 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { createApiService, LoginPage, SettingsPage, UserInfoPage, UserModel, UsersActions } from '@alfresco/adf-testing';
import { browser } from 'protractor';
describe('User Info - SSO', () => {
const settingsPage = new SettingsPage();
const loginSSOPage = new LoginPage();
const userInfoPage = new UserInfoPage();
const apiService = createApiService({ authType: 'OAUTH', provider: 'ECM' });
const usersActions = new UsersActions(apiService);
let identityUser: UserModel;
beforeAll(async () => {
await apiService.login(browser.params.testConfig.users.admin.username, browser.params.testConfig.users.admin.password);
identityUser = await usersActions.createUser();
await settingsPage.setProviderEcmSso(
browser.params.testConfig.appConfig.ecmHost,
browser.params.testConfig.appConfig.oauth2.host,
browser.params.testConfig.appConfig.identityHost,
false,
true,
browser.params.testConfig.appConfig.oauth2.clientId
);
await loginSSOPage.loginSSOIdentityService(identityUser.username, identityUser.password);
});
it('[C290066] Should display UserInfo when login using SSO', async () => {
await userInfoPage.clickUserProfile();
await expect(await userInfoPage.getSsoHeaderTitle()).toEqual(identityUser.firstName + ' ' + identityUser.lastName);
await expect(await userInfoPage.getSsoTitle()).toEqual(identityUser.firstName + ' ' + identityUser.lastName);
await expect(await userInfoPage.getSsoEmail()).toEqual(identityUser.email);
await userInfoPage.closeUserProfile();
await userInfoPage.dialogIsNotDisplayed();
});
});

View File

@@ -16,14 +16,7 @@
*/
import { browser, by, element, protractor } from 'protractor';
import { createApiService,
BrowserActions,
LoginPage,
UploadActions,
UserModel,
UsersActions,
ViewerPage
} from '@alfresco/adf-testing';
import { createApiService, BrowserActions, LoginPage, UploadActions, UserModel, UsersActions, ViewerPage } from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { FileModel } from '../../models/ACS/file.model';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
@@ -271,19 +264,6 @@ describe('Content Services Viewer', () => {
await viewerPage.clickCloseButton();
});
it('[C291903] Should display the buttons in order in the adf viewer toolbar', async () => {
await contentServicesPage.doubleClickRow(pdfFile.name);
await viewerPage.waitTillContentLoaded();
await viewerPage.checkLeftSideBarIsNotDisplayed();
await viewerPage.clickLeftSidebarButton();
await viewerPage.checkLeftSideBarIsDisplayed();
await viewerPage.enableMoreActionsMenu();
await viewerPage.checkToolbarIsDisplayed();
await expect(await viewerPage.getLastButtonTitle()).toEqual(await viewerPage.getMoreActionsMenuTitle());
await viewerPage.clickCloseButton();
});
it('[C260053] Should display first page, toolbar and pagination when opening a .docx file', async () => {
await contentServicesPage.doubleClickRow(docxFile.name);
await viewerPage.waitTillContentLoaded();
@@ -318,7 +298,7 @@ describe('Content Services Viewer', () => {
await viewerPage.checkZoomInButtonIsNotDisplayed();
await viewerPage.checkUnknownFormatIsDisplayed();
await expect(await viewerPage.getUnknownFormatMessage()).toBe('Couldn\'t load preview. Unknown format.');
await expect(await viewerPage.getUnknownFormatMessage()).toBe("Couldn't load preview. Unknown format.");
await viewerPage.clickCloseButton();
});
@@ -434,7 +414,7 @@ describe('Content Services Viewer', () => {
await contentServicesPage.doubleClickRow(unsupportedFileName);
await viewerPage.waitTillContentLoaded();
await viewerPage.checkUnknownFormatIsDisplayed();
await expect(await viewerPage.getUnknownFormatMessage()).toBe('Couldn\'t load preview. Unknown format.');
await expect(await viewerPage.getUnknownFormatMessage()).toBe("Couldn't load preview. Unknown format.");
await viewerPage.clickCloseButton();
}

View File

@@ -1,114 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { browser } from 'protractor';
import { createApiService, FileBrowserUtil, LoginPage, UploadActions, UserModel, UsersActions, ViewerPage } from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { FileModel } from '../../models/ACS/file.model';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { VersionManagePage } from '../pages/version-manager.page';
describe('Viewer', () => {
const navigationBarPage = new NavigationBarPage();
const viewerPage = new ViewerPage();
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const apiService = createApiService();
const uploadActions = new UploadActions(apiService);
const usersActions = new UsersActions(apiService);
const versionManagePage = new VersionManagePage();
const acsUser = new UserModel();
let txtFileUploaded;
const txtFileInfo = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TXT.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT.file_path
});
const fileModelVersionTwo = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TXT.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT.file_location
});
beforeAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.createUser(acsUser);
await apiService.login(acsUser.username, acsUser.password);
txtFileUploaded = await uploadActions.uploadFile(txtFileInfo.location, txtFileInfo.name, '-my-');
await loginPage.login(acsUser.username, acsUser.password);
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await uploadActions.deleteFileOrFolder(txtFileUploaded.entry.id);
await navigationBarPage.clickLogoutButton();
});
beforeEach(async () => {
await contentServicesPage.goToDocumentList();
await contentServicesPage.doubleClickRow(txtFileUploaded.entry.name);
await viewerPage.waitTillContentLoaded();
});
afterEach(async () => {
await viewerPage.clickCloseButton();
});
it('[C260096] Should the Viewer able to accept a customToolbar', async () => {
await viewerPage.clickLeftSidebarButton();
await viewerPage.checkLeftSideBarIsDisplayed();
await viewerPage.checkToolbarIsDisplayed();
await viewerPage.enableCustomToolbar();
await viewerPage.checkCustomToolbarIsDisplayed();
await viewerPage.disableCustomToolbar();
});
it('[C260097] Should the viewer able to show a custom info-drawer when the sidebarTemplate is set', async () => {
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await viewerPage.clickOnTab('Comments');
await viewerPage.checkTabIsActive('Comments');
await viewerPage.clickOnTab('Properties');
await viewerPage.checkTabIsActive('Properties');
await viewerPage.clickOnTab('Versions');
await viewerPage.checkTabIsActive('Versions');
});
it('[C362242] Should the Viewer be able to view a previous version of a file', async () => {
await contentServicesPage.versionManagerContent(txtFileInfo.name);
await versionManagePage.showNewVersionButton.click();
await versionManagePage.uploadNewVersionFile(fileModelVersionTwo.location);
await versionManagePage.closeVersionDialog();
await contentServicesPage.doubleClickRow(txtFileUploaded.entry.name);
await viewerPage.waitTillContentLoaded();
await viewerPage.clickInfoButton();
await viewerPage.clickOnTab('Versions');
await versionManagePage.viewFileVersion('1.0');
await viewerPage.expectUrlToContain('1.0');
});
it('[C362265] Should the Viewer be able to download a previous version of a file', async () => {
await viewerPage.clickDownloadButton();
await FileBrowserUtil.isFileDownloaded(txtFileInfo.name);
});
});

View File

@@ -1,170 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { browser } from 'protractor';
import { createApiService,
LoginPage,
UploadActions,
UserModel,
UsersActions,
ViewerPage
} from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { FileModel } from '../../models/ACS/file.model';
describe('Viewer', () => {
const acsUser = new UserModel();
const viewerPage = new ViewerPage();
const contentServicesPage = new ContentServicesPage();
const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const pngFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_path
});
const fileForOverlay = new FileModel({
name: 'fileForOverlay.png',
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_path
});
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const uploadActions = new UploadActions(apiService);
beforeAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.createUser(acsUser);
await apiService.login(acsUser.username, acsUser.password);
let pngFileUploaded = await uploadActions.uploadFile(pngFile.location, pngFile.name, '-my-');
Object.assign(pngFile, pngFileUploaded.entry);
pngFileUploaded = await uploadActions.uploadFile(fileForOverlay.location, fileForOverlay.name, '-my-');
Object.assign(fileForOverlay, pngFileUploaded.entry);
await loginPage.login(acsUser.username, acsUser.password);
await contentServicesPage.goToDocumentList();
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await uploadActions.deleteFileOrFolder(pngFile.getId());
await navigationBarPage.clickLogoutButton();
});
describe('properties', () => {
beforeAll(async () => {
await viewerPage.viewFile(pngFile.name);
await viewerPage.clickLeftSidebarButton();
await viewerPage.checkLeftSideBarIsDisplayed();
});
afterAll(async () => {
await viewerPage.clickCloseButton();
});
it('[C260066] Should Show/Hide viewer toolbar when showToolbar is true/false', async () => {
await viewerPage.checkToolbarIsDisplayed();
await viewerPage.disableToolbar();
await viewerPage.checkToolbarIsNotDisplayed();
await viewerPage.enableToolbar();
});
it('[C260076] Should Show/Hide back button when allowGoBack is true/false', async () => {
await viewerPage.checkGoBackIsDisplayed();
await viewerPage.disableGoBack();
await viewerPage.checkGoBackIsNotDisplayed();
await viewerPage.enableGoBack();
});
it('[C260077] Should Show toolbar options dropdown when adf-viewer-open-with directive is used', async () => {
await viewerPage.checkToolbarOptionsIsNotDisplayed();
await viewerPage.enableToolbarOptions();
await viewerPage.checkToolbarOptionsIsDisplayed();
await viewerPage.disableToolbarOptions();
});
it('[C260079] Should Show/Hide download button when allowDownload is true/false', async () => {
await viewerPage.checkDownloadButtonIsDisplayed();
await viewerPage.disableDownload();
await viewerPage.checkDownloadButtonIsNotDisplayed();
await viewerPage.enableDownload();
});
it('[C260082] Should Show/Hide print button when allowPrint is true/false', async () => {
await viewerPage.checkPrintButtonIsDisplayed();
await viewerPage.disablePrint();
await viewerPage.checkPrintButtonIsNotDisplayed();
await viewerPage.enablePrint();
});
it('[C260092] Should show adf-viewer-toolbar-actions directive buttons when adf-viewer-toolbar-actions is used', async () => {
await viewerPage.checkMoreActionsDisplayed();
await viewerPage.disableMoreActions();
await viewerPage.checkMoreActionsIsNotDisplayed();
await viewerPage.enableMoreActions();
});
it('[C260090] Should showSidebar allow right info-drawer to be shown', async () => {
await viewerPage.clickToggleRightSidebar();
await viewerPage.checkInfoSideBarIsDisplayed();
await viewerPage.clickToggleRightSidebar();
await viewerPage.checkInfoSideBarIsNotDisplayed();
});
it('[C286442] Should showLeftSidebar allow left info-drawer to be shown', async () => {
await viewerPage.clickToggleLeftSidebar();
await viewerPage.checkLeftSideBarIsNotDisplayed();
await viewerPage.clickLeftSidebarButton();
await viewerPage.checkLeftSideBarIsDisplayed();
});
it('[C260089] Should Show/Hide info-drawer if allowSidebar true/false', async () => {
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await viewerPage.checkInfoButtonIsDisplayed();
await viewerPage.disableAllowSidebar();
await viewerPage.checkInfoButtonIsNotDisplayed();
await viewerPage.checkInfoSideBarIsNotDisplayed();
});
it('[C286596] Should Show/Hide left info-drawer if allowLeftSidebar true/false', async () => {
await viewerPage.checkLeftSideBarIsDisplayed();
await viewerPage.checkLeftSideBarButtonIsDisplayed();
await viewerPage.disableAllowLeftSidebar();
await viewerPage.checkLeftSideBarButtonIsNotDisplayed();
await viewerPage.checkLeftSideBarIsNotDisplayed();
});
});
});