mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
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:
@@ -1,49 +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 { NodeEntry, NodeBodyUpdate, NodesApi } from '@alfresco/js-api';
|
||||
import { ApiService } from '../../../shared/api/api.service';
|
||||
|
||||
export class PermissionActions {
|
||||
api: ApiService;
|
||||
nodesApi: NodesApi;
|
||||
|
||||
constructor(apiService: ApiService) {
|
||||
this.api = apiService;
|
||||
this.nodesApi = new NodesApi(apiService.getInstance());
|
||||
}
|
||||
|
||||
addRoleForUser(userName: string, role: string, nodeToUpdate: NodeEntry): Promise<NodeEntry> {
|
||||
const payload: NodeBodyUpdate = {
|
||||
permissions: {
|
||||
locallySet: [
|
||||
{
|
||||
accessStatus: 'ALLOWED',
|
||||
name: role,
|
||||
authorityId: userName
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
return this.nodesApi.updateNode(nodeToUpdate.entry.id, payload);
|
||||
}
|
||||
|
||||
disableInheritedPermissionsForNode(nodeId: string): Promise<NodeEntry> {
|
||||
const nodeBody = { permissions: { isInheritanceEnabled: false } };
|
||||
return this.nodesApi.updateNode(nodeId, nodeBody, { include: ['permissions'] });
|
||||
}
|
||||
}
|
@@ -16,5 +16,4 @@
|
||||
*/
|
||||
|
||||
export * from './upload.actions';
|
||||
export * from './permission.actions';
|
||||
export * from './model.actions';
|
||||
|
@@ -1,99 +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 { $, by, element, $$ } from 'protractor';
|
||||
import { BrowserActions } from '../../core/utils/browser-actions';
|
||||
import { DataTableComponentPage } from '../../core/pages/data-table-component.page';
|
||||
import { BrowserVisibility } from '../../core/utils/browser-visibility';
|
||||
import { DropdownPage } from '../../core/pages/material/dropdown.page';
|
||||
import { TestElement } from '../../core/test-element';
|
||||
|
||||
const column = {
|
||||
role: 'Role'
|
||||
};
|
||||
|
||||
export class AddPermissionsDialogPage {
|
||||
|
||||
dataTableComponentPage: DataTableComponentPage = new DataTableComponentPage();
|
||||
userRoleDataTableComponentPage: DataTableComponentPage = new DataTableComponentPage($('[data-automation-id="adf-user-role-selection-table"]'));
|
||||
|
||||
addPermissionDialog = $('adf-add-permission-dialog');
|
||||
searchUserInput = $('#searchInput');
|
||||
searchResults = $('#adf-add-permission-authority-results #adf-search-results-content');
|
||||
addButton = $('[data-automation-id="add-permission-dialog-confirm-button"]');
|
||||
closeButton = $('#add-permission-dialog-close-button');
|
||||
|
||||
getRoleDropdownOptions() {
|
||||
return $$('.mat-option-text');
|
||||
}
|
||||
|
||||
async clickAddPermissionButton(): Promise<void> {
|
||||
await BrowserActions.clickExecuteScript('button[data-automation-id="adf-add-permission-button"]');
|
||||
}
|
||||
|
||||
async checkAddPermissionDialogIsDisplayed() {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.addPermissionDialog);
|
||||
}
|
||||
|
||||
async checkSearchUserInputIsDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.searchUserInput);
|
||||
}
|
||||
|
||||
async searchUserOrGroup(name: string): Promise<void> {
|
||||
await BrowserActions.clearSendKeys(this.searchUserInput, name);
|
||||
await this.dataTableComponentPage.waitTillContentLoaded();
|
||||
}
|
||||
|
||||
async checkResultListIsDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.searchResults);
|
||||
}
|
||||
|
||||
async clickUserOrGroup(name: string): Promise<void> {
|
||||
const userOrGroupName = element(by.cssContainingText('mat-list-option .mat-list-text', name));
|
||||
await BrowserActions.click(userOrGroupName);
|
||||
await BrowserActions.click(this.addButton);
|
||||
}
|
||||
|
||||
async getRoleCellValue(rowName: string): Promise<string> {
|
||||
const locator = this.dataTableComponentPage.getCellByRowContentAndColumn('Users and Groups', rowName, column.role);
|
||||
return BrowserActions.getText(locator);
|
||||
}
|
||||
|
||||
async selectOption(name: string): Promise<void> {
|
||||
await new DropdownPage().selectOption(name);
|
||||
}
|
||||
|
||||
async checkUserOrGroupIsDisplayed(name: string): Promise<void> {
|
||||
const userOrGroupName = element(by.cssContainingText('mat-list-option .mat-list-text', name));
|
||||
await BrowserVisibility.waitUntilElementIsVisible(userOrGroupName);
|
||||
}
|
||||
|
||||
async addButtonIsEnabled(): Promise<boolean> {
|
||||
return this.addButton.isEnabled();
|
||||
}
|
||||
|
||||
async clickAddButton(): Promise<void> {
|
||||
await BrowserActions.click(this.addButton);
|
||||
}
|
||||
|
||||
async selectRole(name: string, role: string) {
|
||||
const row = this.userRoleDataTableComponentPage.getRow('Users and Groups', name);
|
||||
await BrowserActions.click(row.$('[id="adf-select-role-permission"] .mat-select-trigger'));
|
||||
await TestElement.byCss('.mat-select-panel').waitVisible();
|
||||
await this.selectOption(role);
|
||||
}
|
||||
}
|
@@ -16,4 +16,3 @@
|
||||
*/
|
||||
|
||||
export * from './content-node-selector-dialog.page';
|
||||
export * from './add-permissions-dialog.page';
|
||||
|
@@ -19,7 +19,6 @@ import { ApiService } from '../../../shared/api/api.service';
|
||||
import { ResultSetPaging, SearchApi } from '@alfresco/js-api';
|
||||
import { Logger } from '../utils/logger';
|
||||
import { ApiUtil } from '../../../shared/api/api.util';
|
||||
import { UserModel } from '../models/user.model';
|
||||
|
||||
export class SearchService {
|
||||
apiService: ApiService;
|
||||
@@ -50,45 +49,12 @@ export class SearchService {
|
||||
return ApiUtil.waitForApi(apiCall, predicate);
|
||||
}
|
||||
|
||||
async isUserSearchable(user: UserModel): Promise<any> {
|
||||
const query = this.createUserSearchQuery(user);
|
||||
|
||||
const predicate = (result: ResultSetPaging) => result.list && result.list.entries.length > 0 && !!result.list.entries.find(({ entry }) => entry.properties['cm:email'] === user.email);
|
||||
|
||||
return this.performSearch(query, predicate, 'Failed to search user');
|
||||
}
|
||||
|
||||
private createUserSearchQuery(user: UserModel) {
|
||||
return {
|
||||
query: {
|
||||
query: `email:*${user.email}* OR firstName:*${user.firstName}* OR lastName:*${user.lastName}*`
|
||||
},
|
||||
include: [
|
||||
'aspectNames',
|
||||
'properties'
|
||||
],
|
||||
paging: {
|
||||
maxItems: 1,
|
||||
skipCount: 0
|
||||
},
|
||||
filterQueries: [
|
||||
{
|
||||
query: `TYPE:'cm:authority'`
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
private createSearchQuery(name: string) {
|
||||
return {
|
||||
query: {
|
||||
query: `${name}*`
|
||||
},
|
||||
include: [
|
||||
'path',
|
||||
'allowableOperations',
|
||||
'properties'
|
||||
],
|
||||
include: ['path', 'allowableOperations', 'properties'],
|
||||
paging: {
|
||||
maxItems: 20,
|
||||
skipCount: 0
|
||||
@@ -102,9 +68,7 @@ export class SearchService {
|
||||
}
|
||||
],
|
||||
scope: {
|
||||
locations: [
|
||||
'nodes'
|
||||
]
|
||||
locations: ['nodes']
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -15,18 +15,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import * as path from 'path';
|
||||
import * as fs from 'fs';
|
||||
|
||||
import { browser } from 'protractor';
|
||||
import {
|
||||
UserProfileApi,
|
||||
AdminUsersApi,
|
||||
AdminTenantsApi,
|
||||
PeopleApi,
|
||||
ImageUploadRepresentation,
|
||||
UserRepresentation
|
||||
} from '@alfresco/js-api';
|
||||
import { UserProfileApi, AdminUsersApi, AdminTenantsApi, PeopleApi, UserRepresentation } from '@alfresco/js-api';
|
||||
import { IdentityService } from './identity/identity.service';
|
||||
import { UserModel } from '../models/user.model';
|
||||
import { ApiService } from '../../../shared/api/api.service';
|
||||
@@ -34,7 +24,6 @@ import { Logger } from '../utils/logger';
|
||||
import { Tenant } from '../models/tenant';
|
||||
|
||||
export class UsersActions {
|
||||
|
||||
api: ApiService;
|
||||
identityService: IdentityService;
|
||||
peopleApi: PeopleApi;
|
||||
@@ -61,7 +50,7 @@ export class UsersActions {
|
||||
const user = new UserModel({ ...(userModel ? userModel : {}) });
|
||||
|
||||
try {
|
||||
if (this.api.apiService.isEcmConfiguration() || (this.api.apiService.isEcmBpmConfiguration())) {
|
||||
if (this.api.apiService.isEcmConfiguration() || this.api.apiService.isEcmBpmConfiguration()) {
|
||||
Logger.log(`Create user ECM ${user.email}`);
|
||||
await this.peopleApi.createPerson({
|
||||
id: user.username,
|
||||
@@ -80,7 +69,7 @@ export class UsersActions {
|
||||
}
|
||||
|
||||
try {
|
||||
if (this.api.apiService.isBpmConfiguration() || (this.api.apiService.isEcmBpmConfiguration())) {
|
||||
if (this.api.apiService.isBpmConfiguration() || this.api.apiService.isEcmBpmConfiguration()) {
|
||||
Logger.log('Create user BPM');
|
||||
if (user.tenantId) {
|
||||
const apsUser = await this.createApsUser(user.tenantId, user.email, user.firstName, user.lastName, user.password);
|
||||
@@ -117,11 +106,6 @@ export class UsersActions {
|
||||
return user;
|
||||
}
|
||||
|
||||
async createUserWithName(firstName: string, lastName: string): Promise<UserModel> {
|
||||
const user = new UserModel({ firstName, lastName });
|
||||
return this.createUser(user);
|
||||
}
|
||||
|
||||
async createTenantAndUser(email?: string, firstName?: string, lastName?: string, password?: string): Promise<UserRepresentation> {
|
||||
const newTenant = await this.adminTenantsApi.createTenant(new Tenant());
|
||||
|
||||
@@ -137,7 +121,6 @@ export class UsersActions {
|
||||
}
|
||||
|
||||
async createApsUser(tenantId?: number, email?: string, firstName?: string, lastName?: string, password?: string): Promise<UserRepresentation> {
|
||||
|
||||
const user = new UserModel({
|
||||
tenantId,
|
||||
email,
|
||||
@@ -149,13 +132,6 @@ export class UsersActions {
|
||||
return this.adminUsersApi.createNewUser(user.getAPSModel());
|
||||
}
|
||||
|
||||
async changeProfilePictureAps(fileLocation: string): Promise<ImageUploadRepresentation> {
|
||||
const pathFile = path.join(browser.params.testConfig.main.rootPath + fileLocation);
|
||||
const file = fs.createReadStream(pathFile);
|
||||
|
||||
return this.userProfileApi.uploadProfilePicture(file);
|
||||
}
|
||||
|
||||
async deleteTenant(tenantId: number) {
|
||||
await this.adminTenantsApi.deleteTenant(tenantId);
|
||||
}
|
||||
|
@@ -1,43 +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 { BrowserVisibility } from '../utils/browser-visibility';
|
||||
import { $ } from 'protractor';
|
||||
import { BrowserActions } from '../utils/browser-actions';
|
||||
|
||||
export class ErrorPage {
|
||||
|
||||
errorPageCode = $('adf-error-content .adf-error-content-code');
|
||||
errorPageTitle = $('adf-error-content .adf-error-content-title');
|
||||
errorPageDescription = $('adf-error-content .adf-error-content-description');
|
||||
|
||||
async checkErrorCode(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.errorPageCode);
|
||||
}
|
||||
|
||||
async getErrorCode(): Promise<string> {
|
||||
return BrowserActions.getText(this.errorPageCode);
|
||||
}
|
||||
|
||||
async getErrorTitle(): Promise<string> {
|
||||
return BrowserActions.getText(this.errorPageTitle);
|
||||
}
|
||||
|
||||
async getErrorDescription(): Promise<string> {
|
||||
return BrowserActions.getText(this.errorPageDescription);
|
||||
}
|
||||
}
|
@@ -1,75 +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 } from './../utils/browser-visibility';
|
||||
import { TabsPage } from './material/tabs.page';
|
||||
|
||||
export class InfoDrawerPage {
|
||||
|
||||
rootElement: ElementFinder;
|
||||
infoDrawerHeader = ('adf-info-drawer-layout-header');
|
||||
tabsPage: TabsPage = new TabsPage();
|
||||
|
||||
constructor(classLocator: string = 'adf-info-drawer') {
|
||||
this.rootElement = $(`adf-info-drawer[class*='${classLocator}']`);
|
||||
}
|
||||
|
||||
async isInfoDrawerDisplayed(): Promise<boolean> {
|
||||
try {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async isInfoDrawerNotDisplayed(): Promise<boolean> {
|
||||
try {
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.rootElement);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async isInfoDrawerHeaderDisplayed(): Promise<boolean> {
|
||||
try {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$(this.infoDrawerHeader));
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async isInfoDrawerHeaderNotDisplayed(): Promise<boolean> {
|
||||
try {
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.rootElement.$(this.infoDrawerHeader));
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async getNoOfTabs(): Promise<number> {
|
||||
return this.tabsPage.getNoOfTabs();
|
||||
}
|
||||
|
||||
async getTabsLabels(): Promise<string> {
|
||||
return this.tabsPage.getTabsLabels();
|
||||
}
|
||||
}
|
@@ -25,7 +25,6 @@ export { LoginPage as LoginSSOPage } from './login.page';
|
||||
|
||||
export * from './data-table-component.page';
|
||||
export * from './pagination.page';
|
||||
export * from './error.page';
|
||||
export * from './form/public-api';
|
||||
export * from './material/public-api';
|
||||
export * from './card-view/public-api';
|
||||
@@ -34,4 +33,3 @@ export * from './config-editor-page';
|
||||
export * from './snackbar.page';
|
||||
export * from './data-table/public-api';
|
||||
export * from './context-menu.page';
|
||||
export * from './info-drawer.page';
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import { BrowserActions } from '../utils/browser-actions';
|
||||
import { TabsPage } from './material/tabs.page';
|
||||
import { TogglePage } from './material/toggle.page';
|
||||
import { BrowserVisibility } from '../utils/browser-visibility';
|
||||
import { element, by, browser, protractor, $, $$ } from 'protractor';
|
||||
import { Logger } from '../utils/logger';
|
||||
@@ -26,12 +25,9 @@ const MAX_LOADING_TIME = 120000;
|
||||
|
||||
export class ViewerPage {
|
||||
tabsPage = new TabsPage();
|
||||
togglePage = new TogglePage();
|
||||
|
||||
closeButton = $('button[data-automation-id="adf-toolbar-back"]');
|
||||
fileName = $('#adf-viewer-display-name');
|
||||
infoButton = $('button[data-automation-id="adf-toolbar-sidebar"]');
|
||||
leftSideBarButton = $('button[data-automation-id="adf-toolbar-left-sidebar"]');
|
||||
previousPageButton = $('#viewer-previous-page-button');
|
||||
nextPageButton = $('#viewer-next-page-button');
|
||||
zoomInButton = $('#viewer-zoom-in-button');
|
||||
@@ -49,51 +45,15 @@ export class ViewerPage {
|
||||
thumbnailsClose = $('button[data-automation-id="adf-thumbnails-close"]');
|
||||
secondThumbnail = $('adf-pdf-thumb > img[title="Page 2"]');
|
||||
lastThumbnailDisplayed = $$('adf-pdf-thumb').last();
|
||||
passwordDialog = $('adf-pdf-viewer-password-dialog');
|
||||
passwordSubmit = $('button[data-automation-id="adf-password-dialog-submit"]');
|
||||
passwordDialogClose = $('button[data-automation-id="adf-password-dialog-close"]');
|
||||
passwordSubmitDisabled = $('button[data-automation-id="adf-password-dialog-submit"][disabled]');
|
||||
passwordInput = $('input[data-automation-id="adf-password-dialog-input"]');
|
||||
passwordError = $('mat-error[data-automation-id="adf-password-dialog-error"]');
|
||||
infoSideBar = $('#adf-right-sidebar');
|
||||
leftSideBar = $('#adf-left-sidebar');
|
||||
viewer = $('adf-viewer');
|
||||
imgViewer = $('adf-img-viewer');
|
||||
activeTab = $('div[class*="mat-tab-label-active"]');
|
||||
toolbarSwitch = $('#adf-switch-toolbar');
|
||||
toolbar = $('#adf-viewer-toolbar');
|
||||
lastButton = $$('#adf-viewer-toolbar mat-toolbar > button[data-automation-id*="adf-toolbar-"]').last();
|
||||
goBackSwitch = $('#adf-switch-goback');
|
||||
canvasLayer = $$('.canvasWrapper > canvas').first();
|
||||
|
||||
openWithSwitch = $('#adf-switch-openwith');
|
||||
openWith = $('#adf-viewer-openwith');
|
||||
|
||||
moreActionsMenuSwitch = $('#adf-switch-moreactionsmenu');
|
||||
moreActionsMenu = $('button[data-automation-id="adf-toolbar-more-actions"]');
|
||||
|
||||
customToolbarToggle = $('#adf-toggle-custom-toolbar');
|
||||
customToolbar = $('adf-viewer-toolbar[data-automation-id="adf-viewer-custom-toolbar"]');
|
||||
|
||||
showRightSidebarSwitch = $('#adf-switch-showrightsidebar');
|
||||
showLeftSidebarSwitch = $('#adf-switch-showleftsidebar');
|
||||
|
||||
moreActionsSwitch = $('#adf-switch-moreactions');
|
||||
pdfPageLoaded = $('[data-page-number="1"][data-loaded="true"], adf-img-viewer, adf-txt-viewer');
|
||||
|
||||
downloadSwitch = $('#adf-switch-download');
|
||||
downloadButton = $('#adf-alfresco-viewer-download');
|
||||
|
||||
printSwitch = $('#adf-switch-print');
|
||||
printButton = $('#adf-alfresco-viewer-print');
|
||||
|
||||
allowSidebarSwitch = $('#adf-switch-allowsidebar');
|
||||
allowLeftSidebarSwitch = $('#adf-switch-allowLeftSidebar');
|
||||
|
||||
uploadButton = $('#adf-viewer-upload');
|
||||
timeButton = $('#adf-viewer-time');
|
||||
bugButton = $('#adf-viewer-bug');
|
||||
|
||||
unknownFormat = $(`adf-viewer-unknown-format .adf-viewer__unknown-format-view`);
|
||||
|
||||
async viewFile(fileName: string): Promise<void> {
|
||||
@@ -114,8 +74,7 @@ export class ViewerPage {
|
||||
Logger.log('wait spinner is present');
|
||||
await BrowserVisibility.waitUntilElementIsVisible(element(by.tagName('mat-progress-spinner')));
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.tagName('mat-progress-spinner')), MAX_LOADING_TIME);
|
||||
} catch (error) {
|
||||
}
|
||||
} catch (error) {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,41 +104,19 @@ export class ViewerPage {
|
||||
await browser.executeScript(jsCode);
|
||||
}
|
||||
|
||||
async enterPassword(password: string): Promise<void> {
|
||||
await BrowserActions.clearSendKeys(this.passwordInput, password);
|
||||
}
|
||||
|
||||
async checkFileIsLoaded(fileName?: string): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.pdfPageLoaded, 60000, `${fileName} not loaded`);
|
||||
}
|
||||
|
||||
async clickClosePasswordDialog(): Promise<void> {
|
||||
await BrowserActions.click(this.passwordDialogClose);
|
||||
}
|
||||
|
||||
async checkImgViewerIsDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.imgViewer);
|
||||
}
|
||||
|
||||
async checkPasswordErrorIsDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.passwordError);
|
||||
}
|
||||
|
||||
async checkPasswordInputIsDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.passwordInput);
|
||||
}
|
||||
|
||||
async checkPasswordSubmitDisabledIsDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.passwordSubmitDisabled);
|
||||
}
|
||||
|
||||
async checkPasswordDialogIsDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.passwordDialog);
|
||||
}
|
||||
|
||||
async checkAllThumbnailsDisplayed(nbPages): Promise<void> {
|
||||
const defaultThumbnailHeight = 143;
|
||||
await expect(await BrowserActions.getAttribute(this.thumbnailsContent, 'style')).toEqual('height: ' + nbPages * defaultThumbnailHeight + 'px; transform: translate(-50%, 0px);');
|
||||
await expect(await BrowserActions.getAttribute(this.thumbnailsContent, 'style')).toEqual(
|
||||
'height: ' + nbPages * defaultThumbnailHeight + 'px; transform: translate(-50%, 0px);'
|
||||
);
|
||||
}
|
||||
|
||||
async checkCurrentThumbnailIsSelected(): Promise<void> {
|
||||
@@ -213,14 +150,6 @@ export class ViewerPage {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.closeButton);
|
||||
}
|
||||
|
||||
async getLastButtonTitle(): Promise<string> {
|
||||
return BrowserActions.getAttribute(this.lastButton, 'title');
|
||||
}
|
||||
|
||||
async getMoreActionsMenuTitle(): Promise<string> {
|
||||
return BrowserActions.getAttribute(this.moreActionsMenu, 'title');
|
||||
}
|
||||
|
||||
async checkDownloadButtonIsDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.downloadButton);
|
||||
}
|
||||
@@ -229,10 +158,6 @@ export class ViewerPage {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.infoButton);
|
||||
}
|
||||
|
||||
async checkInfoButtonIsNotDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.infoButton);
|
||||
}
|
||||
|
||||
async checkFileThumbnailIsDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.fileThumbnail);
|
||||
}
|
||||
@@ -318,14 +243,6 @@ export class ViewerPage {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.infoSideBar);
|
||||
}
|
||||
|
||||
async checkLeftSideBarButtonIsNotDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.leftSideBarButton);
|
||||
}
|
||||
|
||||
async checkLeftSideBarButtonIsDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.leftSideBarButton);
|
||||
}
|
||||
|
||||
async clickInfoButton(): Promise<void> {
|
||||
await BrowserActions.click($('button[data-automation-id="adf-toolbar-sidebar"]'));
|
||||
}
|
||||
@@ -335,26 +252,12 @@ export class ViewerPage {
|
||||
}
|
||||
|
||||
async checkTabIsActive(tabName: string): Promise<void> {
|
||||
const tab = element(by.cssContainingText('.adf-info-drawer-layout-content div.mat-tab-labels div.mat-tab-label-active .mat-tab-label-content', tabName));
|
||||
const tab = element(
|
||||
by.cssContainingText('.adf-info-drawer-layout-content div.mat-tab-labels div.mat-tab-label-active .mat-tab-label-content', tabName)
|
||||
);
|
||||
await BrowserVisibility.waitUntilElementIsVisible(tab);
|
||||
}
|
||||
|
||||
async clickLeftSidebarButton(): Promise<void> {
|
||||
await BrowserActions.click(this.leftSideBarButton);
|
||||
}
|
||||
|
||||
async checkLeftSideBarIsDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.leftSideBar);
|
||||
}
|
||||
|
||||
async checkLeftSideBarIsNotDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.leftSideBar);
|
||||
}
|
||||
|
||||
async clickPasswordSubmit(): Promise<void> {
|
||||
await BrowserActions.click(this.passwordSubmit);
|
||||
}
|
||||
|
||||
async clickSecondThumbnail(): Promise<void> {
|
||||
await BrowserActions.click(this.secondThumbnail);
|
||||
}
|
||||
@@ -411,159 +314,10 @@ export class ViewerPage {
|
||||
await this.tabsPage.clickTabByTitle('Comments');
|
||||
}
|
||||
|
||||
async disableToolbar(): Promise<void> {
|
||||
await this.togglePage.disableToggle(this.toolbarSwitch);
|
||||
}
|
||||
|
||||
async enableToolbar(): Promise<void> {
|
||||
await this.togglePage.enableToggle(this.toolbarSwitch);
|
||||
}
|
||||
|
||||
async checkToolbarIsDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.toolbar);
|
||||
}
|
||||
|
||||
async checkToolbarIsNotDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.toolbar);
|
||||
}
|
||||
|
||||
async disableGoBack(): Promise<void> {
|
||||
await this.togglePage.disableToggle(this.goBackSwitch);
|
||||
}
|
||||
|
||||
async enableGoBack(): Promise<void> {
|
||||
await this.togglePage.enableToggle(this.goBackSwitch);
|
||||
}
|
||||
|
||||
async checkGoBackIsDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.closeButton);
|
||||
}
|
||||
|
||||
async checkGoBackIsNotDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.closeButton);
|
||||
}
|
||||
|
||||
async disableToolbarOptions(): Promise<void> {
|
||||
await this.togglePage.disableToggle(this.openWithSwitch);
|
||||
}
|
||||
|
||||
async enableToolbarOptions() {
|
||||
await this.togglePage.enableToggle(this.openWithSwitch);
|
||||
}
|
||||
|
||||
async checkToolbarOptionsIsDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.openWith);
|
||||
}
|
||||
|
||||
async checkToolbarOptionsIsNotDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.openWith);
|
||||
}
|
||||
|
||||
async disableDownload(): Promise<void> {
|
||||
await this.togglePage.disableToggle(this.downloadSwitch);
|
||||
}
|
||||
|
||||
async enableDownload(): Promise<void> {
|
||||
await this.togglePage.enableToggle(this.openWithSwitch);
|
||||
}
|
||||
|
||||
async checkDownloadButtonIsNotDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.downloadButton);
|
||||
}
|
||||
|
||||
async disablePrint(): Promise<void> {
|
||||
await this.togglePage.disableToggle(this.printSwitch);
|
||||
}
|
||||
|
||||
async enablePrint(): Promise<void> {
|
||||
await this.togglePage.enableToggle(this.printSwitch);
|
||||
}
|
||||
|
||||
async checkPrintButtonIsDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.printButton);
|
||||
}
|
||||
|
||||
async checkPrintButtonIsNotDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.printButton);
|
||||
}
|
||||
|
||||
async disableAllowSidebar(): Promise<void> {
|
||||
await this.togglePage.disableToggle(this.allowSidebarSwitch);
|
||||
}
|
||||
|
||||
async disableAllowLeftSidebar(): Promise<void> {
|
||||
await browser.executeScript('arguments[0].scrollIntoView()', this.allowLeftSidebarSwitch);
|
||||
await this.togglePage.disableToggle(this.allowLeftSidebarSwitch);
|
||||
}
|
||||
|
||||
async checkMoreActionsDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.bugButton);
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.timeButton);
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.uploadButton);
|
||||
}
|
||||
|
||||
async checkMoreActionsIsNotDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.bugButton);
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.timeButton);
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.uploadButton);
|
||||
}
|
||||
|
||||
async checkPreviewFileDefaultOptionsAreDisplayed(): Promise<void> {
|
||||
await this.checkToolbarIsDisplayed();
|
||||
await this.checkMoreActionsDisplayed();
|
||||
await this.checkPrintButtonIsDisplayed();
|
||||
await this.checkDownloadButtonIsDisplayed();
|
||||
await this.checkFullScreenButtonIsDisplayed();
|
||||
await this.checkLeftSideBarButtonIsDisplayed();
|
||||
await this.checkInfoButtonIsDisplayed();
|
||||
}
|
||||
|
||||
async disableMoreActions(): Promise<void> {
|
||||
await this.togglePage.disableToggle(this.moreActionsSwitch);
|
||||
}
|
||||
|
||||
async enableMoreActions(): Promise<void> {
|
||||
await this.togglePage.enableToggle(this.moreActionsSwitch);
|
||||
}
|
||||
|
||||
async enableMoreActionsMenu(): Promise<void> {
|
||||
await this.togglePage.enableToggle(this.moreActionsMenuSwitch);
|
||||
}
|
||||
|
||||
async disableCustomToolbar(): Promise<void> {
|
||||
await browser.executeScript('arguments[0].scrollIntoView()', this.customToolbarToggle);
|
||||
await this.togglePage.disableToggle(this.customToolbarToggle);
|
||||
}
|
||||
|
||||
async enableCustomToolbar(): Promise<void> {
|
||||
await browser.executeScript('arguments[0].scrollIntoView()', this.customToolbarToggle);
|
||||
await this.togglePage.enableToggle(this.customToolbarToggle);
|
||||
}
|
||||
|
||||
async checkCustomToolbarIsDisplayed() {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.customToolbar);
|
||||
}
|
||||
|
||||
async clickToggleRightSidebar(): Promise<void> {
|
||||
await BrowserActions.click(this.showRightSidebarSwitch);
|
||||
}
|
||||
|
||||
async clickToggleLeftSidebar(): Promise<void> {
|
||||
await BrowserActions.click(this.showLeftSidebarSwitch);
|
||||
}
|
||||
|
||||
async disableOverlay(): Promise<void> {
|
||||
await this.togglePage.disableToggle($('#adf-viewer-overlay'));
|
||||
}
|
||||
|
||||
async checkOverlayViewerIsDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible($('div[class*="adf-viewer-overlay-container"]'));
|
||||
}
|
||||
|
||||
async checkInlineViewerIsDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible($('div[class*="adf-viewer-inline-container"]'));
|
||||
}
|
||||
|
||||
async checkUnknownFormatIsDisplayed(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.unknownFormat);
|
||||
}
|
||||
|
@@ -15,12 +15,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { browser } from 'protractor';
|
||||
import { ApiService } from '../../../shared/api/api.service';
|
||||
import { FormModelsApi, FormRepresentation } from '@alfresco/js-api';
|
||||
|
||||
export class FormUtil {
|
||||
|
||||
api: ApiService;
|
||||
editorApi: FormModelsApi;
|
||||
|
||||
@@ -31,18 +29,6 @@ export class FormUtil {
|
||||
}
|
||||
}
|
||||
|
||||
static async setForm(value: string): Promise<void> {
|
||||
await browser.executeScript(
|
||||
'window.adf.setFormInEditor(`' + value + '`);'
|
||||
);
|
||||
}
|
||||
|
||||
static async setCloudForm(value: string): Promise<void> {
|
||||
await browser.executeScript(
|
||||
'window.adf.setCloudFormInEditor(`' + value + '`);'
|
||||
);
|
||||
}
|
||||
|
||||
async getFormByName(name: string): Promise<FormRepresentation> {
|
||||
const forms: any = await this.editorApi.getForms(undefined);
|
||||
|
||||
|
@@ -18,53 +18,27 @@
|
||||
import { browser } from 'protractor';
|
||||
|
||||
export class LocalStorageUtil {
|
||||
|
||||
static async getConfigField(field: string): Promise<any> {
|
||||
return browser.executeScript(
|
||||
'return window.adf ? window.adf.getConfigField(`' + field + '`) : null;'
|
||||
);
|
||||
return browser.executeScript('return window.adf ? window.adf.getConfigField(`' + field + '`) : null;');
|
||||
}
|
||||
|
||||
static async setConfigField(field: string, value: string): Promise<void> {
|
||||
await browser.executeScript(
|
||||
'window.adf.setConfigField(`' + field + '`, `' + value + '`);'
|
||||
);
|
||||
await browser.executeScript('window.adf.setConfigField(`' + field + '`, `' + value + '`);');
|
||||
}
|
||||
|
||||
static async setStorageItem(field: string, value: string): Promise<void> {
|
||||
await browser.executeScript(
|
||||
'window.adf.setStorageItem(`' + field + '`, `' + value + '`);'
|
||||
);
|
||||
}
|
||||
|
||||
static async removeStorageItem(field: string): Promise<void> {
|
||||
await browser.executeScript(
|
||||
'window.adf.removeStorageItem(`' + field + '`);'
|
||||
);
|
||||
}
|
||||
|
||||
static async getStorageItem(field: string): Promise<any> {
|
||||
return browser.executeScript(
|
||||
'return window.adf ? window.adf.getStorageItem(`' + field + '`) : null;'
|
||||
);
|
||||
await browser.executeScript('window.adf.setStorageItem(`' + field + '`, `' + value + '`);');
|
||||
}
|
||||
|
||||
static async setUserPreference(field: string, value: any): Promise<void> {
|
||||
await browser.executeScript(
|
||||
'window.adf.setUserPreference(`' + field + '`, `' + value + '`);'
|
||||
);
|
||||
await browser.executeScript('window.adf.setUserPreference(`' + field + '`, `' + value + '`);');
|
||||
}
|
||||
|
||||
static async clearStorage(): Promise<void> {
|
||||
await browser.executeScript(
|
||||
'window.adf.clearStorage();'
|
||||
);
|
||||
await browser.executeScript('window.adf.clearStorage();');
|
||||
}
|
||||
|
||||
static async apiReset(): Promise<void> {
|
||||
await browser.executeScript(
|
||||
`window.adf.apiReset();`
|
||||
);
|
||||
await browser.executeScript(`window.adf.apiReset();`);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user