[ADF-5146] Upgrade to Angular 10 (#5834)

* remove useless module

* upgrade to angular 8

* upgrade material to v8

* upgrade adf libs

* migrate demo shell to v8

* upgrade to angular 9

* upgrade material to v9

* remove hammer

* upgrade nx

* upgrade datetime picker

* upgrade flex layout

* update core api

* remove entry components

* code fixes

* upgrade testbed usage

* code fixes

* remove unnecessary core-js from tests

* upgrade CLI

* ts config fixes

* fix builds

* fix testing config

* compile fixes

* fix demo shell dev setup

* fix core tests

* fix card view import

* upgrade nx

* disable smart builds for now

* remove fdescribe

* restore smart builds

* fix issues

* unify tsconfigs and fix newly found issues

* fix configuration and cleanup package scripts

* improved production build from the same config

* use ADF libs directly instead of node_modules

* disable smart build

* single app configuration (angular)

* fix core build

* fix build scripts

* lint fixes

* fix linting setup

* fix linting rules

* various fixes

* disable affected libs for unit tests

* cleanup insights package.json

* simplify smart-build

* fix content tests

* fix tests

* test fixes

* fix tests

* fix test

* fix tests

* disable AppExtensionsModule (monaco example)

* remove monaco extension module

* upgrade bundle check rules

* fix insights tests and karma config

* fix protractor config

* e2e workaround

* upgrade puppeteer and split linting and build

* reusable resources config

* update protractor config

* fix after rebase

* fix protractor config

* fix e2e tsconfig

* update e2e setup

* Save demoshell artifact on S3 and remove travis cache

* Push the libs on S3 and fetch before releasing it

* Add deps

* Add dependencies among libs and run only affected unit test and build

* fix the travis stage name

* fix after renaming dev to demoshell

* force the order of the projects

* remove unused dependencies

* fix content e2e script

* exit codes fix

* add extra exit codes to core e2e

* postinstall hook and package cleanup

* cleanup packages

* remove deprecated code and dependency on router

* improve bundle analyzer script

* minor code fixes

* update spec

* fix code after rebase

* upgrade protractor after rebase

* fix e2e mapping lib

* Update tsconfig.e2e.json

* update e2e tsconfig

* fix angular config

* fix protractor runs

* cache dist folder for libs

* update material selectors for dropdowns

* selector fixes

* remove duplicated e2e that have unit tests already

* fix login selector

* fix e2e

* fix test

* fix import issues

* fix selector

* cleanup old monaco extension files

* cleanup demo shell login

* add protractor max retries

* disable customisations of protractor

* fix login validation

* fix after rebase

* fix after rebase, disable latest versions of libs

* Hide the report tab and rollback the localstorage

* rename protractor config back to js

* restore lint as part of build

* cleanup code

* do not copy anything to node_modules on dist test

* fix unit tests

* config fixes

* fix code

* fix code after rebase

* fix tests

* remove existing words from spellcheck

* remove useless directive decorators

* update package.json after rebase

* add js-api back

* code fixes

* add missing export

* update configs

* fix code

* try fix the sso login test

* fix

* remove puppeteer unit

* fix e2e script

* fix

* make provider easy

* fix routes module before upgrade

* fix unit tests

* upgrade angular cli

* upgrade to angular 10

Co-authored-by: maurizio vitale <maurizio.vitale@alfresco.com>
Co-authored-by: Eugenio Romano <eugenio.romano@alfresco.com>
Co-authored-by: Eugenio Romano <eromano@users.noreply.github.com>
This commit is contained in:
Denys Vuika
2020-07-03 13:01:05 +01:00
committed by GitHub
co-authored by maurizio vitale Eugenio Romano Eugenio Romano
parent 2f0a585273
commit cd2b489100
579 changed files with 15689 additions and 10745 deletions
+1
View File
@@ -18,6 +18,7 @@
import * as path from 'path';
import * as fs from 'fs';
import * as remote from 'selenium-webdriver/remote';
import { browser } from 'protractor';
import { ImageUploadRepresentation, UserRepresentation } from '@alfresco/js-api';
import { ApiService, IdentityService, UserModel, Logger } from '@alfresco/adf-testing';
@@ -85,7 +85,6 @@ describe('Version Properties', () => {
await versionManagePage.enableDownload();
await versionManagePage.clickActionButton('1.0');
await BrowserVisibility.waitUntilElementIsVisible(element(by.css(`[id="adf-version-list-action-download-1.0"]`)));
await versionManagePage.closeActionsMenu();
});
it('[C269085] Should show/hide comments when showComments true/false', async () => {
-39
View File
@@ -1,39 +0,0 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* 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 { ErrorPage, LoginSSOPage, SettingsPage, BrowserActions } from '@alfresco/adf-testing';
import { browser } from 'protractor';
describe('Auth Guard SSO', () => {
const settingsPage = new SettingsPage();
const loginSSOPage = new LoginSSOPage();
const errorPage = new ErrorPage();
it('[C307058] Should be redirected to 403 when user doesn\'t have permissions', async () => {
await settingsPage.setProviderEcmSso(browser.params.testConfig.adf.url,
browser.params.testConfig.appConfig.oauth2.host,
browser.params.testConfig.appConfig.identityHost,
false, true, browser.params.testConfig.appConfig.oauth2.clientId);
await loginSSOPage.loginSSOIdentityService(browser.params.testConfig.admin.email, browser.params.testConfig.admin.password);
await BrowserActions.getUrl(browser.params.testConfig.adf.url + '/cloud/simple-app');
await browser.sleep(1000);
const error = await errorPage.getErrorCode();
await expect(error).toBe('403');
});
});
-26
View File
@@ -48,8 +48,6 @@ describe('Login component', () => {
password: 'Enter your password to sign in',
required: 'Required'
};
const invalidUsername = 'invaliduser';
const invalidPassword = 'invalidpassword';
const apiService = new ApiService();
const usersActions = new UsersActions(apiService);
@@ -128,18 +126,6 @@ describe('Login component', () => {
await loginPage.clearPassword();
});
it('[C260046] Should NOT be possible to login with an invalid username/password', async () => {
await loginPage.goToLoginPage();
await expect(await loginPage.getSignInButtonIsEnabled()).toBe(false);
await loginPage.enterUsername('impossible-user');
await loginPage.enterPassword('impossible-password');
await expect(await loginPage.getSignInButtonIsEnabled()).toBe(true);
await loginPage.clickSignInButton();
await expect(await loginPage.getLoginError()).toEqual(errorMessages.invalid_credentials);
await loginPage.clearUsername();
await loginPage.clearPassword();
});
it('[C260047] Password should be crypted', async () => {
await loginPage.goToLoginPage();
await expect(await loginPage.getSignInButtonIsEnabled()).toBe(false);
@@ -248,16 +234,4 @@ describe('Login component', () => {
await loginPage.enterLogo('https://rawgit.com/Alfresco/alfresco-ng2-components/master/assets/angular2.png');
await loginPage.checkLoginImgURL();
});
it('[C291854] Should be possible login in valid credentials', async () => {
await loginPage.goToLoginPage();
await expect(await loginPage.getSignInButtonIsEnabled()).toBe(false);
await loginPage.enterUsername(invalidUsername);
await expect(await loginPage.getSignInButtonIsEnabled()).toBe(false);
await loginPage.enterPassword(invalidPassword);
await expect(await loginPage.getSignInButtonIsEnabled()).toBe(true);
await loginPage.clickSignInButton();
await expect(await loginPage.getLoginError()).toEqual(errorMessages.invalid_credentials);
await loginPage.login(browser.params.testConfig.admin.email, browser.params.testConfig.admin.password);
});
});
+7 -3
View File
@@ -43,11 +43,15 @@ describe('Login component - SSO', () => {
});
it('[C280667] Should be redirect directly to keycloak without show the login page with silent login', async () => {
await settingsPage.setProviderEcmSso(browser.params.testConfig.appConfig.ecmHost,
await settingsPage.setProviderEcmSso(
browser.params.testConfig.appConfig.ecmHost,
browser.params.testConfig.appConfig.oauth2.host,
browser.params.testConfig.appConfig.identityHost, true, true, browser.params.testConfig.appConfig.oauth2.clientId);
browser.params.testConfig.appConfig.identityHost,
true,
true,
browser.params.testConfig.appConfig.oauth2.clientId
);
await browser.refresh();
await loginSSOPage.loginSSOIdentityService(browser.params.testConfig.admin.email, browser.params.testConfig.admin.password);
});
});
-91
View File
@@ -1,91 +0,0 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* 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 { ApiService, LoginSSOPage, StringUtil, UploadActions, ViewerPage, UserModel } from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../pages/adf/navigation-bar.page';
import { ContentServicesPage } from '../../pages/adf/content-services.page';
import { MonacoExtensionPage } from '../../pages/adf/demo-shell/monaco-extension.page';
import CONSTANTS = require('../../util/constants');
import { FileModel } from '../../models/ACS/file.model';
import { UsersActions } from '../../actions/users.actions';
describe('Viewer', () => {
const viewerPage = new ViewerPage();
const navigationBarPage = new NavigationBarPage();
const loginPage = new LoginSSOPage();
const contentServicesPage = new ContentServicesPage();
const acsUser = new UserModel();
const monacoExtensionPage = new MonacoExtensionPage();
const apiService = new ApiService();
const usersActions = new UsersActions(apiService);
const uploadActions = new UploadActions(apiService);
let site;
let jsFileUploaded;
const jsFileInfo = new FileModel({
'name': browser.params.resources.Files.ADF_DOCUMENTS.JS.file_name,
'location': browser.params.resources.Files.ADF_DOCUMENTS.JS.file_path
});
beforeAll(async () => {
await apiService.getInstance().login(browser.params.testConfig.admin.email, browser.params.testConfig.admin.password);
await usersActions.createUser(acsUser);
site = await apiService.getInstance().core.sitesApi.createSite({
title: StringUtil.generateRandomString(8),
visibility: 'PUBLIC'
});
await apiService.getInstance().core.sitesApi.addSiteMember(site.entry.id, {
id: acsUser.email,
role: CONSTANTS.CS_USER_ROLES.MANAGER
});
await apiService.getInstance().login(acsUser.email, acsUser.password);
jsFileUploaded = await uploadActions.uploadFile(jsFileInfo.location, jsFileInfo.name, '-my-');
await loginPage.login(acsUser.email, acsUser.password);
});
afterAll(async () => {
await apiService.getInstance().core.sitesApi.deleteSite(site.entry.id, { permanent: true });
await apiService.getInstance().login(acsUser.email, acsUser.password);
await uploadActions.deleteFileOrFolder(jsFileUploaded.entry.id);
});
describe('Viewer extension', () => {
it('[C297698] Should be able to add an extension for code editor viewer', async () => {
await navigationBarPage.clickAboutButton();
await monacoExtensionPage.checkMonacoPluginIsDisplayed();
await navigationBarPage.clickContentServicesButton();
await contentServicesPage.waitForTableBody();
await contentServicesPage.checkContentIsDisplayed(jsFileInfo.name);
await contentServicesPage.doubleClickRow(jsFileInfo.name);
await viewerPage.checkCodeViewerIsDisplayed();
});
});
});
+1 -2
View File
@@ -83,11 +83,10 @@ export class ContentServicesPage {
favoriteButton = element(by.css('button[data-automation-id="favorite"]'));
markedFavorite = element(by.cssContainingText('button[data-automation-id="favorite"] mat-icon', 'star'));
notMarkedFavorite = element(by.cssContainingText('button[data-automation-id="favorite"] mat-icon', 'star_border'));
multiSelectToggle = element(by.cssContainingText('span.mat-slide-toggle-content', ' Multiselect (with checkboxes) '));
multiSelectToggle = element(by.css('[data-automation-id="multiSelectToggle"]'));
selectAllCheckbox = element.all(by.css('.adf-checkbox-sr-only')).first();
selectionModeDropdown = element(by.css('.mat-select[aria-label="Selection Mode"]'));
selectedNodesList = element.all(by.css('.app-content-service-settings li'));
siteListDropdown = new DropdownPage(element(by.css(`mat-select[data-automation-id='site-my-files-option']`)));
sortingDropdown = new DropdownPage(element(by.css('mat-select[data-automation-id="grid-view-sorting"]')));
+1 -1
View File
@@ -33,7 +33,7 @@ export class DataTablePage {
};
dataTable: DataTableComponentPage;
multiSelect = element(by.css(`div[data-automation-id='multiselect'] label > div[class='mat-checkbox-inner-container']`));
multiSelect = element(by.css(`div[data-automation-id='multiselect'] label > .mat-checkbox-inner-container`));
reset = element(by.xpath(`//span[contains(text(),'Reset to default')]/..`));
allSelectedRows = element.all(by.css(`adf-datatable-row[class*='is-selected']`));
selectedRowNumber = element(by.css(`adf-datatable-row[class*='is-selected'] div[data-automation-id*='text_']`));
+12 -12
View File
@@ -21,7 +21,6 @@ import { TogglePage, BrowserActions, BrowserVisibility, LoginSSOPage } from '@al
export class LoginPage {
loginURL = browser.baseUrl + '/login';
loginSSOPage = new LoginSSOPage();
togglePage = new TogglePage();
@@ -30,20 +29,21 @@ export class LoginPage {
logoImg = element(by.css('img[id="adf-login-img-logo"]'));
successRouteTxt = element(by.css('input[data-automation-id="adf-success-route"]'));
logoTxt = element(by.css('input[data-automation-id="adf-url-logo"]'));
usernameTooltip = element(by.css('span[data-automation-id="username-error"]'));
passwordTooltip = element(by.css('span[data-automation-id="password-required"]'));
loginTooltip = element(by.css('span[class="adf-login-error-message"]'));
usernameError = element(by.css('span[data-automation-id="username-error"]'));
passwordError = element(by.css('span[data-automation-id="password-required"]'));
loginError = element(by.css('.adf-login-error-message'));
usernameInactive = element(by.css('input[id="username"][aria-invalid="false"]'));
passwordInactive = element(by.css('input[id="password"][aria-invalid="false"]'));
adfLogo = element(by.css('img[class="adf-img-logo ng-star-inserted"]'));
adfLogo = element(by.css('.adf-img-logo'));
usernameHighlighted = element(by.css('input[id="username"][aria-invalid="true"]'));
passwordHighlighted = element(by.css('input[id="password"][aria-invalid="true"]'));
signInButton = element(by.id('login-button'));
showPasswordElement = element(by.css('button[data-automation-id="show_password"]'));
hidePasswordElement = element(by.css('button[data-automation-id="hide_password"]'));
rememberMe = element(by.css('mat-checkbox[id="adf-login-remember"]'));
needHelp = element(by.css('div[id="adf-login-action-left"]'));
register = element(by.css('div[id="adf-login-action-right"]'));
needHelp = element(by.id('adf-login-action-left'));
register = element(by.id('adf-login-action-right'));
footerSwitch = element(by.id('switch4'));
rememberMeSwitch = element(by.id('adf-toggle-show-rememberme'));
successRouteSwitch = element(by.id('adf-toggle-show-successRoute'));
@@ -81,15 +81,15 @@ export class LoginPage {
}
async getUsernameTooltip(): Promise<string> {
return BrowserActions.getText(this.usernameTooltip);
return BrowserActions.getText(this.usernameError);
}
async getPasswordTooltip(): Promise<string> {
return BrowserActions.getText(this.passwordTooltip);
return BrowserActions.getText(this.passwordError);
}
async getLoginError(): Promise<string> {
return BrowserActions.getText(this.loginTooltip);
return BrowserActions.getText(this.loginError);
}
async checkLoginImgURL(): Promise<string> {
@@ -116,11 +116,11 @@ export class LoginPage {
}
async checkUsernameTooltipIsNotVisible(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.usernameTooltip);
await BrowserVisibility.waitUntilElementIsNotVisible(this.usernameError);
}
async checkPasswordTooltipIsNotVisible(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.passwordTooltip);
await BrowserVisibility.waitUntilElementIsNotVisible(this.passwordError);
}
async getSignInButtonIsEnabled(): Promise<boolean> {
@@ -1,28 +0,0 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* 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 { BrowserVisibility } from '@alfresco/adf-testing';
export class MonacoExtensionPage {
monacoPlugin = element(by.cssContainingText('mat-row > mat-cell', 'monaco plugin'));
async checkMonacoPluginIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.monacoPlugin);
}
}
@@ -22,7 +22,7 @@ export class ProcessListDemoPage {
appIdInput = element(by.css('input[data-automation-id="app-id"]'));
resetButton = element(by.cssContainingText('button span', 'Reset'));
emptyProcessContent = element(by.css('div[class="adf-empty-content"]'));
emptyProcessContent = element(by.css('.adf-empty-content'));
processDefinitionInput = element(by.css('input[data-automation-id="process-definition-id"]'));
processInstanceInput = element(by.css('input[data-automation-id="process-instance-id"]'));
@@ -43,7 +43,7 @@ export class ProcessListDemoPage {
await this.stateDropdown.selectDropdownOption(stateOption);
}
async addAppId(appId): Promise<void> {
async addAppId(appId: string): Promise<void> {
await BrowserActions.click(this.appIdInput);
await this.appIdInput.sendKeys(protractor.Key.ENTER);
await this.appIdInput.clear();
@@ -54,7 +54,7 @@ export class ProcessListDemoPage {
await BrowserActions.click(this.resetButton);
}
async checkErrorMessageIsDisplayed(error): Promise<void> {
async checkErrorMessageIsDisplayed(error: string): Promise<void> {
const errorMessage = element(by.cssContainingText('mat-error', error));
await BrowserVisibility.waitUntilElementIsVisible(errorMessage);
}
@@ -87,11 +87,11 @@ export class ProcessListDemoPage {
await this.sortDropdown.checkDropdownIsVisible();
}
async addProcessDefinitionId(procDefinitionId): Promise<void> {
async addProcessDefinitionId(procDefinitionId: string): Promise<void> {
await BrowserActions.clearSendKeys(this.processDefinitionInput, procDefinitionId);
}
async addProcessInstanceId(procInstanceId): Promise<void> {
async addProcessInstanceId(procInstanceId: string): Promise<void> {
await BrowserActions.clearSendKeys(this.processInstanceInput, procInstanceId);
}
}
@@ -21,7 +21,7 @@ import { TasksListPage } from '../../process-services/tasks-list.page';
export class TaskListDemoPage {
taskListPage: TasksListPage = new TasksListPage();
taskListPage = new TasksListPage();
appId = element(by.css("input[data-automation-id='appId input']"));
itemsPerPage = element(by.css("input[data-automation-id='items per page']"));
itemsPerPageForm = element(by.css("mat-form-field[data-automation-id='items per page']"));
@@ -30,7 +30,7 @@ export class TaskListDemoPage {
page = element(by.css("input[data-automation-id='page']"));
pageForm = element(by.css("mat-form-field[data-automation-id='page']"));
taskName = element(by.css("input[data-automation-id='task name']"));
resetButton = element(by.css("div[class='app-reset-button'] button"));
resetButton = element(by.css('.app-reset-button button'));
dueBefore = element(by.css("input[data-automation-id='due before']"));
dueAfter = element(by.css("input[data-automation-id='due after']"));
taskId = element(by.css("input[data-automation-id='task id']"));
+1 -1
View File
@@ -24,7 +24,7 @@ export class SearchDialogPage {
searchBar = element(by.css(`adf-search-control input`));
searchBarExpanded = element(by.css(`adf-search-control mat-form-field[class*="mat-focused"] input`));
noResultMessage = element(by.css(`p[class*='adf-search-fixed-text']`));
rowsAuthor = by.css(`div[class='mat-list-text'] p[class*='adf-search-fixed-text']`);
rowsAuthor = by.css(`.mat-list-text p[class*='adf-search-fixed-text']`);
completeName = by.css(`h4[class*='adf-search-fixed-text']`);
highlightName = by.css(`.adf-highlight`);
searchDialog = element(by.css(`mat-list[id='autocomplete-search-result-list']`));
+2 -3
View File
@@ -31,8 +31,8 @@ export class UploadDialogPage {
title = element(by.css('span[class*="upload-dialog__title"]'));
minimizeButton = element(by.css('mat-icon[title="Minimize"]'));
maximizeButton = element(by.css('mat-icon[title="Maximize"]'));
canUploadConfirmationTitle = element(by.css('p[class="upload-dialog__confirmation--title"]'));
canUploadConfirmationDescription = element(by.css('p[class="upload-dialog__confirmation--text"]'));
canUploadConfirmationTitle = element(by.css('.upload-dialog__confirmation--title'));
canUploadConfirmationDescription = element(by.css('.upload-dialog__confirmation--text'));
confirmationDialogNoButton = element(by.partialButtonText('No'));
confirmationDialogYesButton = element(by.partialButtonText('Yes'));
cancelUploadsElement = element((by.css('footer[class*="upload-dialog__actions"] button[id="adf-upload-dialog-cancel-all"]')));
@@ -162,5 +162,4 @@ export class UploadDialogPage {
async getTooltip(): Promise<string> {
return BrowserActions.getText(this.errorTooltip);
}
}
+18 -4
View File
@@ -18,16 +18,30 @@
import {
DataTableComponentPage,
AddPermissionsDialogPage,
BrowserVisibility
BrowserVisibility,
BrowserActions
} from '@alfresco/adf-testing';
import { by, element } from 'protractor';
export class PermissionsPage {
dataTableComponentPage: DataTableComponentPage = new DataTableComponentPage();
addPermissionsDialog: AddPermissionsDialogPage = new AddPermissionsDialogPage();
dataTableComponentPage = new DataTableComponentPage();
addPermissionsDialog = new AddPermissionsDialogPage();
addPermissionButton = element(by.css('button[data-automation-id="adf-add-permission-button"]'));
addPermissionButton = element(by.css("button[data-automation-id='adf-add-permission-button']"));
addPermissionDialog = element(by.css('adf-add-permission-dialog'));
searchUserInput = element(by.id('searchInput'));
searchResults = element(by.css('#adf-add-permission-authority-results #adf-search-results-content'));
addButton = element(by.id('add-permission-dialog-confirm-button'));
permissionInheritedButton = element.all(by.css('.app-inherit_permission_button button')).first();
noPermissions = element(by.id('adf-no-permissions-template'));
deletePermissionButton = element(by.css(`button[data-automation-id='adf-delete-permission-button']`));
permissionDisplayContainer = element(by.id('adf-permission-display-container'));
closeButton = element(by.id('add-permission-dialog-close-button'));
async clickCloseButton(): Promise<void> {
await BrowserActions.click(this.closeButton);
}
async checkAddPermissionButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.addPermissionButton);
@@ -25,8 +25,8 @@ export class AttachFormPage {
completeButton = element(by.id('adf-attach-form-complete-button'));
formDropdown = element(by.id('form_id'));
cancelButton = element(by.id('adf-attach-form-cancel-button'));
defaultTitle = element(by.css('mat-card-title[class="mat-card-title mat-card-title"]'));
attachFormDropdown = new DropdownPage(element(by.css("div[class='adf-attach-form-row']")));
defaultTitle = element(by.css('.mat-card-title'));
attachFormDropdown = new DropdownPage(element(by.css('.adf-attach-form-row')));
async checkNoFormMessageIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.noFormMessage);
@@ -44,7 +44,7 @@ export class AttachFormPage {
await BrowserActions.click(this.attachFormButton);
}
async checkDefaultFormTitleIsDisplayed(formTitle): Promise<void> {
async checkDefaultFormTitleIsDisplayed(formTitle: string): Promise<void> {
const result = await BrowserActions.getText(this.defaultTitle);
await expect(result).toEqual(formTitle);
}
@@ -57,7 +57,7 @@ export class AttachFormPage {
await BrowserVisibility.waitUntilElementIsVisible(this.cancelButton);
}
async selectAttachFormOption(option): Promise<void> {
async selectAttachFormOption(option: string): Promise<void> {
await this.attachFormDropdown.selectDropdownOption(option);
}
@@ -19,8 +19,8 @@ import { by, element, protractor } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class ProcessDetailsPage {
processTitle = element(by.css('mat-card-title[class="mat-card-title"]'));
processDetailsMessage = element(by.css('adf-process-instance-details div[class="ng-star-inserted"]'));
processTitle = element(by.css('.mat-card-title'));
processDetailsMessage = element(by.css('adf-process-instance-details div'));
processStatusField = element(by.css('[data-automation-id="card-textitem-value-status"]'));
processEndDateField = element(by.css('span[data-automation-id="card-dateitem-ended"]'));
processCategoryField = element(by.css('[data-automation-id="card-textitem-value-category"]'));
@@ -30,17 +30,17 @@ export class ProcessDetailsPage {
processIdField = element(by.css('[data-automation-id="card-textitem-value-id"]'));
processDescription = element(by.css('[data-automation-id="card-textitem-value-description"]'));
showDiagramButtonDisabled = element(by.css('button[id="show-diagram-button"][disabled]'));
propertiesList = element(by.css('div[class="adf-property-list"]'));
propertiesList = element(by.css('.adf-property-list'));
showDiagramButton = element(by.id('show-diagram-button'));
diagramCanvas = element(by.css('svg[xmlns="http://www.w3.org/2000/svg"]'));
backButton = element(by.css('app-show-diagram button[class="mat-mini-fab mat-accent"]'));
backButton = element(by.css('app-show-diagram button.mat-mini-fab.mat-accent'));
commentInput = element(by.id('comment-input'));
auditLogButton = element(by.css('button[adf-process-audit]'));
auditLogEmptyListMessage = element(by.css('.app-empty-list-header'));
cancelProcessButton = element(by.css('div[data-automation-id="header-status"] > button'));
activeTask = element(by.css('div[data-automation-id="active-tasks"]'));
completedTask = element(by.css('div[data-automation-id="completed-tasks"]'));
taskTitle = element(by.css('h2[class="adf-activiti-task-details__header"]'));
taskTitle = element(by.css('.adf-activiti-task-details__header'));
async checkDetailsAreDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.processStatusField);
@@ -109,7 +109,7 @@ export class ProcessDetailsPage {
await BrowserVisibility.waitUntilElementIsVisible(this.showDiagramButtonDisabled);
}
async addComment(comment): Promise<void> {
async addComment(comment: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.commentInput);
await this.commentInput.sendKeys(comment);
await this.commentInput.sendKeys(protractor.Key.ENTER);
@@ -26,12 +26,12 @@ export class ProcessFiltersPage {
allFilter = element(by.css('button[data-automation-id="All_filter"]'));
createProcessButton = element(by.css('.app-processes-menu button[data-automation-id="create-button"] > span'));
newProcessButton = element(by.css('div > button[data-automation-id="btn-start-process"]'));
processesPage = element(by.css('div[class="app-grid"] > div[class="app-grid-item app-processes-menu"]'));
processesPage = element(by.id('app-processes-menu'));
accordionMenu = element(by.css('.app-processes-menu mat-accordion'));
buttonWindow = element(by.css('div > button[data-automation-id="btn-start-process"] > div'));
noContentMessage = element.all(by.css('div[class="adf-empty-content__title"]')).first();
rows = by.css('adf-process-instance-list div[class="adf-datatable-body"] adf-datatable-row[class*="adf-datatable-row"]');
tableBody = element.all(by.css('adf-datatable div[class="adf-datatable-body"]')).first();
noContentMessage = element.all(by.css('.adf-empty-content__title')).first();
rows = by.css('adf-process-instance-list .adf-datatable-body adf-datatable-row[class*="adf-datatable-row"]');
tableBody = element.all(by.css('adf-datatable .adf-datatable-body')).first();
nameColumn = by.css('div[class*="adf-datatable-body"] adf-datatable-row[class*="adf-datatable-row"] div[title="Name"] span');
processIcon = by.css('adf-icon[data-automation-id="adf-filter-icon"]');
@@ -20,7 +20,7 @@ import { element, by } from 'protractor';
export class ProcessListPage {
processListTitle = element(by.css('div[class="adf-empty-content__title"]'));
processListTitle = element(by.css('.adf-empty-content__title'));
processInstanceList = element(by.css('adf-process-instance-list'));
getDisplayedProcessListTitle(): Promise<string> {
@@ -19,11 +19,10 @@ import { ProcessServiceTabBarPage } from './process-service-tab-bar.page';
import { element, by } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
import { __await } from 'tslib';
export class ProcessServicesPage {
apsAppsContainer = element(by.css('div[class="adf-app-listgrid ng-star-inserted"]'));
apsAppsContainer = element(by.css('.adf-app-listgrid'));
taskApp = element(by.css('mat-card[title="Task App"]'));
iconTypeLocator = by.css('mat-icon[class*="card-logo-icon"]');
descriptionLocator = by.css('mat-card-subtitle[class*="subtitle"]');
@@ -72,5 +71,4 @@ export class ProcessServicesPage {
const app = element(by.css('mat-card[title="' + applicationName + '"]'));
await BrowserVisibility.waitUntilElementIsVisible(app);
}
}
@@ -50,11 +50,11 @@ export class TaskDetailsPage {
taskDetailsEmptySection = element(by.css('div[data-automation-id="adf-tasks-details--empty"]'));
completeTask = element(by.css('button[id="adf-no-form-complete-button"]'));
completeFormTask = element(by.css('button[id="adf-form-complete"]'));
taskDetailsTitle = element(by.css('h2[class="adf-activiti-task-details__header"] span'));
taskDetailsTitle = element(by.css('.adf-activiti-task-details__header span'));
auditLogButton = element(by.css('button[adf-task-audit]'));
noPeopleInvolved = element(by.id('no-people-label'));
cancelInvolvePeopleButton = element(by.id('close-people-search'));
involvePeopleHeader = element(by.css('div[class="adf-search-text-header"]'));
involvePeopleHeader = element(by.css('.adf-search-text-header'));
removeInvolvedPeople = element(by.css('button[data-automation-id="Remove"]'));
peopleTitle = element(by.id('people-title'));
noFormMessage = element(by.css('span[id*="no-form-message"]'));
@@ -62,7 +62,7 @@ export class TaskDetailsPage {
attachFormButton = element(by.id('adf-no-form-attach-form-button'));
disabledAttachFormButton = element(by.css('button[id="adf-no-form-attach-form-button"][disabled]'));
removeAttachForm = element(by.id('adf-attach-form-remove-button'));
attachFormName = element(by.css('span[class="adf-form-title ng-star-inserted"]'));
attachFormName = element(by.css('.adf-form-title'));
emptyTaskDetails = element(by.css('adf-task-details > div > div'));
priority = element(by.css('[data-automation-id*="card-textitem-value-priority"]'));
editableAssignee = element(by.css('[data-automation-id="card-textitem-value-assignee"][class*="clickable"]'));
@@ -70,7 +70,7 @@ export class TaskDetailsPage {
releaseElement = element(by.css('[data-automation-id="header-unclaim-button"]'));
saveFormButton = element(by.css('button[id="adf-form-save"]'));
attachFormDropdown = new DropdownPage(element(by.css('div[class="adf-attach-form-row"]')));
attachFormDropdown = new DropdownPage(element(by.css('.adf-attach-form-row')));
async checkEditableAssigneeIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.editableAssignee);
@@ -21,7 +21,7 @@ import { by, element } from 'protractor';
export class TasksListPage {
taskList = element(by.css('adf-tasklist'));
noTasksFound = element.all(by.css("div[class='adf-empty-content__title']")).first();
noTasksFound = element.all(by.css('.adf-empty-content__title')).first();
dataTable = new DataTableComponentPage(this.taskList);
getDataTable(): DataTableComponentPage {
+13 -15
View File
@@ -25,13 +25,12 @@ import { element, by } from 'protractor';
import { BrowserVisibility, BrowserActions, FormFields } from '@alfresco/adf-testing';
export class TasksPage {
createButton = element(by.css('button[data-automation-id="create-button"'));
newTaskButton = element(by.css('button[data-automation-id="btn-start-task"]'));
addChecklistButton = element(by.css('button[class*="adf-add-to-checklist-button"]'));
rowByRowName = by.xpath('ancestor::mat-chip');
checklistContainer = by.css('div[class*="checklist-menu"]');
taskTitle = 'h2[class="adf-activiti-task-details__header"] span';
taskTitle = '.adf-activiti-task-details__header span';
rows = by.css('div[class*="adf-datatable-body"] adf-datatable-row[class*="adf-datatable-row"] div[class*="adf-datatable-cell"]');
completeButtonNoForm = element(by.id('adf-no-form-complete-button'));
checklistDialog = element(by.id('checklist-dialog'));
@@ -89,24 +88,23 @@ export class TasksPage {
return new ChecklistDialog();
}
getRowsName(name) {
const row = element(this.checklistContainer).element(by.cssContainingText('span', name));
return row;
getRowsName(name: string) {
return element(this.checklistContainer).element(by.cssContainingText('span', name));
}
getChecklistByName(checklist) {
const elem = this.getRowsName(checklist);
getChecklistByName(name: string) {
const elem = this.getRowsName(name);
const row = elem.element(this.rowByRowName);
return row;
}
async checkChecklistIsDisplayed(checklist): Promise<void> {
const checklistEle = this.getChecklistByName(checklist);
async checkChecklistIsDisplayed(name: string): Promise<void> {
const checklistEle = this.getChecklistByName(name);
await BrowserVisibility.waitUntilElementIsVisible(checklistEle);
}
async checkChecklistIsNotDisplayed(checklist: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(element(this.checklistContainer).element(by.cssContainingText('span', checklist)));
async checkChecklistIsNotDisplayed(name: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(element(this.checklistContainer).element(by.cssContainingText('span', name)));
}
async checkTaskTitle(taskName: string): Promise<void> {
@@ -139,14 +137,14 @@ export class TasksPage {
return BrowserActions.getText(this.numberOfChecklists);
}
async removeChecklists(checklist): Promise<void> {
const elem = this.getRowsName(checklist);
async removeChecklists(name: string): Promise<void> {
const elem = this.getRowsName(name);
const row = elem.element(this.rowByRowName);
await BrowserActions.click(row.element(by.css('mat-icon')));
}
async checkChecklistsRemoveButtonIsNotDisplayed(checklist): Promise<void> {
const elem = this.getRowsName(checklist);
async checkChecklistsRemoveButtonIsNotDisplayed(name: string): Promise<void> {
const elem = this.getRowsName(name);
const row = elem.element(this.rowByRowName);
await BrowserVisibility.waitUntilElementIsNotVisible(row.element(by.css('mat-icon')));
}
+1 -1
View File
@@ -21,7 +21,7 @@ import { ContentServicesPage } from './content-services.page';
export class SearchResultsPage {
noResultsMessage = element(by.css('div[class="app-no-result-message"]'));
noResultsMessage = element(by.css('.app-no-result-message'));
dataTable = new DataTableComponentPage();
searchSortingPicker = new SearchSortingPickerPage();
contentServices = new ContentServicesPage();
+7 -7
View File
@@ -20,7 +20,7 @@ import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class TagPage {
addTagButton = element(by.css('button[id="add-tag"]'));
addTagButton = element(by.id('add-tag'));
insertNodeIdElement = element(by.css('input[id="nodeId"]'));
newTagInput = element(by.css('input[id="new-tag-text"]'));
tagListRow = element(by.css('adf-tag-node-actions-list mat-list-item'));
@@ -50,11 +50,11 @@ export class TagPage {
await this.clickConfirmTag();
}
async addNewTagInput(tag) {
async addNewTagInput(tag: string) {
await BrowserActions.clearSendKeys(this.newTagInput, tag);
}
async addTag(tag): Promise<void> {
async addTag(tag: string): Promise<void> {
await this.addNewTagInput(tag);
await BrowserActions.click(this.addTagButton);
}
@@ -94,12 +94,12 @@ export class TagPage {
await BrowserVisibility.waitUntilElementIsNotVisible(tag);
}
async checkTagIsNotDisplayedInTagListByNodeId(tagName): Promise<void> {
async checkTagIsNotDisplayedInTagListByNodeId(tagName: string): Promise<void> {
const tag = element(by.cssContainingText('span[id*="tag_name"]', tagName));
await BrowserVisibility.waitUntilElementIsNotVisible(tag);
}
async checkTagIsDisplayedInTagListByNodeId(tagName): Promise<void> {
async checkTagIsDisplayedInTagListByNodeId(tagName: string): Promise<void> {
const tag = element(by.cssContainingText('span[id*="tag_name"]', tagName));
await BrowserVisibility.waitUntilElementIsVisible(tag);
}
@@ -112,8 +112,8 @@ export class TagPage {
await BrowserVisibility.waitUntilElementIsNotVisible(this.tagListByNodeIdRow);
}
async checkTagIsDisplayedInTagListContentServices(tagName): Promise<void> {
const tag = element(by.cssContainingText('div[class="adf-list-tag"][id*="tag_name"]', tagName));
async checkTagIsDisplayedInTagListContentServices(tagName: string): Promise<void> {
const tag = element(by.cssContainingText('.adf-list-tag[id*="tag_name"]', tagName));
await BrowserVisibility.waitUntilElementIsVisible(tag);
}
+1 -1
View File
@@ -22,7 +22,7 @@ export class TrashcanPage {
contentList = new DocumentListPage(element(by.css('adf-document-list')));
rows = by.css('adf-document-list div[class*="adf-datatable-body"] adf-datatable-row[class*="adf-datatable-row"]');
tableBody = element.all(by.css('adf-document-list div[class="adf-datatable-body"]')).first();
tableBody = element.all(by.css('adf-document-list .adf-datatable-body')).first();
pagination = element(by.css('adf-pagination'));
emptyTrashcan = element(by.css('adf-empty-content'));
restoreButton = element(by.css(`button[title='Restore']`));
+291
View File
@@ -0,0 +1,291 @@
const {LocalStorageUtil, ACTIVITI_CLOUD_APPS, Logger} = require('../lib/dist/testing');
const path = require('path');
const {SpecReporter} = require('jasmine-spec-reporter');
const retry = require('protractor-retry').retry;
const tsConfig = require('./tsconfig.e2e.json');
const testConfig = require('./test.config');
const RESOURCES = require('./util/resources');
const smartRunner = require('protractor-smartrunner');
const resolve = require('path').resolve;
const fs = require('fs');
const {uploadScreenshot, cleanReportFolder} = require('./protractor/save-remote');
const argv = require('yargs').argv;
const width = 1657, height = 1657;
const ENV_FILE = process.env.ENV_FILE;
const GROUP_SUFFIX = process.env.PREFIX || 'adf';
RESOURCES.ACTIVITI_CLOUD_APPS = ACTIVITI_CLOUD_APPS;
if (ENV_FILE) {
require('dotenv').config({path: ENV_FILE});
}
const HOST = process.env.URL_HOST_ADF;
const BROWSER_RUN = !!process.env.BROWSER_RUN;
const FOLDER = process.env.FOLDER || '';
const SELENIUM_SERVER = process.env.SELENIUM_SERVER || '';
const MAXINSTANCES = process.env.MAXINSTANCES || 1;
const MAX_RETRIES = process.env.MAX_RETRIES || 4;
const TIMEOUT = parseInt(process.env.TIMEOUT, 10);
const SAVE_SCREENSHOT = (process.env.SAVE_SCREENSHOT === 'true');
const LIST_SPECS = process.env.LIST_SPECS || [];
const LOG = !!process.env.LOG;
let arraySpecs = [];
if (LOG) {
console.log('======= PROTRACTOR CONFIGURATION ====== ');
console.log('HOST: ', HOST);
console.log('BROWSER_RUN : ' + BROWSER_RUN);
console.log('SAVE_SCREENSHOT : ' + SAVE_SCREENSHOT);
console.log('FOLDER : ' + FOLDER);
console.log('MAXINSTANCES : ' + MAXINSTANCES);
console.log('LIST_SPECS : ' + LIST_SPECS);
console.log('MAX_RETRIES: ', MAX_RETRIES);
console.log('SELENIUM_SERVER : ' + SELENIUM_SERVER);
}
const downloadFolder = path.join(__dirname, '/downloads');
let specs = function () {
let LIST_SPECS;
if (process.env.LIST_SPECS) {
LIST_SPECS = process.env.LIST_SPECS;
}
if (LIST_SPECS && LIST_SPECS !== '') {
arraySpecs = LIST_SPECS.split(',');
arraySpecs = arraySpecs.map((el) => './' + el);
specExists(arraySpecs);
} else {
const FOLDER = process.env.FOLDER || '';
setProvider(FOLDER);
const specsToRun = FOLDER ? `./${FOLDER}/**/*.e2e.ts` : './**/*.ts';
arraySpecs = [specsToRun];
}
return arraySpecs;
};
let setProvider = function (folder) {
if (folder === 'core') {
testConfig.appConfig.provider = 'ALL';
} else if (folder === 'content-services') {
testConfig.appConfig.provider = 'ECM';
} else if (folder === 'process-services') {
testConfig.appConfig.provider = 'BPM';
} else if (folder === 'insights') {
testConfig.appConfig.provider = 'BPM';
} else if (folder === 'search') {
testConfig.appConfig.provider = 'ECM';
} else if (folder === 'process-services-cloud') {
testConfig.appConfig.provider = 'BPM';
}
};
let specExists = function (listSpecs) {
listSpecs.forEach((path) => {
if (!fs.existsSync(resolve(__dirname, path))) {
Logger.error(`Not valid spec path : ${resolve(__dirname, path)} valid path should be for example /search/search-component.e2e.ts`);
}
});
};
specs();
exports.config = {
allScriptsTimeout: TIMEOUT,
specs: arraySpecs,
useAllAngular2AppRoots: true,
capabilities: {
loggingPrefs: {
browser: 'ALL' // "OFF", "SEVERE", "WARNING", "INFO", "CONFIG", "FINE", "FINER", "FINEST", "ALL".
},
browserName: 'chrome',
maxInstances: MAXINSTANCES,
shardTestFiles: true,
chromeOptions: {
prefs: {
'credentials_enable_service': false,
'download': {
'prompt_for_download': false,
'directory_upgrade': true,
'default_directory': downloadFolder
},
'browser': {
'setDownloadBehavior': {
'behavior': 'allow',
'downloadPath': downloadFolder
}
}
},
args: ['--incognito',
`--window-size=${width},${height}`,
'--disable-gpu',
'--no-sandbox',
'--disable-web-security',
'--disable-browser-side-navigation',
...(BROWSER_RUN === true ? [] : ['--headless'])]
}
},
directConnect: !SELENIUM_SERVER,
baseUrl: HOST,
params: {
testConfig: testConfig,
loginRoute: '/login',
groupSuffix: GROUP_SUFFIX,
identityAdmin: testConfig.identityAdmin,
identityUser: testConfig.identityUser,
resources: RESOURCES
},
framework: 'jasmine2',
getPageTimeout: 90000,
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 120000,
print: () => {
},
...smartRunner.withOptionalExclusions(
resolve(__dirname, './protractor.excludes.json')
)
},
/**
* The address of a running selenium server (must be manually start before running the tests). If this is specified seleniumServerJar and seleniumPort will be ignored.
* @config {String} seleniumAddress
*/
seleniumAddress: SELENIUM_SERVER,
SELENIUM_PROMISE_MANAGER: false,
plugins: [{
package: 'jasmine2-protractor-utils',
disableScreenshot: false,
screenshotOnExpectFailure: true,
screenshotOnSpecFailure: false,
clearFoldersBeforeTest: true,
screenshotPath: path.resolve(__dirname, 'e2e-output/screenshots/')
}],
onCleanUp(results) {
retry.onCleanUp(results);
},
async onPrepare() {
retry.onPrepare();
jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT;
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.e2e.json')
});
require('tsconfig-paths').register({
project: './e2e/tsconfig.e2e.json',
baseUrl: './e2e/',
paths: tsConfig.compilerOptions.paths
});
// @ts-ignore
browser.driver.sendChromiumCommand('Page.setDownloadBehavior', {
behavior: 'allow',
downloadPath: downloadFolder
});
// @ts-ignore
browser.manage().window().setSize(width, height);
jasmine.getEnv().addReporter(
new SpecReporter({
spec: {
displayStacktrace: true,
displayDuration: true
}
})
);
// @ts-ignore
await browser.driver.executeScript(disableCSSAnimation);
// @ts-ignore
await browser.get(`${HOST}/settings`);
await LocalStorageUtil.clearStorage();
// @ts-ignore
await LocalStorageUtil.setStorageItem('ecmHost', browser.params.testConfig.appConfig.ecmHost);
// @ts-ignore
await LocalStorageUtil.setStorageItem('bpmHost', browser.params.testConfig.appConfig.bpmHost);
// @ts-ignore
await LocalStorageUtil.setStorageItem('providers', browser.params.testConfig.appConfig.provider);
await LocalStorageUtil.setStorageItem('baseShareUrl', HOST);
// @ts-ignore
if (browser.params.testConfig.appConfig.authType === 'OAUTH') {
// @ts-ignore
await LocalStorageUtil.setStorageItem('authType', browser.params.testConfig.appConfig.authType);
// @ts-ignore
await LocalStorageUtil.setStorageItem('identityHost', browser.params.testConfig.appConfig.identityHost);
// @ts-ignore
await LocalStorageUtil.setStorageItem('oauth2', JSON.stringify(browser.params.testConfig.appConfig.oauth2));
}
await LocalStorageUtil.apiReset();
function disableCSSAnimation() {
const css = '* {' +
'-webkit-transition-duration: 0s !important;' +
'transition-duration: 0s !important;' +
'-webkit-animation-duration: 0s !important;' +
'animation-duration: 0s !important;' +
'}';
const head = document.head || document.getElementsByTagName('head')[0];
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode(css));
head.appendChild(style);
}
},
beforeLaunch: function () {
if (SAVE_SCREENSHOT) {
cleanReportFolder();
}
},
afterLaunch: async function () {
if (SAVE_SCREENSHOT) {
let retryCount = 1;
if (argv.retry) {
retryCount = ++argv.retry;
}
try {
await uploadScreenshot(retryCount);
} catch (error) {
console.error('Error saving screenshot', error);
}
}
return retry.afterLaunch(MAX_RETRIES);
}
};
+2 -1
View File
@@ -1,4 +1,5 @@
{
"C290180": "https://issues.alfresco.com/jira/browse/ACS-364"
"C290180": "https://issues.alfresco.com/jira/browse/ACS-364",
"C277201": "Investigate after NG10"
}
+3 -4
View File
@@ -1,7 +1,6 @@
const fs = require('fs');
const rimraf = require('rimraf');
const path = require('path');
const projectRoot = path.resolve(__dirname, '../../');
const TestConfig = require('../test.config');
const AlfrescoApi = require('@alfresco/js-api').AlfrescoApiCompatibility;
@@ -15,7 +14,7 @@ function buildNumber() {
}
async function uploadScreenshot(retryCount) {
let files = fs.readdirSync(path.join(__dirname, '../../e2e-output/screenshots'));
let files = fs.readdirSync(path.join(__dirname, '../e2e-output/screenshots'));
if (files && files.length > 0) {
@@ -46,7 +45,7 @@ async function uploadScreenshot(retryCount) {
}
for (const fileName of files) {
let pathFile = path.join(__dirname, '../../e2e-output/screenshots', fileName);
let pathFile = path.join(__dirname, '../e2e-output/screenshots', fileName);
let file = fs.createReadStream(pathFile);
let safeFileName = fileName.match(/\[(.*?)\]/);
@@ -74,7 +73,7 @@ async function uploadScreenshot(retryCount) {
}
async function cleanReportFolder() {
let reportsFolder = `${projectRoot}/e2e-output/junit-report/`;
const reportsFolder = path.resolve(__dirname, '../e2e-output/junit-report/');
fs.exists(reportsFolder, function (exists, error) {
if (exists) {
@@ -175,18 +175,16 @@ describe('Search Number Range Filter', () => {
const results = await dataTable.geCellElementDetail('Size') as ElementFinder[];
for (const currentResult of results) {
try {
const currentSize = await currentResult.getAttribute('title');
if (currentSize && currentSize.trim() !== '') {
await expect(parseInt(currentSize, 10) <= toSize).toBe(true);
}
} catch (e) {
const currentSize = await currentResult.getAttribute('title');
if (currentSize && currentSize.trim() !== '') {
await expect(parseInt(currentSize, 10) <= toSize).toBe(true);
}
}
});
it('[C276944] Should be able to filter by name when size range filter is applied', async () => {
const nameFilter = await searchFilters.textFiltersPage();
const nameFilter = searchFilters.textFiltersPage();
const toSize = 40;
const fromSize = 0;
await searchFilters.checkNameFilterIsDisplayed();
@@ -204,12 +202,9 @@ describe('Search Number Range Filter', () => {
const results = await dataTable.geCellElementDetail('Size') as ElementFinder[];
for (const currentResult of results) {
try {
const currentSize = await currentResult.getAttribute('title');
if (currentSize && currentSize.trim() !== '') {
await expect(parseInt(currentSize, 10) <= toSize).toBe(true);
}
} catch (e) {
const currentSize = await currentResult.getAttribute('title');
if (currentSize && currentSize.trim() !== '') {
await expect(parseInt(currentSize, 10) <= toSize).toBe(true);
}
}
@@ -220,23 +215,17 @@ describe('Search Number Range Filter', () => {
const resultsSize = await dataTable.geCellElementDetail('Size') as ElementFinder[];
for (const currentResult of resultsSize) {
try {
const currentSize = await currentResult.getAttribute('title');
if (currentSize && currentSize.trim() !== '') {
await expect(parseInt(currentSize, 10) <= toSize).toBe(true);
}
} catch (e) {
const currentSize = await currentResult.getAttribute('title');
if (currentSize && currentSize.trim() !== '') {
await expect(parseInt(currentSize, 10) <= toSize).toBe(true);
}
}
const resultsDisplay = await dataTable.geCellElementDetail('Display name') as ElementFinder[];
for (const currentResult of resultsDisplay) {
try {
const name = await currentResult.getAttribute('title');
if (name && name.trim() !== '') {
await expect(/z*/i.test(name)).toBe(true);
}
} catch (e) {
const name = await currentResult.getAttribute('title');
if (name && name.trim() !== '') {
await expect(/z*/i.test(name)).toBe(true);
}
}
});
@@ -271,12 +260,9 @@ describe('Search Number Range Filter', () => {
const results = await dataTable.geCellElementDetail('Size') as ElementFinder[];
for (const currentResult of results) {
try {
const currentSize = await currentResult.getAttribute('title');
if (currentSize && currentSize.trim() !== '') {
await expect(currentSize === '0').toBe(true);
}
} catch (e) {
const currentSize = await currentResult.getAttribute('title');
if (currentSize && currentSize.trim() !== '') {
await expect(currentSize === '0').toBe(true);
}
}
});
@@ -313,12 +299,9 @@ describe('Search Number Range Filter', () => {
const results = await dataTable.geCellElementDetail('Size') as ElementFinder[];
for (const currentResult of results) {
try {
const currentSize = await currentResult.getAttribute('title');
if (currentSize && currentSize.trim() !== '') {
await expect(parseInt(currentSize, 10) <= 1000).toBe(true);
}
} catch (e) {
const currentSize = await currentResult.getAttribute('title');
if (currentSize && currentSize.trim() !== '') {
await expect(parseInt(currentSize, 10) <= 1000).toBe(true);
}
}
@@ -329,12 +312,9 @@ describe('Search Number Range Filter', () => {
const resultsSize = await dataTable.geCellElementDetail('Size') as ElementFinder[];
for (const currentResult of resultsSize) {
try {
const currentSize = await currentResult.getAttribute('title');
if (currentSize && currentSize.trim() !== '') {
await expect(parseInt(currentSize, 10) >= 1000).toBe(true);
}
} catch (e) {
const currentSize = await currentResult.getAttribute('title');
if (currentSize && currentSize.trim() !== '') {
await expect(parseInt(currentSize, 10) >= 1000).toBe(true);
}
}
});
+8 -12
View File
@@ -126,12 +126,10 @@ describe('Search Slider Filter', () => {
const results = await dataTable.geCellElementDetail('Size') as ElementFinder[];
for (const currentResult of results) {
try {
const currentSize = await currentResult.getAttribute('title');
if (currentSize && currentSize.trim() !== '') {
await expect(parseInt(currentSize, 10) <= 5000).toBe(true);
}
} catch (e) {
const currentSize = await currentResult.getAttribute('title');
if (currentSize && currentSize.trim() !== '') {
await expect(parseInt(currentSize, 10) <= 5000).toBe(true);
}
}
@@ -143,12 +141,10 @@ describe('Search Slider Filter', () => {
const resultsSize = await dataTable.geCellElementDetail('Size') as ElementFinder[];
for (const currentResult of resultsSize) {
try {
const currentSize = await currentResult.getAttribute('title');
if (currentSize && currentSize.trim() !== '') {
await expect(parseInt(currentSize, 10) >= 5000).toBe(true);
}
} catch (e) {
const currentSize = await currentResult.getAttribute('title');
if (currentSize && currentSize.trim() !== '') {
await expect(parseInt(currentSize, 10) >= 5000).toBe(true);
}
}
});