diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 3c769e1fa99..63191b9d904 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -170,7 +170,6 @@ jobs: npm ci npx nx run js-api:bundle npx nx run cli:bundle - npx nx run testing:bundle - uses: ./.github/actions/upload-node-modules-and-artifacts unit-tests: diff --git a/.github/workflows/release-branch.yml b/.github/workflows/release-branch.yml index e7d8e19c609..9c32ab774dc 100644 --- a/.github/workflows/release-branch.yml +++ b/.github/workflows/release-branch.yml @@ -62,7 +62,6 @@ jobs: npm ci npx nx run js-api:bundle npx nx run cli:bundle - npx nx run testing:bundle - uses: ./.github/actions/upload-node-modules-and-artifacts release-npm: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 19c8cda9715..d2192e1ebe3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -69,7 +69,6 @@ jobs: npm ci npx nx run js-api:bundle npx nx run cli:bundle - npx nx run testing:bundle - uses: ./.github/actions/upload-node-modules-and-artifacts release-storybook: diff --git a/lib/cli/scripts/licenses.ts b/lib/cli/scripts/licenses.ts index 29cd3310506..030c1adcd51 100644 --- a/lib/cli/scripts/licenses.ts +++ b/lib/cli/scripts/licenses.ts @@ -45,7 +45,6 @@ const nonStandardLicenses = { }; const missingRepositories = { - '@alfresco/adf-testing': 'https://github.com/Alfresco/alfresco-ng2-components', '@webassemblyjs/helper-api-error': 'https://github.com/xtuc/webassemblyjs', '@webassemblyjs/helper-fsm': 'https://github.com/xtuc/webassemblyjs', '@webassemblyjs/ieee754': 'https://github.com/xtuc/webassemblyjs', diff --git a/lib/testing/.browserslistrc b/lib/testing/.browserslistrc deleted file mode 100644 index fb92325c6ed..00000000000 --- a/lib/testing/.browserslistrc +++ /dev/null @@ -1,17 +0,0 @@ -# This file is used by the build system to adjust CSS and JS output to support the specified browsers below. -# For additional information regarding the format and rule options, please see: -# https://github.com/browserslist/browserslist#queries - -# For the full list of supported browsers by the Angular framework, please see: -# https://angular.io/guide/browser-support - -# You can see what browsers were selected by your queries by running: -# npx browserslist - -last 1 Chrome version -last 1 Firefox version -last 2 Edge major versions -last 2 Safari major version -last 2 iOS major versions -Firefox ESR -not IE 9-11 # For IE 9-11 support, remove 'not'. diff --git a/lib/testing/.eslintrc.json b/lib/testing/.eslintrc.json deleted file mode 100644 index c5409790c95..00000000000 --- a/lib/testing/.eslintrc.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "extends": ["../../.eslintrc.js"], - "ignorePatterns": ["!**/*"], - "overrides": [ - { - "files": ["*.ts"], - "extends": ["plugin:@nx/angular"], - "parserOptions": { - "project": ["lib/testing/tsconfig.lib.json"], - "createDefaultProgram": true - }, - "rules": { - "@angular-eslint/component-selector": [ - "error", - { - "type": "element", - "prefix": "lib", - "style": "kebab-case" - } - ], - "@angular-eslint/directive-selector": [ - "error", - { - "type": "attribute", - "prefix": "lib", - "style": "camelCase" - } - ], - "@angular-eslint/no-host-metadata-property": "off", - "@angular-eslint/no-input-prefix": "error", - "@typescript-eslint/consistent-type-definitions": "error", - "@typescript-eslint/dot-notation": "off", - "@typescript-eslint/explicit-member-accessibility": [ - "off", - { - "accessibility": "explicit" - } - ], - "@typescript-eslint/no-inferrable-types": "off", - "@typescript-eslint/no-require-imports": "off", - "@typescript-eslint/no-var-requires": "error", - "comma-dangle": "error", - "default-case": "error", - "import/order": "off", - "max-len": [ - "error", - { - "code": 240 - } - ], - "no-bitwise": "off", - "no-console": "off", - "no-duplicate-imports": "error", - "no-multiple-empty-lines": "error", - "no-redeclare": "error", - "no-return-await": "error", - "rxjs/no-create": "error", - "rxjs/no-subject-unsubscribe": "error", - "rxjs/no-subject-value": "error", - "rxjs/no-unsafe-takeuntil": "error", - "unicorn/filename-case": "error" - } - }, - { - "files": ["*.html"], - "parserOptions": { - "project": ["lib/testing/tsconfig.lib.json"], - "createDefaultProgram": true - }, - "extends": ["plugin:@nx/angular-template"], - "rules": {} - } - ] -} diff --git a/lib/testing/README.md b/lib/testing/README.md deleted file mode 100644 index aa9ebb3db11..00000000000 --- a/lib/testing/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Alfresco Testing Library - -> This library is deprecated and will be removed in a future release. diff --git a/lib/testing/index.ts b/lib/testing/index.ts deleted file mode 100644 index a04aa716a73..00000000000 --- a/lib/testing/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -/** @deprecated */ -// TODO: We need to split adf-testing into smaller chunks -export * from './src/public-api'; diff --git a/lib/testing/karma.conf.js b/lib/testing/karma.conf.js deleted file mode 100644 index 57bb588f2e5..00000000000 --- a/lib/testing/karma.conf.js +++ /dev/null @@ -1,30 +0,0 @@ -// Karma configuration file, see link for more information -// https://karma-runner.github.io/1.0/config/configuration-file.html -module.exports = function (config) { - config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], - plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage'), - require('@angular-devkit/build-angular/plugins/karma') - ], - client: { - clearContext: false // leave Jasmine Spec Runner output visible in browser - }, - coverageIstanbulReporter: { - dir: require('path').join(__dirname, '../../coverage'), - reports: ['html', 'lcovonly'], - fixWebpackSourcePaths: true - }, - reporters: ['progress', 'kjhtml'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['ChromeHeadless'], - singleRun: true - }); -}; diff --git a/lib/testing/ng-package.json b/lib/testing/ng-package.json deleted file mode 100644 index 612057fe673..00000000000 --- a/lib/testing/ng-package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", - "dest": "../../dist/libs/testing", - "lib": { - "entryFile": "src/public-api.ts", - "flatModuleFile": "adf-testing" - } -} diff --git a/lib/testing/package.json b/lib/testing/package.json deleted file mode 100644 index 25e4015d240..00000000000 --- a/lib/testing/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "@alfresco/adf-testing", - "description": "Alfresco ADF testing page and utils", - "version": "7.0.0-alpha.7", - "author": "Hyland Software, Inc. and its affiliates", - "repository": { - "type": "git", - "url": "https://github.com/Alfresco/alfresco-ng2-components.git" - }, - "bugs": { - "url": "https://github.com/Alfresco/alfresco-ng2-components/issues" - }, - "peerDependencies": { - "@alfresco/js-api": ">=8.0.0-alpha.7-0" - }, - "keywords": [ - "testing", - "alfresco-component", - "angular", - "components" - ], - "license": "Apache-2.0" -} diff --git a/lib/testing/project.json b/lib/testing/project.json deleted file mode 100644 index 8166f6cd8af..00000000000 --- a/lib/testing/project.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "name": "testing", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "lib/testing/src", - "projectType": "library", - "prefix": "adf", - "targets": { - "build": { - "executor": "@nrwl/webpack:webpack", - "options": { - "projectRoot": "lib/testing", - "outputPath": "dist/libs/testing", - "main": "lib/testing/index.ts", - "generatePackageJson": true, - "tsConfig": "lib/testing/tsconfig.lib.prod.json", - "stylePreprocessorOptions": { - "includePaths": ["lib", "lib/core/src/lib"] - }, - "target": "node", - "compiler": "tsc" - }, - "configurations": { - "production": { - "projectRoot": "lib/testing", - "outputPath": "dist/libs/testing", - "main": "lib/testing/index.ts", - "generatePackageJson": true, - "tsConfig": "lib/testing/tsconfig.lib.prod.json" - } - }, - "defaultConfiguration": "production" - }, - "lint": { - "executor": "@nrwl/linter:eslint", - "options": { - "lintFilePatterns": ["lib/testing/**/*.ts", "lib/testing/**/*.html"] - } - }, - "bundle": { - "executor": "nx:run-commands", - "options": { - "commands": [ - { - "command": "echo testing bundle created" - } - ] - }, - "dependsOn": ["copyToNodeModules"] - }, - "copyToNodeModules": { - "executor": "nx:run-commands", - "options": { - "commands": [ - { - "command": "rm -rf ./node_modules/@alfresco/adf-testing/ && mkdir -p ./node_modules/@alfresco/adf-testing/ && cp -R ./dist/libs/testing/* ./node_modules/@alfresco/adf-testing/" - } - ] - }, - "dependsOn": ["build"] - }, - "npm-publish": { - "executor": "nx:run-commands", - "dependsOn": ["build"], - "options": { - "cwd": "dist/libs/testing", - "commands": [ - { - "command": "npm publish --tag {args.tag}", - "forwardAllArgs": true - } - ] - } - } - } -} diff --git a/lib/testing/src/lib/protractor/content-services/actions/model.actions.ts b/lib/testing/src/lib/protractor/content-services/actions/model.actions.ts deleted file mode 100644 index e0f6ecb872d..00000000000 --- a/lib/testing/src/lib/protractor/content-services/actions/model.actions.ts +++ /dev/null @@ -1,73 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { CustomModel, CustomModelApi, CustomModelProperty, CustomType, TypePaging, TypesApi } from '@alfresco/js-api'; -import { ApiService } from '../../../shared/api/api.service'; -import { ApiUtil } from '../../../shared/api/api.util'; -import { Logger } from '../../core/utils/logger'; - -export class ModelActions { - customModelApi: CustomModelApi; - typesApi: TypesApi; - - constructor(apiService: ApiService) { - this.customModelApi = new CustomModelApi(apiService.getInstance()); - this.typesApi = new TypesApi(apiService.getInstance()); - } - - async createModel({status, description, name, namespaceUri, namespacePrefix, author}: CustomModel): Promise<{ entry: CustomModel }> { - return this.customModelApi.createCustomModel(status, description, name, namespaceUri, namespacePrefix, author); - } - - async createType(modelName, { name, parentName, title, description}: CustomType ): Promise<{ entry: CustomType }> { - return this.customModelApi.createCustomType(modelName, name, parentName, title, description); - } - - async addPropertyToType(modelName: string, typeName: string, properties?: CustomModelProperty[]): Promise { - return this.customModelApi.addPropertyToType(modelName , typeName, properties); - } - - async activateCustomModel(modelName: string): Promise<{ entry: CustomModel }> { - return this.customModelApi.activateCustomModel(modelName); - } - - async deactivateCustomModel(modelName: string): Promise<{ entry: CustomModel }> { - return this.customModelApi.deactivateCustomModel(modelName); - } - - async deleteCustomModel(modelName: string): Promise { - return this.customModelApi.deleteCustomModel(modelName); - } - - async listTypes(opts?: any): Promise { - return this.typesApi.listTypes(opts); - } - - async isCustomTypeSearchable(title: string): Promise { - const predicate = (result: TypePaging) => !!result.list.entries.find(({entry}) => entry.title === title); - - const apiCall = async () => { - try { - return this.listTypes({where: `(not namespaceUri matches('http://www.alfresco.*'))`}); - } catch (error) { - Logger.error('Failed to list types', error); - return null; - } - }; - return ApiUtil.waitForApi(apiCall, predicate); - } -} diff --git a/lib/testing/src/lib/protractor/content-services/actions/public-api.ts b/lib/testing/src/lib/protractor/content-services/actions/public-api.ts deleted file mode 100644 index ab352d31cdd..00000000000 --- a/lib/testing/src/lib/protractor/content-services/actions/public-api.ts +++ /dev/null @@ -1,19 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './upload.actions'; -export * from './model.actions'; diff --git a/lib/testing/src/lib/protractor/content-services/actions/upload.actions.ts b/lib/testing/src/lib/protractor/content-services/actions/upload.actions.ts deleted file mode 100644 index 07dd6c9f198..00000000000 --- a/lib/testing/src/lib/protractor/content-services/actions/upload.actions.ts +++ /dev/null @@ -1,118 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 * as path from 'path'; -import * as fs from 'fs'; -import { NodeEntry, UploadApi, NodesApi } from '@alfresco/js-api'; -import { ApiUtil } from '../../../shared/api/api.util'; -import { Logger } from '../../core/utils/logger'; -import { ApiService } from '../../../shared/api/api.service'; - -export class UploadActions { - - api: ApiService; - uploadApi: UploadApi; - nodesApi: NodesApi; - - constructor(apiService: ApiService) { - this.api = apiService; - this.uploadApi = new UploadApi(apiService.getInstance()); - this.nodesApi = new NodesApi(apiService.getInstance()); - } - - async uploadFile(fileLocation: fs.PathLike, fileName: string, parentFolderId: string): Promise { - const file = fs.createReadStream(fileLocation); - - const uploadPromise = this.uploadApi.uploadFile( - file, - '', - parentFolderId, - null, - { - name: fileName, - nodeType: 'cm:content', - renditions: 'doclib' - } - ); - - await uploadPromise.then(() => { - Logger.info(`${fileName} uploaded in ${parentFolderId}`); - }); - - return uploadPromise; - } - - async createEmptyFiles(emptyFileNames: string[], parentFolderId: string): Promise { - const filesRequest = []; - - // eslint-disable-next-line @typescript-eslint/prefer-for-of - for (let i = 0; i < emptyFileNames.length; i++) { - const jsonItem = {}; - jsonItem['name'] = emptyFileNames[i]; - jsonItem['nodeType'] = 'cm:content'; - filesRequest.push(jsonItem); - } - - return this.nodesApi.createNode(parentFolderId, filesRequest as any, {}); - } - - async createFolder(folderName: string, parentFolderId: string): Promise { - return this.nodesApi.createNode(parentFolderId, { - name: folderName, - nodeType: 'cm:folder' - }, {}); - } - - async deleteFileOrFolder(nodeId: string) { - const apiCall = async () => { - try { - Logger.info(`Deleting ${nodeId}`); - return this.nodesApi.deleteNode(nodeId, { permanent: true }); - } catch (error) { - Logger.error('Error delete file or folder'); - } - }; - - return ApiUtil.waitForApi(apiCall, () => true); - } - - async uploadFolder(sourcePath: string, folder: string): Promise { - const files = fs.readdirSync(sourcePath); - let uploadedFiles: any[]; - const promises = []; - - if (files && files.length > 0) { - for (const fileName of files) { - const pathFile = path.join(sourcePath, fileName); - - const uploadPromise = this.uploadFile(pathFile, fileName, folder); - - await uploadPromise.then(() => { - Logger.info(`File ${fileName} uploaded successfully in ${folder}!`); - }).catch(() => { - Logger.error(`File ${fileName} error during the upload in ${folder}!`); - }); - - promises.push(uploadPromise); - } - - uploadedFiles = await Promise.all(promises); - } - - return uploadedFiles; - } -} diff --git a/lib/testing/src/lib/protractor/content-services/dialog/content-node-selector-dialog.page.ts b/lib/testing/src/lib/protractor/content-services/dialog/content-node-selector-dialog.page.ts deleted file mode 100644 index 747ab43bc94..00000000000 --- a/lib/testing/src/lib/protractor/content-services/dialog/content-node-selector-dialog.page.ts +++ /dev/null @@ -1,205 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 } from 'protractor'; -import { DocumentListPage } from '../pages/document-list.page'; -import { BrowserVisibility } from '../../core/utils/browser-visibility'; -import { BrowserActions } from '../../core/utils/browser-actions'; -import { DropdownPage } from '../../core/pages/material/dropdown.page'; -import { BreadcrumbDropdownPage } from '../pages/breadcrumb/breadcrumb-dropdown.page'; -import { Logger } from '../../core/utils/logger'; -import { TabPage } from '../../core/pages/form/widgets/tab.page'; -import { UploadButtonPage } from '../pages/upload-button.page'; -import { FileModel } from '../../core/models/file.model'; -import { TestElement } from '../../core/public-api'; - -export class ContentNodeSelectorDialogPage { - dialog = $(`adf-content-node-selector`); - header = this.dialog.$(`h1[data-automation-id='content-node-selector-title']`); - searchInputElement = this.dialog.$(`input[data-automation-id='content-node-selector-search-input']`); - searchLabel = this.dialog.$('.adf-content-node-selector-content-input .mat-form-field-label'); - selectedRow = this.dialog.$(`adf-datatable-row[class*="adf-is-selected"]`); - cancelButton = $(`button[data-automation-id='content-node-selector-actions-cancel']`); - moveCopyButton = $(`button[data-automation-id='content-node-selector-actions-choose']`); - - contentList = new DocumentListPage(this.dialog); - dataTable = this.contentList.dataTablePage(); - siteListDropdown = new DropdownPage(this.dialog.$(`mat-select[data-automation-id='site-my-files-option']`)); - breadcrumbDropdown = new BreadcrumbDropdownPage(); - tab: TabPage = new TabPage(); - uploadButtonComponent = new UploadButtonPage(); - selectedFileCounter = TestElement.byCss('adf-node-counter'); - - uploadFromLocalTab = $$('*[role="tab"]').get(1); - uploadFromLocalTabName = 'Upload from your device'; - repositoryTabName = 'Repository'; - - breadcrumbDropdownPage(): BreadcrumbDropdownPage { - return this.breadcrumbDropdown; - } - - tabPage(): TabPage { - return this.tab; - } - - uploadButtonPage(): UploadButtonPage { - return this.uploadButtonComponent; - } - - async checkDialogIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.dialog); - } - - async checkDialogIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.dialog); - } - - async getDialogHeaderText(): Promise { - return BrowserActions.getText(this.header); - } - - async checkSearchInputIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.searchInputElement); - } - - async getSearchLabel(): Promise { - return BrowserActions.getText(this.searchLabel); - } - - async checkSelectedSiteIsDisplayed(siteName: string): Promise { - await this.siteListDropdown.checkOptionIsSelected(siteName); - } - - async checkSelectedFolder(folderName: string): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.selectedRow.element(by.cssContainingText('adf-name-location-cell', folderName))); - } - - async checkCancelButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.cancelButton); - } - - async clickCancelButton(): Promise { - await BrowserActions.click(this.cancelButton); - } - - async checkCancelButtonIsEnabled(): Promise { - return this.cancelButton.isEnabled(); - } - - async checkCopyMoveButtonIsEnabled(): Promise { - return this.moveCopyButton.isEnabled(); - } - - async checkMoveCopyButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.moveCopyButton); - } - - async getMoveCopyButtonText(): Promise { - return BrowserActions.getText(this.moveCopyButton); - } - - async clickMoveCopyButton(): Promise { - await BrowserActions.click(this.moveCopyButton); - } - - async numberOfResultsDisplayed(): Promise { - return this.dataTable.numberOfRows(); - } - - async typeIntoNodeSelectorSearchField(text: string): Promise { - Logger.log(`Search Node content node selector ${text}`); - - await BrowserVisibility.waitUntilElementIsVisible(this.searchInputElement); - await BrowserActions.clearSendKeys(this.searchInputElement, text, 100); - await this.dataTable.waitTillContentLoaded(); - } - - async clickContentNodeSelectorResult(name: string): Promise { - await this.dataTable.clickRowByContent(name); - await this.dataTable.checkRowByContentIsSelected(name); - } - - async doubleClickContentNodeSelectorResult(name: string): Promise { - await this.dataTable.doubleClickRowByContent(name); - } - - async attachFileFromContentNode(folderName: string, fileName: string): Promise { - await this.checkDialogIsDisplayed(); - await this.checkSearchInputIsDisplayed(); - await this.checkCancelButtonIsDisplayed(); - - await this.dataTable.waitForTableBody(); - await this.dataTable.waitTillContentLoaded(); - await this.dataTable.checkRowContentIsDisplayed(folderName); - await this.dataTable.doubleClickRowByContent(folderName); - - await this.dataTable.waitForTableBody(); - await this.dataTable.waitTillContentLoaded(); - await this.dataTable.checkRowContentIsDisplayed(fileName); - - await this.clickContentNodeSelectorResult(fileName); - await this.checkCopyMoveButtonIsEnabled(); - await this.clickMoveCopyButton(); - } - - async checkFileServerTabIsLoaded(): Promise { - await this.checkDialogIsDisplayed(); - await this.dataTable.waitForTableBody(); - await this.breadcrumbDropdown.checkCurrentFolderIsDisplayed(); - } - - async attachFilesFromLocal(files: FileModel[]): Promise { - await this.checkFileServerTabIsLoaded(); - - await this.tab.clickTabByLabel(this.uploadFromLocalTabName); - - await this.uploadButtonComponent.attachFiles(files); - - await this.tab.clickTabByLabel(this.repositoryTabName); - - await this.dataTable.waitForTableBody(); - await this.dataTable.waitTillContentLoaded(); - for ( const file of files) { - await this.dataTable.checkRowContentIsDisplayed(file.getName()); - } - - await this.checkCopyMoveButtonIsEnabled(); - await this.clickMoveCopyButton(); - } - - async searchAndSelectResult(searchText: string, name: string) { - await this.typeIntoNodeSelectorSearchField(searchText); - await this.contentListPage().dataTablePage().waitTillContentLoaded(); - await this.contentListPage().dataTablePage().waitForFirstRow(); - try { - await this.contentListPage().dataTablePage().checkRowContentIsDisplayed(name); - } catch (e) { - Logger.error(`failed to get search result :: ${name}`); - } - await this.clickContentNodeSelectorResult(name); - } - - contentListPage(): DocumentListPage { - return this.contentList; - } - - async isUploadFromLocalTabEnabled(): Promise { - await BrowserVisibility.waitUntilElementIsPresent(this.uploadFromLocalTab); - const disabled = await BrowserActions.getAttribute(this.uploadFromLocalTab, 'aria-disabled'); - return disabled === 'false'; - } -} diff --git a/lib/testing/src/lib/protractor/content-services/dialog/public-api.ts b/lib/testing/src/lib/protractor/content-services/dialog/public-api.ts deleted file mode 100644 index 042178b69ee..00000000000 --- a/lib/testing/src/lib/protractor/content-services/dialog/public-api.ts +++ /dev/null @@ -1,18 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './content-node-selector-dialog.page'; diff --git a/lib/testing/src/lib/protractor/content-services/pages/breadcrumb/breadcrumb-dropdown.page.ts b/lib/testing/src/lib/protractor/content-services/pages/breadcrumb/breadcrumb-dropdown.page.ts deleted file mode 100644 index 5e2c417899a..00000000000 --- a/lib/testing/src/lib/protractor/content-services/pages/breadcrumb/breadcrumb-dropdown.page.ts +++ /dev/null @@ -1,62 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { $, $$ } from 'protractor'; -import { BrowserActions } from '../../../core/utils/browser-actions'; -import { BrowserVisibility } from '../../../core/utils/browser-visibility'; -import { DropdownPage } from '../../../core/pages/material/dropdown.page'; - -export class BreadcrumbDropdownPage { - - breadCrumb = $(`adf-dropdown-breadcrumb[data-automation-id='content-node-selector-content-breadcrumb']`); - parentFolder = this.breadCrumb.$(`button[data-automation-id='dropdown-breadcrumb-trigger']`); - currentFolder = this.breadCrumb.$(`div span[data-automation-id="current-folder"]`); - - breadCrumbDropdown = new DropdownPage($$(`div[class*='mat-select-panel']`).first()); - - async choosePath(pathName: string): Promise { - await this.breadCrumbDropdown.selectOption(pathName); - } - - async clickParentFolder(): Promise { - await BrowserActions.click(this.parentFolder); - } - - async checkBreadCrumbDropdownIsDisplayed(): Promise { - await this.breadCrumbDropdown.checkDropdownIsVisible(); - } - - async checkBreadCrumbDropdownIsNotDisplayed(): Promise { - await this.breadCrumbDropdown.checkDropdownIsNotVisible(); - } - - async checkBreadCrumbOptionIsDisplayed(optionName: string): Promise { - await this.breadCrumbDropdown.checkOptionIsDisplayed(optionName); - } - - async checkBreadCrumbOptionIsNotDisplayed(optionName: string): Promise { - await this.breadCrumbDropdown.checkOptionIsNotDisplayed(optionName); - } - - async getTextOfCurrentFolder(): Promise { - return BrowserActions.getText(this.currentFolder); - } - - async checkCurrentFolderIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.currentFolder); - } -} diff --git a/lib/testing/src/lib/protractor/content-services/pages/breadcrumb/public-api.ts b/lib/testing/src/lib/protractor/content-services/pages/breadcrumb/public-api.ts deleted file mode 100644 index 28707bf7bc3..00000000000 --- a/lib/testing/src/lib/protractor/content-services/pages/breadcrumb/public-api.ts +++ /dev/null @@ -1,18 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './breadcrumb-dropdown.page'; diff --git a/lib/testing/src/lib/protractor/content-services/pages/document-list.page.ts b/lib/testing/src/lib/protractor/content-services/pages/document-list.page.ts deleted file mode 100644 index 0fef54261d3..00000000000 --- a/lib/testing/src/lib/protractor/content-services/pages/document-list.page.ts +++ /dev/null @@ -1,89 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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, browser, $$, protractor } from 'protractor'; -import { DataTableComponentPage } from '../../core/pages/data-table-component.page'; -import { BrowserVisibility } from '../../core/utils/browser-visibility'; -import { BrowserActions } from '../../core/utils/browser-actions'; -import { Logger } from '../../core/utils/logger'; - -export class DocumentListPage { - - rootElement: ElementFinder; - optionButton = 'button[data-automation-id*="action_menu_"]'; - tableBody: ElementFinder; - dataTable: DataTableComponentPage; - - constructor(rootElement = $$('adf-document-list').first()) { - this.rootElement = rootElement; - this.dataTable = new DataTableComponentPage(this.rootElement); - this.tableBody = rootElement.$$('.adf-datatable-body').first(); - } - - async waitForTableBody(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.tableBody); - } - - async getTooltip(nodeName: string): Promise { - return this.dataTable.getTooltip('Display name', nodeName); - } - - async selectRow(nodeName: string): Promise { - await this.dataTable.selectRow('Display name', nodeName); - } - - // @deprecated Use Playwright API instead - async selectRowsWithKeyboard(...contentNames: string[]): Promise { - let option: any; - await browser.actions().sendKeys(protractor.Key.COMMAND).perform(); - for (const name of contentNames) { - option = await this.dataTable.getRow('Display name', name); - await option.click(); - await this.dataTable.checkRowIsSelected('Display name', name); - } - await browser.actions().sendKeys(protractor.Key.NULL).perform(); - } - - async rightClickOnRow(nodeName: string): Promise { - await this.dataTable.rightClickOnRow('Display name', nodeName); - } - - async clickOnActionMenu(content: string): Promise { - Logger.log(`Click action menu ${content}`); - await BrowserActions.closeMenuAndDialogs(); - const row = this.dataTable.getRow('Display name', content); - await BrowserActions.click(row.$(this.optionButton)); - await BrowserActions.waitUntilActionMenuIsVisible(); - await browser.sleep(500); - } - - async checkActionMenuIsNotDisplayed(): Promise { - await BrowserActions.waitUntilActionMenuIsNotVisible(); - } - - dataTablePage(): DataTableComponentPage { - return new DataTableComponentPage(this.rootElement); - } - - async getAllRowsColumnValues(column: string) { - return this.dataTable.getAllRowsColumnValues(column); - } - - async doubleClickRow(nodeName: string): Promise { - await this.dataTable.doubleClickRow('Display name', nodeName); - } -} diff --git a/lib/testing/src/lib/protractor/content-services/pages/public-api.ts b/lib/testing/src/lib/protractor/content-services/pages/public-api.ts deleted file mode 100644 index 19c8c969147..00000000000 --- a/lib/testing/src/lib/protractor/content-services/pages/public-api.ts +++ /dev/null @@ -1,19 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './document-list.page'; -export * from './breadcrumb/public-api'; diff --git a/lib/testing/src/lib/protractor/content-services/pages/upload-button.page.ts b/lib/testing/src/lib/protractor/content-services/pages/upload-button.page.ts deleted file mode 100644 index 2fd0dba9837..00000000000 --- a/lib/testing/src/lib/protractor/content-services/pages/upload-button.page.ts +++ /dev/null @@ -1,32 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { $ } from 'protractor'; -import { BrowserVisibility } from '../../core/utils/browser-visibility'; -import { FileModel } from '../../core/models/file.model'; - -export class UploadButtonPage { - - uploadButton = $('adf-upload-button input'); - - async attachFiles(files: FileModel[]): Promise { - await BrowserVisibility.waitUntilElementIsPresent(this.uploadButton); - for ( const file of files) { - await this.uploadButton.sendKeys(file.getLocation()); - } - } -} diff --git a/lib/testing/src/lib/protractor/content-services/public-api.ts b/lib/testing/src/lib/protractor/content-services/public-api.ts deleted file mode 100644 index d34b01f1ac2..00000000000 --- a/lib/testing/src/lib/protractor/content-services/public-api.ts +++ /dev/null @@ -1,20 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './pages/public-api'; -export * from './actions/public-api'; -export * from './dialog/public-api'; diff --git a/lib/testing/src/lib/protractor/core/actions/api.service.factory.ts b/lib/testing/src/lib/protractor/core/actions/api.service.factory.ts deleted file mode 100644 index a3e40781406..00000000000 --- a/lib/testing/src/lib/protractor/core/actions/api.service.factory.ts +++ /dev/null @@ -1,47 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { AlfrescoApiConfig } from '@alfresco/js-api'; -import { ApiService } from '../../../shared/api/api.service'; -import { Logger } from '../utils/logger'; -import { browser } from 'protractor'; - -export const createApiService = ( - /** @deprecated */ - appConfigOverride: Partial = {} -) => { - const patchedAppConfig = { - ...browser.params.testConfig.appConfig, - oauth2: { - ...browser.params.testConfig.appConfig.oauth2, - // For some reason protractor e2es must have this value hardcoded - implicitFlow: false - }, - // Legacy debt... - hostEcm: browser.params.testConfig.appConfig.ecmHost, - hostBpm: browser.params.testConfig.appConfig.bpmHost, - ...appConfigOverride - }; - - return new ApiService( - { - appConfig: new AlfrescoApiConfig(patchedAppConfig), - users: browser.params.testConfig.users - }, - Logger - ); -}; diff --git a/lib/testing/src/lib/protractor/core/actions/drop.actions.ts b/lib/testing/src/lib/protractor/core/actions/drop.actions.ts deleted file mode 100644 index 231137d88d7..00000000000 --- a/lib/testing/src/lib/protractor/core/actions/drop.actions.ts +++ /dev/null @@ -1,122 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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, ElementFinder } from 'protractor'; - -import * as path from 'path'; -import * as fs from 'fs'; -import { BrowserActions } from '../utils/browser-actions'; - -const JS_BIND_INPUT = (target) => { - const input = document.createElement('input'); - input.type = 'file'; - input.style.display = 'none'; - input.addEventListener( - 'change', - () => { - target.scrollIntoView(true); - - const rect = target.getBoundingClientRect(); - const x = rect.left + (rect.width >> 1); - const y = rect.top + (rect.height >> 1); - const data = { files: input.files }; - - ['dragenter', 'dragover', 'drop'].forEach((name) => { - const mouseEvent: any = document.createEvent('MouseEvent'); - mouseEvent.initMouseEvent(name, !0, !0, window, 0, 0, 0, x, y, !1, !1, !1, !1, 0, null); - mouseEvent.dataTransfer = data; - target.dispatchEvent(mouseEvent); - }); - - document.body.removeChild(input); - }, - false - ); - - document.body.appendChild(input); - return input; -}; - -const JS_BIND_INPUT_FOLDER = (target) => { - const input: any = document.createElement('input'); - input.type = 'file'; - input.style.display = 'none'; - input.multiple = true; - input.webkitdirectory = true; - input.addEventListener( - 'change', - () => { - target.scrollIntoView(true); - - const rect = target.getBoundingClientRect(); - const x = rect.left + (rect.width >> 1); - const y = rect.top + (rect.height >> 1); - const data = { files: input.files }; - - ['dragenter', 'dragover', 'drop'].forEach((name) => { - const mouseEvent: any = document.createEvent('MouseEvent'); - mouseEvent.initMouseEvent(name, !0, !0, window, 0, 0, 0, x, y, !1, !1, !1, !1, 0, null); - mouseEvent.dataTransfer = data; - target.dispatchEvent(mouseEvent); - }); - - document.body.removeChild(input); - }, - false - ); - - document.body.appendChild(input); - return input; -}; - -export class DropActions { - static async dropFile(dropArea, filePath) { - const absolutePath = path.resolve(path.join(browser.params.testConfig.main.rootPath, filePath)); - - fs.accessSync(absolutePath, fs.constants.F_OK); - const elem = await dropArea.getWebElement(); - const input: any = await browser.executeScript(JS_BIND_INPUT, elem); - return input.sendKeys(absolutePath); - } - - static async dropFolder(dropArea, folderPath) { - const absolutePath = path.resolve(path.join(browser.params.testConfig.main.rootPath, folderPath)); - fs.accessSync(absolutePath, fs.constants.F_OK); - - const elem = await dropArea.getWebElement(); - const input: any = await browser.executeScript(JS_BIND_INPUT_FOLDER, elem); - return input.sendKeys(absolutePath); - } - - static async dragAndDrop(elementToDrag: ElementFinder, locationToDragTo: ElementFinder, locationOffset = { x: 230, y: 280 }) { - await BrowserActions.click(elementToDrag); - await browser.actions().mouseDown(elementToDrag).mouseMove(locationToDragTo, locationOffset).mouseUp().perform(); - await browser.actions().doubleClick(locationToDragTo).perform(); - } - - static async dragAndDropNotClickableElement(elementToDrag: ElementFinder, locationToDragTo: ElementFinder) { - await browser.actions().mouseMove(elementToDrag).perform(); - await browser.actions().mouseDown(elementToDrag).perform(); - await browser.actions().mouseMove({ x: 10, y: 100 }).perform(); - await browser.actions().mouseMove(locationToDragTo).perform(); - return browser.actions().mouseUp().perform(); - } - - static async dropElement(locationToDragTo: ElementFinder) { - await browser.actions().mouseDown(locationToDragTo).perform(); - } -} diff --git a/lib/testing/src/lib/protractor/core/actions/identity/group-identity.service.ts b/lib/testing/src/lib/protractor/core/actions/identity/group-identity.service.ts deleted file mode 100644 index 6b6428321c3..00000000000 --- a/lib/testing/src/lib/protractor/core/actions/identity/group-identity.service.ts +++ /dev/null @@ -1,139 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { ApiService } from '../../../../shared/api/api.service'; -import { StringUtil } from '../../../../shared/utils/string.util'; -import { ApiUtil } from '../../../../shared/api/api.util'; -import { Logger } from '../../utils/logger'; -import { browser } from 'protractor'; - -export class GroupIdentityService { - api: ApiService; - - constructor(api: ApiService) { - this.api = api; - } - - async createIdentityGroup(groupName = StringUtil.generateRandomString(5)): Promise { - await this.createGroup(groupName); - const group = await this.getGroupInfoByGroupName(groupName); - return group; - } - - async deleteIdentityGroup(groupId): Promise { - await this.deleteGroup(groupId); - } - - async createGroup(groupName: string): Promise { - const path = '/groups'; - const method = 'POST'; - const queryParams = {}; - const postBody = { - name: `${groupName}-${browser.params.groupSuffix}` - }; - const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); - return data; - } - - async deleteGroup(groupId: string): Promise { - const path = `/groups/${groupId}`; - const method = 'DELETE'; - const queryParams = {}; - const postBody = {}; - const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); - return data; - } - - async getGroupInfoByGroupName(groupName: string): Promise { - Logger.log(`Get GroupInfoByGroupName ${groupName}`); - - const predicate = (result: any) => !!result; - - const apiCall = async () => { - try { - const path = `/groups`; - const method = 'GET'; - const queryParams = { search: groupName }; - const postBody = {}; - - const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); - - Logger.log(`Data ${JSON.stringify(data)}`); - - return data[0]; - Logger.error('Group not found'); - } catch (error) { - Logger.error('Group not found'); - return null; - } - }; - - return ApiUtil.waitForApi(apiCall, predicate); - } - - async assignRole(groupId: string, roleId: string, roleName: string): Promise { - Logger.log(`Assign to group ${groupId} Role ${roleName}`); - - const path = `/groups/${groupId}/role-mappings/realm`; - const method = 'POST'; - const queryParams = {}; - const postBody = [{ id: roleId, name: roleName }]; - - const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); - return data; - } - - /** - * Add client roles. - * - * @param groupId ID of the target group - * @param clientId ID of the client - * @param roleId ID of the clientRole - * @param roleName of the clientRole - */ - async addClientRole(groupId: string, clientId: string, roleId: string, roleName: string): Promise { - const path = `/groups/${groupId}/role-mappings/clients/${clientId}`; - const method = 'POST'; - const queryParams = {}; - const postBody = [ - { - id: roleId, - name: roleName, - composite: false, - clientRole: true, - containerId: clientId - } - ]; - return this.api.performIdentityOperation(path, method, queryParams, postBody); - } - - /** - * Gets the client ID using the app name. - * - * @param applicationName Name of the app - * @returns client ID string - */ - async getClientIdByApplicationName(applicationName: string): Promise { - const path = `/clients`; - const method = 'GET'; - const queryParams = { clientId: applicationName }; - const postBody = {}; - - const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); - return data[0].id; - } -} diff --git a/lib/testing/src/lib/protractor/core/actions/identity/identity.service.ts b/lib/testing/src/lib/protractor/core/actions/identity/identity.service.ts deleted file mode 100644 index 0abab77ee9b..00000000000 --- a/lib/testing/src/lib/protractor/core/actions/identity/identity.service.ts +++ /dev/null @@ -1,151 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -/* eslint-disable @typescript-eslint/naming-convention */ - -import { ApiService } from '../../../../shared/api/api.service'; -import { UserModel } from '../../models/user.model'; -import { RolesService } from './roles.service'; -import { Logger } from '../../utils/logger'; - -export class IdentityService { - ROLES = { - ACTIVITI_USER: 'ACTIVITI_USER', - ACTIVITI_ADMIN: 'ACTIVITI_ADMIN', - ACTIVITI_DEVOPS: 'ACTIVITI_DEVOPS', - ACTIVITI_IDENTITY: 'ACTIVITI_IDENTITY' - }; - - constructor(public api: ApiService) {} - - async createIdentityUserWithRole(roles: string[]): Promise { - const rolesService = new RolesService(this.api); - const user = await this.createIdentityUser(); - // eslint-disable-next-line @typescript-eslint/prefer-for-of - for (let i = 0; i < roles.length; i++) { - const roleId = await rolesService.getRoleIdByRoleName(roles[i]); - await this.assignRole(user.idIdentityService, roleId, roles[i]); - } - return user; - } - - async createIdentityUser(user: UserModel = new UserModel()): Promise { - Logger.log(`Create Identity User ${user.email}`); - await this.createUser(user); - - const userIdentity = await this.getUserInfoByUsername(user.username); - await this.resetPassword(userIdentity.id, user.password); - user.idIdentityService = userIdentity.id; - return user; - } - - async deleteIdentityUser(userId: string): Promise { - await this.deleteUser(userId); - } - - async createUser(user: UserModel): Promise { - try { - const path = '/users'; - const method = 'POST'; - - const queryParams = {}; - const postBody = { - username: user.username, - firstName: user.firstName, - lastName: user.lastName, - enabled: true, - email: user.email - }; - - return this.api.performIdentityOperation(path, method, queryParams, postBody); - } catch (error) { - Logger.error('Create User - Service error, Response: ', JSON.parse(JSON.stringify(error))?.response?.text); - } - } - - async deleteUser(userId: string): Promise { - const path = `/users/${userId}`; - const method = 'DELETE'; - const queryParams = {}; - const postBody = {}; - - const deletePromise = this.api.performIdentityOperation(path, method, queryParams, postBody); - - await deletePromise.then(() => { - Logger.info(`user ${userId} delete`); - }); - - return deletePromise; - } - - async getUserInfoByUsername(username: string): Promise { - const path = `/users`; - const method = 'GET'; - const queryParams = { username }; - const postBody = {}; - - const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); - return data[0]; - } - - async resetPassword(id: string, password: string): Promise { - const path = `/users/${id}/reset-password`; - const method = 'PUT'; - const queryParams = {}; - const postBody = { type: 'password', value: password, temporary: false }; - - return this.api.performIdentityOperation(path, method, queryParams, postBody); - } - - async addUserToGroup(userId: string, groupId: string): Promise { - Logger.log(`Add user to group userId ${userId} ${groupId}`); - - try { - const path = `/users/${userId}/groups/${groupId}`; - const method = 'PUT'; - const queryParams = {}; - const postBody = { realm: 'alfresco', userId, groupId }; - - return this.api.performIdentityOperation(path, method, queryParams, postBody); - } catch (error) { - Logger.error('Add User To Group - Service error, Response: ', JSON.parse(JSON.stringify(error))); - } - } - - async assignRole(userId: string, roleId: string, roleName: string): Promise { - const path = `/users/${userId}/role-mappings/realm`; - const method = 'POST'; - const queryParams = {}; - const postBody = [{ id: roleId, name: roleName }]; - - return this.api.performIdentityOperation(path, method, queryParams, postBody); - } - - async deleteClientRole(userId: string, clientId: string, roleId: string, roleName: string): Promise { - const path = `/users/${userId}/role-mappings/clients/${clientId}`; - const method = 'DELETE'; - const queryParams = {}; - const postBody = [{ - id: roleId, - name: roleName, - composite: false, - clientRole: true, - containerId: clientId - }]; - return this.api.performIdentityOperation(path, method, queryParams, postBody); - } -} diff --git a/lib/testing/src/lib/protractor/core/actions/identity/public-api.ts b/lib/testing/src/lib/protractor/core/actions/identity/public-api.ts deleted file mode 100644 index 70c9205c204..00000000000 --- a/lib/testing/src/lib/protractor/core/actions/identity/public-api.ts +++ /dev/null @@ -1,21 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './identity.service'; -export * from './group-identity.service'; -export * from './roles.service'; -export * from './query.service'; diff --git a/lib/testing/src/lib/protractor/core/actions/identity/query.service.ts b/lib/testing/src/lib/protractor/core/actions/identity/query.service.ts deleted file mode 100644 index 7d7e16e231b..00000000000 --- a/lib/testing/src/lib/protractor/core/actions/identity/query.service.ts +++ /dev/null @@ -1,247 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { ApiService } from '../../../../shared/api/api.service'; -import { Logger } from '../../utils/logger'; -import { ApiUtil } from '../../../../shared/api/api.util'; - -export type TaskStatus = 'COMPLETED' | 'CREATED' | 'ASSIGNED' | 'SUSPENDED' | 'CANCELLED' | 'RUNNING'; - -export class QueryService { - - api: ApiService; - - constructor(api: ApiService) { - this.api = api; - } - - async getProcessInstanceTasks(processInstanceId, appName): Promise { - const predicate = (result: any) => result.list && result.list.entries.length > 0; - - const apiCall = async () => { - try { - const path = '/' + appName + '/query/v1/process-instances/' + processInstanceId + '/tasks'; - const method = 'GET'; - - const queryParams = {}; - const postBody = {}; - - return this.api.performBpmOperation(path, method, queryParams, postBody); - } catch (error) { - Logger.error('get process-instances tasks Service error'); - } - }; - - return ApiUtil.waitForApi(apiCall, predicate); - } - - async getProcessInstance(processInstanceId, appName): Promise { - const predicate = (result: any) => !!result; - - const apiCall = async () => { - try { - const path = '/' + appName + '/query/v1/process-instances/' + processInstanceId; - const method = 'GET'; - - const queryParams = {}; - const postBody = {}; - - return this.api.performBpmOperation(path, method, queryParams, postBody); - } catch (error) { - Logger.error('get process-instances Service error'); - } - }; - - return ApiUtil.waitForApi(apiCall, predicate); - } - - async getProcessInstanceSubProcesses(processInstanceId, appName): Promise { - const predicate = (result: any) => result.list && result.list.entries.length > 0; - - const apiCall = async () => { - try { - const path = '/' + appName + '/query/v1/process-instances/' + processInstanceId + '/subprocesses'; - const method = 'GET'; - - const queryParams = {}; - const postBody = {}; - - return this.api.performBpmOperation(path, method, queryParams, postBody); - } catch (error) { - Logger.error('get subprocesses process-instances Service error'); - } - }; - - return ApiUtil.waitForApi(apiCall, predicate); - } - - async getProcessInstanceTaskByStatus(processInstanceId, appName, taskName, status: TaskStatus): Promise { - const predicate = (result: any) => !!result; - - const apiCall = async () => { - try { - const path = '/' + appName + '/query/v1/process-instances/' + processInstanceId + '/tasks'; - const method = 'GET'; - - const queryParams = {}; - const postBody = {}; - - const data = await this.api.performBpmOperation(path, method, queryParams, postBody); - return data.list?.entries.length && data.list.entries.find(task => task.entry.name === taskName && task.entry.status === status); - } catch (error) { - Logger.error('get process-instances tasks by status - Service error'); - } - }; - - return ApiUtil.waitForApi(apiCall, predicate); - } - - async getTaskByStatus(taskName, appName, status: TaskStatus, standalone = false): Promise { - const predicate = (result: any) => !!result; - - const apiCall = async () => { - try { - const path = `/${appName}/query/v1/tasks?standalone=${standalone}&status=${status}&maxItems=1000&skipCount=0&sort=createdDate`; - const method = 'GET'; - - const queryParams = {}; - const postBody = {}; - - const data = await this.api.performBpmOperation(path, method, queryParams, postBody); - // eslint-disable-next-line @typescript-eslint/prefer-for-of - for (let i = 0; i < data.list.entries.length; i++) { - if (data.list.entries[i].entry.name === taskName) { - return data.list.entries[i]; - } - } - - } catch (error) { - Logger.error('Get Task By Status - Service error'); - } - }; - - return ApiUtil.waitForApi(apiCall, predicate); - } - - async getTaskByName(taskName, processInstanceId, appName): Promise { - const predicate = (result: any) => !!result; - - const apiCall = async () => { - try { - const path = '/' + appName + '/query/v1/process-instances/' + processInstanceId + '/tasks'; - const method = 'GET'; - - const queryParams = {}; - const postBody = {}; - - const data = await this.api.performBpmOperation(path, method, queryParams, postBody); - // eslint-disable-next-line @typescript-eslint/prefer-for-of - for (let i = 0; i < data.list.entries.length; i++) { - if (data.list.entries[i].entry.name === taskName) { - return data.list.entries[i]; - } - } - - } catch (error) { - Logger.error('Get Task By Name - Service error'); - } - }; - - return ApiUtil.waitForApi(apiCall, predicate); - } - - async getTask(taskName: string, processInstanceId: string, appName: string, status: string, retryCount = 15): Promise { - const path = '/' + appName + '/query/v1/process-instances/' + processInstanceId + '/tasks'; - const method = 'GET'; - - const queryParams = {}; - const postBody = {}; - - const data = await this.api.performBpmOperation(path, method, queryParams, postBody); - // eslint-disable-next-line @typescript-eslint/prefer-for-of - for (let i = 0; i < data.list.entries.length; i++) { - if (data.list.entries[i].entry.name === taskName) { - const task = data.list.entries[i]; - - if (task.entry.status === status) { - return task; - } else if (retryCount > 0) { - return this.getTask(taskName, processInstanceId, appName, status, retryCount--); - } else { - return task; - } - } - } - } - - async getTaskByNameAndStatus(taskName, processInstanceId, appName, status: TaskStatus): Promise { - const predicate = (result: any) => !!result; - - const apiCall = async () => { - try { - return this.getTask(taskName, processInstanceId, appName, status); - } catch (error) { - Logger.error('Get Task By Name - Service error'); - } - }; - - return ApiUtil.waitForApi(apiCall, predicate); - } - - async getProcessInstanceId(processName: string, appName: string): Promise { - const predicate = (result: any) => !!result; - - const apiCall = async () => { - try { - const path = '/' + appName + '/query/v1/process-instances'; - const method = 'GET'; - const queryParams = { name: processName }; - const postBody = {}; - const data = await this.api.performBpmOperation(path, method, queryParams, postBody); - return data.list.entries && data.list.entries.length > 0 ? data.list.entries[0].entry.id : null; - } catch (error) { - Logger.error('Get Process Instance Id - Service error, Response: ', JSON.parse(JSON.stringify(error))?.response?.text); - } - }; - - return ApiUtil.waitForApi(apiCall, predicate); - } - - async getProcessInstances(processName: string, appName: string, status?: TaskStatus): Promise { - const predicate = (result: any) => !!result; - - const apiCall = async () => { - try { - const path = '/' + appName + '/query/v1/process-instances'; - const method = 'GET'; - let queryParams; - if (status) { - queryParams = { name: processName, status }; - } else { - queryParams = { name: processName }; - } - const postBody = {}; - const data = await this.api.performBpmOperation(path, method, queryParams, postBody); - return data.list.entries ?? null; - } catch (error) { - Logger.error('Get Process Instances - Service error, Response: ', JSON.parse(JSON.stringify(error))?.response?.text); - } - }; - - return ApiUtil.waitForApi(apiCall, predicate, 2, 1000); - } -} diff --git a/lib/testing/src/lib/protractor/core/actions/identity/roles.service.ts b/lib/testing/src/lib/protractor/core/actions/identity/roles.service.ts deleted file mode 100644 index e2002fcb00c..00000000000 --- a/lib/testing/src/lib/protractor/core/actions/identity/roles.service.ts +++ /dev/null @@ -1,78 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { ApiService } from '../../../../shared/api/api.service'; - -export class RolesService { - - api: ApiService; - - constructor(api: ApiService) { - this.api = api; - } - - async createRole(roleName: string): Promise { - const path = '/roles'; - const method = 'POST'; - const queryParams = {}; - const postBody = { - name: roleName + 'TestRole' - }; - - return this.api.performIdentityOperation(path, method, queryParams, postBody); - } - - async deleteRole(roleId: string): Promise { - const path = `/roles-by-id/${roleId}`; - const method = 'DELETE'; - const queryParams = {}; - const postBody = {}; - - return this.api.performIdentityOperation(path, method, queryParams, postBody); - } - - async getRoleIdByRoleName(roleName: string): Promise { - const path = `/roles`; - const method = 'GET'; - const queryParams = {}; - const postBody = {}; - - const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); - for (const key in data) { - if (data[key].name === roleName) { - return data[key].id; - } - } - return undefined; - } - - async getClientRoleIdByRoleName(groupId: string, clientId: string, clientRoleName: string): Promise { - const path = `/groups/${groupId}/role-mappings/clients/${clientId}/available`; - const method = 'GET'; - const queryParams = {}; - const postBody = {}; - - const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); - for (const key in data) { - if (data[key].name === clientRoleName) { - return data[key].id; - } - } - return undefined; - } - -} diff --git a/lib/testing/src/lib/protractor/core/actions/public-api.ts b/lib/testing/src/lib/protractor/core/actions/public-api.ts deleted file mode 100644 index 50580f755cb..00000000000 --- a/lib/testing/src/lib/protractor/core/actions/public-api.ts +++ /dev/null @@ -1,22 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './identity/public-api'; -export * from './api.service.factory'; -export * from './drop.actions'; -export * from './users.actions'; -export * from './search.service'; diff --git a/lib/testing/src/lib/protractor/core/actions/search.service.ts b/lib/testing/src/lib/protractor/core/actions/search.service.ts deleted file mode 100644 index aa02092447d..00000000000 --- a/lib/testing/src/lib/protractor/core/actions/search.service.ts +++ /dev/null @@ -1,75 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { 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'; - -export class SearchService { - apiService: ApiService; - searchApi: SearchApi; - - constructor(apiService: ApiService) { - this.apiService = apiService; - this.searchApi = new SearchApi(this.apiService.getInstance()); - } - - async isSearchable(name: string): Promise { - const query = this.createSearchQuery(name); - const predicate = (result: ResultSetPaging) => !!result?.list?.entries?.find(({ entry }) => entry.name === name); - - return this.performSearch(query, predicate, 'Failed to search folder'); - } - - async performSearch(query, predicate, errorMessage): Promise { - const apiCall = async () => { - try { - return this.searchApi.search(query); - } catch (error) { - Logger.error(errorMessage); - return null; - } - }; - - return ApiUtil.waitForApi(apiCall, predicate); - } - - private createSearchQuery(name: string) { - return { - query: { - query: `${name}*` - }, - include: ['path', 'allowableOperations', 'properties'], - paging: { - maxItems: 20, - skipCount: 0 - }, - filterQueries: [ - { - query: `TYPE:'cm:folder' OR TYPE:'cm:content'` - }, - { - query: 'NOT cm:creator:System' - } - ], - scope: { - locations: ['nodes'] - } - }; - } -} diff --git a/lib/testing/src/lib/protractor/core/actions/users.actions.ts b/lib/testing/src/lib/protractor/core/actions/users.actions.ts deleted file mode 100644 index 6a4dabf0dae..00000000000 --- a/lib/testing/src/lib/protractor/core/actions/users.actions.ts +++ /dev/null @@ -1,138 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { 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'; -import { Logger } from '../utils/logger'; -import { Tenant } from '../models/tenant'; - -export class UsersActions { - api: ApiService; - identityService: IdentityService; - peopleApi: PeopleApi; - adminTenantsApi: AdminTenantsApi; - adminUsersApi: AdminUsersApi; - userProfileApi: UserProfileApi; - - constructor(apiService: ApiService) { - this.api = apiService; - this.peopleApi = new PeopleApi(apiService.getInstance()); - this.adminTenantsApi = new AdminTenantsApi(apiService.getInstance()); - this.adminUsersApi = new AdminUsersApi(apiService.getInstance()); - this.userProfileApi = new UserProfileApi(apiService.getInstance()); - if (this.api.apiService.isOauthConfiguration()) { - this.identityService = new IdentityService(this.api); - } - } - - async createUser(userModel?: UserModel): Promise { - if (!this.api.apiService.isLoggedIn()) { - await this.api.apiService.login(browser.params.testConfig.users.admin.username, browser.params.testConfig.users.admin.password); - } - - const user = new UserModel({ ...(userModel ? userModel : {}) }); - - try { - if (this.api.apiService.isEcmConfiguration() || this.api.apiService.isEcmBpmConfiguration()) { - Logger.log(`Create user ECM ${user.email}`); - await this.peopleApi.createPerson({ - id: user.username, - email: user.email, - firstName: user.firstName, - lastName: user.lastName, - password: user.password - }); - } - } catch (e) { - if (e.status === 409) { - Logger.error('ACS user already created'); - } else { - Logger.error('Not able to create ACS user: ' + JSON.stringify(e)); - } - } - - try { - 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); - user.id = apsUser.id; - } else { - const apsUser = await this.createTenantAndUser(user.email, user.firstName, user.lastName, user.password); - user.tenantId = apsUser.tenantId; - user.id = apsUser.id; - } - } - } catch (e) { - if (e.status === 409) { - Logger.error('BPM user already created'); - } else { - Logger.error('Not able to create BPM user: ' + JSON.stringify(e)); - } - } - - try { - if (this.api.apiService.isOauthConfiguration()) { - Logger.log('Create user identity'); - - const identityUser = await this.identityService.createIdentityUser(user); - user.idIdentityService = identityUser.idIdentityService; - } - } catch (e) { - if (e.status === 409) { - Logger.error('Identity user already created'); - } else { - Logger.error('Not able to create identity user: ' + JSON.stringify(e)); - } - } - - return user; - } - - async createTenantAndUser(email?: string, firstName?: string, lastName?: string, password?: string): Promise { - const newTenant = await this.adminTenantsApi.createTenant(new Tenant()); - - const user = new UserModel({ - tenantId: newTenant.id, - email, - firstName, - lastName, - password - }); - - return this.adminUsersApi.createNewUser(user.getAPSModel()); - } - - async createApsUser(tenantId?: number, email?: string, firstName?: string, lastName?: string, password?: string): Promise { - const user = new UserModel({ - tenantId, - email, - firstName, - lastName, - password - }); - - return this.adminUsersApi.createNewUser(user.getAPSModel()); - } - - async deleteTenant(tenantId: number) { - await this.adminTenantsApi.deleteTenant(tenantId); - } -} diff --git a/lib/testing/src/lib/protractor/core/dialog/edit-json-dialog.ts b/lib/testing/src/lib/protractor/core/dialog/edit-json-dialog.ts deleted file mode 100644 index 97d784a7752..00000000000 --- a/lib/testing/src/lib/protractor/core/dialog/edit-json-dialog.ts +++ /dev/null @@ -1,45 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { BrowserVisibility } from '../../core/utils/browser-visibility'; -import { materialLocators } from '../public-api'; - -export class EditJsonDialog { - - dialog = $(`.adf-edit-json-dialog`); - closeButton = element(by.cssContainingText(`button span`, 'Close')); - dialogContent = this.dialog.$(`${materialLocators.Dialog.content.root} textarea`); - - async checkDialogIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.dialog); - } - - async checkDialogIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.dialog); - } - - async clickCloseButton(): Promise { - await BrowserActions.click(this.closeButton); - } - - async getDialogContent(): Promise { - return BrowserActions.getInputValue(this.dialogContent); - } - -} diff --git a/lib/testing/src/lib/protractor/core/dialog/public-api.ts b/lib/testing/src/lib/protractor/core/dialog/public-api.ts deleted file mode 100644 index afc2f1a6ce0..00000000000 --- a/lib/testing/src/lib/protractor/core/dialog/public-api.ts +++ /dev/null @@ -1,18 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './edit-json-dialog'; diff --git a/lib/testing/src/lib/protractor/core/models/application-model.ts b/lib/testing/src/lib/protractor/core/models/application-model.ts deleted file mode 100644 index e96e0c746fd..00000000000 --- a/lib/testing/src/lib/protractor/core/models/application-model.ts +++ /dev/null @@ -1,34 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export interface ApplicationRepresentation { - releaseId: string; - security: SecurityRepresentation[]; - name: string; - infrastructure?: InfrastructureRepresentation; -} - -export interface SecurityRepresentation { - role: string; - users: string[]; - groups: string[]; -} - -export interface InfrastructureRepresentation { - connectors?: any; - bridges?: any; -} diff --git a/lib/testing/src/lib/protractor/core/models/file.model.ts b/lib/testing/src/lib/protractor/core/models/file.model.ts deleted file mode 100644 index 07b452bf947..00000000000 --- a/lib/testing/src/lib/protractor/core/models/file.model.ts +++ /dev/null @@ -1,36 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { StringUtil } from '../../../shared/utils/string.util'; - -export class FileModel { - - name = StringUtil.generateRandomString(); - location = StringUtil.generateRandomString(); - - constructor(details?: any) { - Object.assign(this, details); - } - - getName() { - return this.name; - } - - getLocation() { - return this.location; - } -} diff --git a/lib/testing/src/lib/protractor/core/models/public-api.ts b/lib/testing/src/lib/protractor/core/models/public-api.ts deleted file mode 100644 index a0fb7e79a45..00000000000 --- a/lib/testing/src/lib/protractor/core/models/public-api.ts +++ /dev/null @@ -1,21 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './user.model'; -export * from './application-model'; -export * from './file.model'; -export * from './tenant'; diff --git a/lib/testing/src/lib/protractor/core/models/tenant.ts b/lib/testing/src/lib/protractor/core/models/tenant.ts deleted file mode 100644 index 8fbc8d77b42..00000000000 --- a/lib/testing/src/lib/protractor/core/models/tenant.ts +++ /dev/null @@ -1,37 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { StringUtil } from '../../../shared/utils/string.util'; - -/** - * Create tenant JSON Object - * - * @param details - JSON object used to overwrite the default values - */ -export class Tenant { - - active = true; - configuration = 'DefaultConfig'; - domain = 'DefaultDomain'; - maxUsers = 10; - name = StringUtil.generateRandomString(); - - constructor(details?: any) { - Object.assign(this, details); - } - -} diff --git a/lib/testing/src/lib/protractor/core/models/user.model.ts b/lib/testing/src/lib/protractor/core/models/user.model.ts deleted file mode 100644 index b99e6c2f166..00000000000 --- a/lib/testing/src/lib/protractor/core/models/user.model.ts +++ /dev/null @@ -1,69 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { StringUtil } from '../../../shared/utils/string.util'; -import { browser } from 'protractor'; -import { UserRepresentation } from '@alfresco/js-api'; - -export class UserModel { - - firstName?: string = StringUtil.generateRandomLowercaseString(); - lastName?: string = StringUtil.generateRandomLowercaseString(); - password?: string = StringUtil.generateRandomLowercaseString(4) + StringUtil.generateRandomString(4).toUpperCase(); - email?: string; - username?: string; - idIdentityService?: string; - type = 'enterprise'; - tenantId?: number; - company?: string; - id: number; - - constructor(details: any = {}) { - const EMAIL_DOMAIN = browser.params?.testConfig?.emailDomain ? browser.params.testConfig.emailDomain : 'example.com'; - this.firstName = details.firstName ? details.firstName : this.firstName; - this.lastName = details.lastName ? details.lastName : this.lastName; - - const USER_IDENTIFY = `${this.firstName}${this.lastName}.${StringUtil.generateRandomLowercaseString(5)}`; - - this.password = details.password ? details.password : this.password; - this.email = details.email ? details.email : `${USER_IDENTIFY}@${EMAIL_DOMAIN}`; - this.username = details.username ? details.username : USER_IDENTIFY; - this.idIdentityService = details.idIdentityService ? details.idIdentityService : this.idIdentityService; - this.type = details.type ? details.type : this.type; - this.tenantId = details.tenantId ? details.tenantId : this.tenantId; - this.company = details.company ? details.company : this.company; - this.id = details.id ? details.id : this.id; - } - - get fullName() { - return `${this.firstName ?? ''} ${this.lastName ?? ''}`; - } - - getAPSModel() { - return new UserRepresentation({ - firstName: this.firstName, - lastName: this.lastName, - password: this.password, - email: this.email, - type: this.type, - tenantId: this.tenantId, - company: this.company, - id: this.id - }); - } - -} diff --git a/lib/testing/src/lib/protractor/core/pages/bread-crumb.page.ts b/lib/testing/src/lib/protractor/core/pages/bread-crumb.page.ts deleted file mode 100644 index 38c985d2546..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/bread-crumb.page.ts +++ /dev/null @@ -1,35 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { $ } from 'protractor'; -import { BrowserActions } from '../utils/browser-actions'; - -export class BreadcrumbPage { - - breadcrumb = $(`adf-breadcrumb nav[data-automation-id='breadcrumb']`); - currentItem = $('.adf-breadcrumb-item-current'); - - async chooseBreadCrumb(breadCrumbItem: string): Promise { - const path = this.breadcrumb.$(`a[data-automation-id='breadcrumb_${breadCrumbItem}']`); - await BrowserActions.click(path); - } - - async getActiveBreadCrumbItemName(): Promise { - return BrowserActions.getText(this.currentItem); - } - -} diff --git a/lib/testing/src/lib/protractor/core/pages/card-view/card-view-boolean-item.page.ts b/lib/testing/src/lib/protractor/core/pages/card-view/card-view-boolean-item.page.ts deleted file mode 100644 index 2d3c0217fb7..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/card-view/card-view-boolean-item.page.ts +++ /dev/null @@ -1,40 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { element, by, ElementFinder } from 'protractor'; -import { BrowserActions, BrowserVisibility } from '../../utils/public-api'; -import { materialLocators } from '../public-api'; - -export class CardBooleanItemPage { - - rootElement: ElementFinder; - labelLocator = 'div[data-automation-id*="card-boolean-label"]'; - checkbox = `${materialLocators.Checkbox.root}[data-automation-id*="card-boolean"]`; - - constructor(label: string = 'required') { - this.rootElement = element(by.xpath(`//div[contains(@data-automation-id, "label-${label}")]/ancestor::adf-card-view-boolitem`)); - } - - async checkboxClick(): Promise { - await BrowserActions.click(this.rootElement.$(this.checkbox)); - } - - async checkLabelIsPresent(): Promise { - const labelElement = this.rootElement.$(this.labelLocator); - await BrowserVisibility.waitUntilElementIsPresent(labelElement); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/card-view/card-view-date-item.page.ts b/lib/testing/src/lib/protractor/core/pages/card-view/card-view-date-item.page.ts deleted file mode 100644 index 383806bed80..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/card-view/card-view-date-item.page.ts +++ /dev/null @@ -1,56 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { element, by, ElementFinder, $$ } from 'protractor'; -import { DateTimePickerPage } from '../material/date-time-picker.page'; -import { DatePickerPage } from '../material/date-picker.page'; -import { BrowserVisibility } from '../../utils/browser-visibility'; -import { materialLocators } from '../public-api'; - -export class CardDateItemPage { - - rootElement: ElementFinder; - dateTimePickerPage: DateTimePickerPage; - datePickerPage = new DatePickerPage(); - - labelLocator = 'label[data-automation-id*="card-dateitem-label"]'; - valueLocator = 'span[data-automation-id*="card-date"]'; - dateTimePicker = $$(materialLocators.DatetimePicker.toggle.class).first(); - saveButton = 'button[data-automation-id*="card-dateitem-update"]'; - - constructor(label: string = 'minDate') { - this.rootElement = element(by.xpath(`//label[contains(@data-automation-id, "label-${label}")]/ancestor::adf-card-view-dateitem`)); - this.dateTimePickerPage = new DateTimePickerPage(this.rootElement); - } - - async setTodayDateValue(): Promise { - await this.dateTimePickerPage.setTodayDateValue(); - } - - async setDateValue(date: string): Promise { - return this.dateTimePickerPage.setDate(date); - } - - async getDateValue(): Promise { - return this.rootElement.$(this.valueLocator).getText(); - } - - async checkLabelIsVisible(): Promise { - const labelElement = this.rootElement.$(this.labelLocator); - await BrowserVisibility.waitUntilElementIsVisible(labelElement); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/card-view/card-view-select-item.page.ts b/lib/testing/src/lib/protractor/core/pages/card-view/card-view-select-item.page.ts deleted file mode 100644 index 415f42c288e..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/card-view/card-view-select-item.page.ts +++ /dev/null @@ -1,56 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { element, by, ElementFinder } from 'protractor'; -import { BrowserActions, BrowserVisibility } from '../../utils/public-api'; -import { DropdownPage } from '../material/dropdown.page'; -import { materialLocators } from '../public-api'; - -export class CardSelectItemPage { - - rootElement: ElementFinder; - labelLocator = 'div[data-automation-id*="card-select-label"]'; - readOnlyField = '[data-automation-class="read-only-value"]'; - dropdown: DropdownPage; - - constructor(label: string = 'fileSource') { - this.rootElement = element(by.xpath(`//div[contains(@data-automation-id, "label-${label}")]/ancestor::adf-card-view-selectitem`)); - this.dropdown = new DropdownPage(this.rootElement.$(materialLocators.Select.root)); - } - - async checkLabelIsPresent(): Promise { - const labelElement = this.rootElement.$(this.labelLocator); - await BrowserVisibility.waitUntilElementIsPresent(labelElement); - } - - async getSelectedOptionText(): Promise { - return this.dropdown.getSelectedOptionText(); - } - - async getReadonlyValue(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$(this.readOnlyField)); - return BrowserActions.getText(this.rootElement.$(this.readOnlyField)); - } - - async selectDropdownOption(option: string): Promise { - await this.dropdown.selectDropdownOption(option); - } - - async checkElementIsReadonly(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$(this.readOnlyField)); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/card-view/card-view-text-item.page.ts b/lib/testing/src/lib/protractor/core/pages/card-view/card-view-text-item.page.ts deleted file mode 100644 index 803f2a81e86..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/card-view/card-view-text-item.page.ts +++ /dev/null @@ -1,84 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { element, by, ElementFinder, Key } from 'protractor'; -import { BrowserActions, BrowserVisibility } from '../../utils/public-api'; -import { materialLocators } from '../public-api'; -export class CardTextItemPage { - - rootElement: ElementFinder; - textField = '[data-automation-id*="card-textitem-value"]'; - saveButton = 'button[data-automation-id*="card-textitem-update"]'; - clearButton = 'button[data-automation-id*="card-textitem-reset"]'; - field = '[data-automation-id*="card-textitem-value"]'; - labelLocator = '[data-automation-id*="card-textitem-label"]'; - errorMessage = '.adf-textitem-error'; - clickableElement = '.adf-textitem-clickable'; - readOnlyField = '.adf-property-read-only'; - - constructor(label: string = 'assignee') { - this.rootElement = element(by.xpath(`//${materialLocators.Label.root}[contains(@data-automation-id, "card-textitem-label-${label}")]//ancestor::adf-card-view-textitem`)); - } - - async getFieldValue(): Promise { - const fieldElement = this.rootElement.$(this.field); - return BrowserActions.getInputValue(fieldElement); - } - - async checkLabelIsPresent(): Promise { - const labelElement = this.rootElement.$(this.labelLocator); - await BrowserVisibility.waitUntilElementIsPresent(labelElement); - } - - async checkLabelIsVisible(): Promise { - const labelElement = this.rootElement.$(this.labelLocator); - await BrowserVisibility.waitUntilElementIsVisible(labelElement); - } - - async enterTextField(text: string, pauseBetweenTypingChars = 500): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$(this.textField)); - await BrowserActions.clearSendKeys(this.rootElement.$(this.textField), text, pauseBetweenTypingChars); - await this.rootElement.$(this.textField).sendKeys(Key.TAB); - } - - async clickOnSaveButton(): Promise { - await BrowserActions.click(this.rootElement.$(this.saveButton)); - } - - async clickOnClearButton(): Promise { - await BrowserActions.click(this.rootElement.$(this.clearButton)); - } - - async getErrorMessage(): Promise { - const errorField = this.rootElement.$(this.errorMessage); - return BrowserActions.getText(errorField); - } - - async checkElementIsReadonly(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$(this.readOnlyField)); - } - - async checkElementIsClickable(): Promise { - const clickableElement = this.rootElement.$(this.clickableElement); - await BrowserVisibility.waitUntilElementIsVisible(clickableElement); - } - - async clickField(): Promise { - const clickableElement = this.rootElement.$(this.clickableElement); - await BrowserActions.click(clickableElement); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/card-view/public-api.ts b/lib/testing/src/lib/protractor/core/pages/card-view/public-api.ts deleted file mode 100644 index d14c3c6c7cf..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/card-view/public-api.ts +++ /dev/null @@ -1,21 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './card-view-text-item.page'; -export * from './card-view-boolean-item.page'; -export * from './card-view-date-item.page'; -export * from './card-view-select-item.page'; diff --git a/lib/testing/src/lib/protractor/core/pages/context-menu.page.ts b/lib/testing/src/lib/protractor/core/pages/context-menu.page.ts deleted file mode 100644 index 3b23040728b..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/context-menu.page.ts +++ /dev/null @@ -1,37 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { $ } from 'protractor'; -import { BrowserActions } from '../utils/browser-actions'; -import { BrowserVisibility } from '../utils/browser-visibility'; - -export class ContextMenuPage { - contextMenu = $('#adf-context-menu-content'); - - async isContextMenuDisplayed(): Promise { - try { - await BrowserVisibility.waitUntilElementIsVisible(this.contextMenu); - return true; - } catch (error) { - return false; - } - } - - async clickContextMenuActionNamed(actionName: string): Promise { - await BrowserActions.click($(`button[data-automation-id="context-${actionName}"]`)); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/data-table-component.page.ts b/lib/testing/src/lib/protractor/core/pages/data-table-component.page.ts deleted file mode 100644 index dcf1dc402f2..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/data-table-component.page.ts +++ /dev/null @@ -1,571 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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, by, element, protractor, ElementFinder, ElementArrayFinder, $, $$ } from 'protractor'; -import { BrowserVisibility } from '../utils/browser-visibility'; -import { BrowserActions } from '../utils/browser-actions'; -import { Logger } from '../utils/logger'; -import { materialLocators } from './public-api'; - -const MAX_LOADING_TIME = 120000; - -export class DataTableComponentPage { - rootElement: ElementFinder; - list: ElementArrayFinder; - contents: ElementArrayFinder; - tableBody: ElementFinder; - allColumns: ElementArrayFinder; - selectedRowNumber: ElementFinder; - allSelectedRows: ElementArrayFinder; - selectAll: ElementFinder; - selectAllChecked: ElementFinder; - emptyList: ElementFinder; - emptyListTitle: ElementFinder; - emptyListSubtitle: ElementFinder; - noContentContainer: ElementFinder; - mainMenuButton: ElementFinder; - - rows = `adf-datatable div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`; - - constructor(rootElement = $$('adf-datatable').first()) { - this.rootElement = rootElement; - this.list = this.rootElement.$$(`div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`); - this.contents = this.rootElement.$$('.adf-datatable-body span'); - this.tableBody = this.rootElement.$$(`.adf-datatable-body`).first(); - this.allColumns = this.rootElement.$$('div[data-automation-id*="auto_header_content_id"]'); - this.mainMenuButton = this.rootElement.$('[data-automation-id="adf-datatable-main-menu-button"]'); - this.selectedRowNumber = this.rootElement.$(`adf-datatable-row[class*='is-selected'] div[data-automation-id*='text_']`); - this.allSelectedRows = this.rootElement.$$(`adf-datatable-row[class*='is-selected']`); - this.selectAllChecked = this.rootElement.$(`div[class*='adf-datatable-header'] ${materialLocators.Checkbox.root}.mat-mdc-checkbox-checked`); - this.selectAll = this.rootElement.$(`div[class*='adf-datatable-header'] ${materialLocators.Checkbox.root}`); - this.emptyList = this.rootElement.$(`adf-empty-content`); - this.emptyListTitle = this.rootElement.$(`.adf-empty-content__title`); - this.emptyListSubtitle = this.rootElement.$(`.adf-empty-content__subtitle`); - this.noContentContainer = $(`div[class*='adf-no-content-container']`); - } - - geCellElementDetail(detail: string): ElementArrayFinder { - return $$(`adf-datatable div[title="${detail}"] span`); - } - - async checkAllRowsButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.selectAll); - } - - async checkAllRows(): Promise { - await BrowserActions.click(this.selectAll); - await BrowserVisibility.waitUntilElementIsVisible(this.selectAllChecked); - } - - async uncheckAllRows(): Promise { - await BrowserActions.click(this.selectAll); - await BrowserVisibility.waitUntilElementIsNotVisible(this.selectAllChecked); - } - - async clickCheckbox(columnName: string, columnValue: string): Promise { - const checkbox = this.getRowCheckbox(columnName, columnValue); - await BrowserActions.click(checkbox); - } - - async checkRowIsNotChecked(columnName: string, columnValue: string): Promise { - const rowSelector = this.getRowCheckboxChecked(columnName, columnValue); - await BrowserVisibility.waitUntilElementIsNotVisible(rowSelector); - } - - async checkRowIsChecked(columnName: string, columnValue: string): Promise { - const rowCheckbox = this.getRowCheckboxChecked(columnName, columnValue); - await BrowserVisibility.waitUntilElementIsVisible(rowCheckbox); - } - - getRowCheckbox(columnName: string, columnValue: string): ElementFinder { - return this.getRow(columnName, columnValue).$(materialLocators.Checkbox.root); - } - - getRowCheckboxChecked(columnName: string, columnValue: string): ElementFinder { - return this.getRow(columnName, columnValue).$('mat-checkbox.mat-mdc-checkbox-checked'); - } - - async checkNoRowIsSelected(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.selectedRowNumber); - } - - async getNumberOfSelectedRows(): Promise { - return this.allSelectedRows.count(); - } - - async selectRow(columnName: string, columnValue: string): Promise { - await BrowserActions.closeMenuAndDialogs(); - const row = this.getRow(columnName, columnValue); - await BrowserActions.click(row); - } - - async selectRowWithKeyboard(columnName: string, columnValue: string): Promise { - await browser.actions().sendKeys(protractor.Key.COMMAND).perform(); - await this.selectRow(columnName, columnValue); - await browser.actions().sendKeys(protractor.Key.NULL).perform(); - } - - async checkRowIsSelected(columnName: string, columnValue: string): Promise { - const selectedRow = this.getCellElementByValue(columnName, columnValue).element( - by.xpath(`ancestor::adf-datatable-row[contains(@class, 'is-selected')]`) - ); - await BrowserVisibility.waitUntilElementIsVisible(selectedRow); - } - - async checkRowIsNotSelected(columnName: string, columnValue: string): Promise { - const selectedRow = this.getCellElementByValue(columnName, columnValue).element( - by.xpath(`ancestor::adf-datatable-row[contains(@class, 'is-selected')]`) - ); - await BrowserVisibility.waitUntilElementIsNotVisible(selectedRow); - } - - async getColumnValueForRow(identifyingColumn: string, identifyingValue: string, columnName: string): Promise { - const row = this.getRow(identifyingColumn, identifyingValue); - await BrowserVisibility.waitUntilElementIsVisible(row); - const rowColumn = row.$(`div[title="${columnName}"] span`); - return BrowserActions.getText(rowColumn); - } - - /** - * Check the list is sorted. - * - * @param sortOrder 'ASC' if the list is await expected to be sorted ascending and 'DESC' for descending - * @param columnTitle titleColumn column - * @param listType 'string' for string typed lists and 'number' for number typed (int, float) lists - * @returns 'true' if the list is sorted as await expected and 'false' if it isn't - */ - async checkListIsSorted(sortOrder: string, columnTitle: string, listType: string = 'STRING'): Promise { - const column = $$(`div.adf-datatable-cell[title='${columnTitle}'] span`); - await BrowserVisibility.waitUntilElementIsVisible(column.first()); - const initialList: string[] = []; - - const length = await column.count(); - - for (let i = 0; i < length; i++) { - const text: string = await BrowserActions.getText(column.get(i)); - if (text.length !== 0) { - initialList.push(text.toLowerCase()); - } - } - - let sortedList = [...initialList]; - if (listType.toLocaleLowerCase() === 'string') { - sortedList = sortedList.sort(); - } else if (listType.toLocaleLowerCase() === 'number') { - sortedList = sortedList.sort((a, b) => parseInt(a, 10) - parseInt(b, 10)); - } else if (listType.toLocaleLowerCase() === 'priority') { - sortedList = sortedList.sort(this.sortPriority); - } - - if (['desc', 'descending'].includes(sortOrder.toLocaleLowerCase())) { - sortedList = sortedList.reverse(); - } - - return initialList.toString() === sortedList.toString(); - } - - sortPriority(a: string, b: string) { - if (a === b) { - return 0; - } - - if (a.toLocaleLowerCase() === 'none') { - return -1; - } - - if (a.toLocaleLowerCase() === 'low') { - if (b === 'none') { - return 1; - } else { - return -1; - } - } - - if (a.toLocaleLowerCase() === 'normal') { - if (b.toLocaleLowerCase() === 'high') { - return -1; - } else { - return 1; - } - } - - return 1; - } - - async rightClickOnRow(columnName: string, columnValue: string): Promise { - await this.rightClickOnItem(columnName, columnValue); - await BrowserVisibility.waitUntilElementIsVisible($('#adf-context-menu-content')); - } - - async getTooltip(columnName: string, columnValue: string): Promise { - return BrowserActions.getAttribute(this.getCellElementByValue(columnName, columnValue), 'title'); - } - - async rightClickOnItem(columnName: string, columnValue: string): Promise { - const row = this.getRow(columnName, columnValue); - await BrowserActions.rightClick(row); - } - - getFileHyperlink(filename: string): ElementFinder { - return element(by.cssContainingText('adf-name-column[class*="adf-datatable-link"] span', filename)); - } - - async numberOfRows(): Promise { - try { - await this.waitForFirstRow(); - return this.rootElement.$$(this.rows).count(); - } catch (e) { - return 0; - } - } - - async waitForFirstRow(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$$(this.rows).first()); - } - - async getAllRowsColumnValues(column: string): Promise { - let columnValues: string[] = []; - const columnLocator = $$( - `adf-datatable div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row'] div[title="${column}"] span` - ); - - await BrowserVisibility.waitUntilElementIsPresent(columnLocator.first(), 1000); - try { - await BrowserVisibility.waitUntilElementIsPresent(columnLocator.first(), 1000); - columnValues = await columnLocator.filter(async (el) => el.isPresent()).map(async (el) => el.getText()); - } catch (error) { - Logger.log(error); - } - - return columnValues; - } - - async getRowsWithSameColumnValues(columnName: string, columnValue: string) { - const columnLocator = `div[title='${columnName}'] div[data-automation-id="text_${columnValue}"] span`; - await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$$(columnLocator).first()); - return this.rootElement.$$(columnLocator).getText(); - } - - async doubleClickRow(columnName: string, columnValue: string): Promise { - const row = this.getRow(columnName, columnValue); - await BrowserActions.click(row); - await browser.actions().sendKeys(protractor.Key.ENTER).perform(); - } - - async waitForTableBody(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.tableBody); - } - - // @deprecated Use Playwright API instead - async getFirstElementDetail(detail: string): Promise { - const firstNode = $$(`adf-datatable div[title="${detail}"] span`).first(); - return BrowserActions.getText(firstNode); - } - - /** - * Sort the list by name column. - * - * @param sortOrder 'ASC' to sort the list ascendant and 'DESC' for descendant - * @param titleColumn column title - */ - async sortByColumn(sortOrder: string, titleColumn: string): Promise { - const locator = $(`div[data-automation-id="auto_id_${titleColumn}"]`); - await BrowserVisibility.waitUntilElementIsVisible(locator); - const result = await BrowserActions.getAttribute(locator, 'class'); - - if (sortOrder.toLocaleLowerCase() === 'asc') { - if (!result.includes('sorted-asc')) { - if (result.includes('sorted-desc') || result.includes('sortable')) { - await BrowserActions.click(locator); - } - } - } else { - if (result.includes('sorted-asc')) { - await BrowserActions.click(locator); - } else if (result.includes('sortable')) { - await BrowserActions.click(locator); - await BrowserActions.click(locator); - } - } - } - - async checkContentIsDisplayed(columnName: string, columnValue: string, retry = 0): Promise { - Logger.log(`Wait content is displayed ${columnName} ${columnValue} retry: ${retry}`); - const row = this.getCellElementByValue(columnName, columnValue); - - try { - await BrowserVisibility.waitUntilElementIsVisible(row); - } catch (error) { - if (retry < 3) { - retry++; - await this.checkContentIsDisplayed(columnName, columnValue, retry); - } else { - throw error; - } - } - } - - async checkContentIsNotDisplayed(columnName: string, columnValue: string, retry = 0): Promise { - Logger.log(`Wait content is displayed ${columnName} ${columnValue} retry: ${retry}`); - const row = this.getCellElementByValue(columnName, columnValue); - - try { - await BrowserVisibility.waitUntilElementIsNotVisible(row); - } catch (error) { - if (retry < 3) { - retry++; - await this.checkContentIsNotDisplayed(columnName, columnValue, retry); - } else { - throw error; - } - } - } - - getRow(columnName: string, columnValue: string): ElementFinder { - return this.rootElement - .all( - by.xpath( - `//div[starts-with(@title, '${columnName}')]//div[contains(@data-automation-id, '${columnValue}')]//ancestor::adf-datatable-row[contains(@class, 'adf-datatable-row')]` - ) - ) - .first(); - } - - // @deprecated use Playwright instead - getRowByIndex(index: number): ElementFinder { - return this.rootElement.element( - by.xpath(`//div[contains(@class,'adf-datatable-body')]//adf-datatable-row[contains(@class,'adf-datatable-row')][${index}]`) - ); - } - - async contentInPosition(position: number): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.contents.first()); - return BrowserActions.getText(this.contents.get(position - 1)); - } - - getCellElementByValue(columnName: string, columnValue: string, columnPrefix = 'text_'): ElementFinder { - return this.rootElement.$$(`div[title="${columnName}"] div[data-automation-id="${columnPrefix}${columnValue}"] span`).first(); - } - - async tableIsLoaded(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.rootElement); - } - - async waitTillContentLoaded(): Promise { - if (await this.isSpinnerPresent()) { - Logger.log('wait datatable loading spinner disappear'); - await BrowserVisibility.waitUntilElementIsNotVisible( - this.rootElement.element(by.tagName(materialLocators.Progress.spinner.root)), - MAX_LOADING_TIME - ); - - if (await this.isEmpty()) { - Logger.log('empty page'); - } else { - await this.waitFirstElementPresent(); - } - } else if (await this.isEmpty()) { - Logger.log('empty page'); - } else { - try { - Logger.log('wait datatable loading spinner is present'); - await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.element(by.tagName(materialLocators.Progress.spinner.root)), 2000); - await BrowserVisibility.waitUntilElementIsNotVisible( - this.rootElement.element(by.tagName(materialLocators.Progress.spinner.root)), - MAX_LOADING_TIME - ); - } catch (error) { - Logger.error('Loading spinner is not present'); - } - - if (await this.isEmpty()) { - Logger.log('empty page'); - } else { - await this.waitFirstElementPresent(); - } - } - } - - async waitTillContentLoadedInfinitePagination(): Promise { - await browser.sleep(500); - - if (await this.isInfiniteSpinnerPresent()) { - Logger.log('wait datatable loading spinner disappear'); - await BrowserVisibility.waitUntilElementIsNotVisible(element(by.tagName(materialLocators.Progress.bar.root))); - - if (await this.isEmpty()) { - Logger.log('empty page'); - } else { - await this.waitFirstElementPresent(); - } - } else { - try { - Logger.log('wait datatable loading spinner is present'); - await BrowserVisibility.waitUntilElementIsVisible(element(by.tagName(materialLocators.Progress.bar.root))); - } catch (error) { - Logger.error('Infinite pagination spinner is not present'); - } - if (await this.isEmpty()) { - Logger.log('empty page'); - } else { - await this.waitFirstElementPresent(); - } - } - } - - // @deprecated use Playwright instead - async isColumnDisplayed(columnTitle: string): Promise { - const isColumnDisplayed = (await this.allColumns).some(async (column) => { - const columnText = await column.getText(); - return columnText === columnTitle; - }); - - return isColumnDisplayed; - } - - // @deprecated use Playwright instead - async getNumberOfColumns(): Promise { - return this.allColumns.count(); - } - - async getNumberOfRows(): Promise { - return this.list.count(); - } - - getCellByRowNumberAndColumnName(rowNumber: number, columnName: string): ElementFinder { - return this.list.get(rowNumber).$$(`div[title="${columnName}"] span`).first(); - } - - getCellByRowContentAndColumn(rowColumn: string, rowContent: string, columnName: string): ElementFinder { - return this.getRow(rowColumn, rowContent).$(`div[title='${columnName}']`); - } - - async selectRowByContent(content: string): Promise { - const row = this.getCellByContent(content); - await BrowserActions.click(row); - } - - async checkRowByContentIsSelected(folderName: string): Promise { - const selectedRow = this.getCellByContent(folderName).element(by.xpath(`ancestor::adf-datatable-row[contains(@class, 'is-selected')]`)); - await BrowserVisibility.waitUntilElementIsVisible(selectedRow); - } - - async checkRowByContentIsNotSelected(folderName: string): Promise { - const selectedRow = this.getCellByContent(folderName).element(by.xpath(`ancestor::adf-datatable-row[contains(@class, 'is-selected')]`)); - await BrowserVisibility.waitUntilElementIsNotVisible(selectedRow); - } - - getCellByContent(content: string): ElementFinder { - return this.rootElement - .all(by.cssContainingText(`adf-datatable-row[class*='adf-datatable-row'] div[class*='adf-datatable-cell']`, content)) - .first(); - } - - async checkCellByHighlightContent(content: string): Promise { - const cell = this.rootElement.element( - by.cssContainingText( - `adf-datatable-row[class*='adf-datatable-row'] div[class*='adf-name-location-cell-name'] span.adf-highlight`, - content - ) - ); - await BrowserVisibility.waitUntilElementIsVisible(cell); - } - - async clickRowByContent(name: string): Promise { - const resultElement = this.rootElement.$$(`div[data-automation-id='${name}']`).first(); - await BrowserActions.click(resultElement); - } - - async clickRowByContentCheckbox(name: string): Promise { - const resultElement = this.rootElement - .$$(`div[data-automation-id='${name}']`) - .first() - .element(by.xpath(`ancestor::adf-datatable-row/label/${materialLocators.Checkbox.root}`)); - browser.actions().mouseMove(resultElement); - await BrowserActions.click(resultElement); - } - - async checkRowContentIsDisplayed(content: string): Promise { - const resultElement = this.rootElement.$$(`div[data-automation-id='${content}']`).first(); - await BrowserVisibility.waitUntilElementIsVisible(resultElement); - } - - async checkRowContentIsNotDisplayed(content: string): Promise { - const resultElement = this.rootElement.$$(`div[data-automation-id='${content}']`).first(); - await BrowserVisibility.waitUntilElementIsNotVisible(resultElement); - } - - async checkRowContentIsDisabled(content: string): Promise { - const resultElement = this.rootElement.$$(`div[data-automation-id='${content}'] div.adf-cell-value img[aria-label='Disabled']`).first(); - await BrowserVisibility.waitUntilElementIsVisible(resultElement); - } - - async doubleClickRowByContent(name: string): Promise { - const resultElement = this.rootElement.$$(`div[data-automation-id='${name}']`).first(); - await BrowserActions.click(resultElement); - await browser.actions().sendKeys(protractor.Key.ENTER).perform(); - } - - async isEmpty(): Promise { - await browser.sleep(500); - - let isDisplayed; - - try { - isDisplayed = await this.emptyList.isDisplayed(); - } catch (error) { - isDisplayed = false; - } - - Logger.log(`empty page isDisplayed ${isDisplayed}`); - - return isDisplayed; - } - - private async isSpinnerPresent(): Promise { - let isSpinnerPresent; - - try { - isSpinnerPresent = await this.rootElement.element(by.tagName(materialLocators.Progress.spinner.root)).isDisplayed(); - } catch (error) { - isSpinnerPresent = false; - } - - return isSpinnerPresent; - } - - private async isInfiniteSpinnerPresent(): Promise { - let isSpinnerPresent; - - try { - isSpinnerPresent = await this.rootElement.element(by.tagName(materialLocators.Progress.bar.root)).isDisplayed(); - } catch (error) { - isSpinnerPresent = false; - } - - return isSpinnerPresent; - } - - private async waitFirstElementPresent(): Promise { - try { - Logger.log('wait first element is present'); - await BrowserVisibility.waitUntilElementIsVisible(this.contents.first()); - } catch (error) { - Logger.log('Possible empty page'); - } - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/data-table/column.ts b/lib/testing/src/lib/protractor/core/pages/data-table/column.ts deleted file mode 100644 index 731feed600d..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/data-table/column.ts +++ /dev/null @@ -1,34 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export abstract class Column { - columnName: string; - columnType: string; - - constructor(columnName: string, columnType: string ) { - this.columnName = columnName; - this.columnType = columnType; - } - - createLocator(columnValue: string): string { - return `//div[@data-automation-id="${this.columnType}_${columnValue}"]`; - } - - getColumnName(): string { - return this.columnName; - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/data-table/columns-selector.ts b/lib/testing/src/lib/protractor/core/pages/data-table/columns-selector.ts deleted file mode 100644 index 5b83ea1001a..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/data-table/columns-selector.ts +++ /dev/null @@ -1,59 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 } from 'protractor'; -import { TestElement } from '../../test-element'; - -export class DataTableColumnSelector { - columnsSelectorComponent = TestElement.byCss('[data-automation-id="adf-columns-selector"]'); - - closeButton = TestElement.byCss('[data-automation-id="adf-columns-selector-close-button"]'); - searchInput = TestElement.byCss('[data-automation-id="adf-columns-selector-search-input"]'); - applyButton = TestElement.byCss('[data-automation-id="adf-columns-selector-apply-button"]'); - columnsListContainer = TestElement.byCss('.adf-columns-selector-list-container'); - allColumnsSelectors = this.columnsListContainer.elementFinder.all( - by.css('.adf-columns-selector-column-checkbox') - ); - - async getAllColumnSelectors(): Promise<{ name: string; isSelected: boolean }[]> { - const columnCheckboxes = this.allColumnsSelectors.map<[string, boolean]>(column => { - const checkBoxElement = column.element(by.tagName('input')); - return Promise.all([ - column.getText(), - checkBoxElement.isSelected() - ]); - }); - - const checkboxesValues = await columnCheckboxes; - - return checkboxesValues.map(([name, isSelected]) => ({ - name, - isSelected - })); - } - - async selectColumn(columnName: string): Promise { - const columnSelector = this.allColumnsSelectors.filter( - async column => { - const columnText = await column.getText(); - return columnText === columnName; - } - ).first(); - - return columnSelector.click(); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/data-table/data-table-builder.ts b/lib/testing/src/lib/protractor/core/pages/data-table/data-table-builder.ts deleted file mode 100644 index 3607bb28117..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/data-table/data-table-builder.ts +++ /dev/null @@ -1,43 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { Column } from './column'; -import { TextColumn } from './text-column'; -import { DateColumn } from './date-column'; -import { DataTableItem } from './data-table-item'; -import { ElementFinder } from 'protractor'; - -export class DataTableBuilder { - - createDataTable(columns: Column[], rootElement?: ElementFinder): DataTableItem { - const datatable: DataTableItem = new DataTableItem(rootElement); - for (const column of columns) { - switch (column.columnType) { - case 'date': { - datatable.addItem(new DateColumn(column.columnName)); - break; - } - case 'custom': { - datatable.addItem(column); - break; - } - default: datatable.addItem(new TextColumn(column.columnName)); - } - } - return datatable; - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/data-table/data-table-item.ts b/lib/testing/src/lib/protractor/core/pages/data-table/data-table-item.ts deleted file mode 100644 index 8b7a2989eec..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/data-table/data-table-item.ts +++ /dev/null @@ -1,95 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { Column } from './column'; -import { by, element, ElementFinder, protractor, browser, $$ } from 'protractor'; -import { BrowserActions } from '../../utils/browser-actions'; -import { BrowserVisibility } from '../../utils/browser-visibility'; - -export class DataTableItem { - columns = new Array(); - rootElement: ElementFinder; - rows = `div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`; - - constructor(rootElement = $$('adf-datatable').first()) { - this.rootElement = rootElement; - } - - addItem(column: Column): void { - this.columns.push(column); - } - - async getColumn(columnName: string): Promise { - return this.columns.find( - (column) => column.getColumnName() === columnName - ); - } - - async getRow(columnName: string, columnValue: string): Promise { - const column = await this.getColumn(columnName); - const locator = `//div[@title="${column.columnName}"]` + column.createLocator(columnValue) + `//ancestor::adf-datatable-row[contains(@class, 'adf-datatable-row')]`; - return this.rootElement.element(by.xpath(locator)); - } - - async selectRow(columnName: string, columnValue: string): Promise { - await BrowserActions.closeMenuAndDialogs(); - const row = await this.getRow(columnName, columnValue); - await BrowserActions.click(row); - } - - async rightClickOnRow(columnName: string, columnValue: string): Promise { - const row = await this.getRow(columnName, columnValue); - await browser.actions().mouseMove(row).perform(); - await browser.actions().click(row, protractor.Button.RIGHT).perform(); - } - - async waitForFirstRow(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$$(this.rows).first()); - } - - async clickAndEnterOnRow(columnName: string, columnValue: string): Promise { - const row = await this.getRow(columnName, columnValue); - await BrowserActions.click(row); - await this.checkRowIsSelected(columnName, columnValue); - await browser.actions().sendKeys(protractor.Key.ENTER).perform(); - } - - async getColumnValueForRow(identifyingColumnName: string, identifyingColumnValue: string, columnName: string): Promise { - const row = await this.getRow(identifyingColumnName, identifyingColumnValue); - await BrowserVisibility.waitUntilElementIsVisible(row); - const rowColumn = row.$(`div[title="${columnName}"] span`); - return BrowserActions.getText(rowColumn); - } - - async checkRowIsSelected(columnName: string, columnValue: string): Promise { - const column = await this.getColumn(columnName); - const locator = `//div[@title="${column.columnName}"]` + column.createLocator(columnValue) + `//ancestor::adf-datatable-row[contains(@class, 'is-selected')]`; - await BrowserVisibility.waitUntilElementIsVisible(element(by.xpath(locator))); - } - - async checkRowIsNotSelected(columnName: string, columnValue: string): Promise { - const column = await this.getColumn(columnName); - const locator = `//div[@title="${column.columnName}"]` + column.createLocator(columnValue) + `//ancestor::adf-datatable-row[contains(@class, 'is-selected')]`; - await BrowserVisibility.waitUntilElementIsNotVisible(element(by.xpath(locator))); - } - - async selectRowWithKeyboard(columnName: string, columnValue: string): Promise { - await browser.actions().sendKeys(protractor.Key.COMMAND).perform(); - await this.selectRow(columnName, columnValue); - await browser.actions().sendKeys(protractor.Key.NULL).perform(); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/data-table/date-column.ts b/lib/testing/src/lib/protractor/core/pages/data-table/date-column.ts deleted file mode 100644 index bf38660a2e1..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/data-table/date-column.ts +++ /dev/null @@ -1,27 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { Column } from './column'; - -export class DateColumn extends Column { - columnType: string; - columnName: string; - - constructor(columnName: string) { - super(columnName, 'date'); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/data-table/public-api.ts b/lib/testing/src/lib/protractor/core/pages/data-table/public-api.ts deleted file mode 100644 index 39f63c2b16f..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/data-table/public-api.ts +++ /dev/null @@ -1,21 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './data-table-builder'; -export * from './column'; -export * from './data-table-item'; -export * from './columns-selector'; diff --git a/lib/testing/src/lib/protractor/core/pages/data-table/text-column.ts b/lib/testing/src/lib/protractor/core/pages/data-table/text-column.ts deleted file mode 100644 index c29f2a99253..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/data-table/text-column.ts +++ /dev/null @@ -1,27 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { Column } from './column'; - -export class TextColumn extends Column { - columnType: string; - columnName: string; - - constructor(columnName: string) { - super(columnName, 'text'); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/form/form-fields.ts b/lib/testing/src/lib/protractor/core/pages/form/form-fields.ts deleted file mode 100644 index 5eb10ca824a..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/form-fields.ts +++ /dev/null @@ -1,248 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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, Locator, by, element, ElementFinder, $, $$ } from 'protractor'; -import { BrowserVisibility, BrowserActions } from '../../utils/public-api'; -import { DropdownPage } from '../material/dropdown.page'; -import { materialLocators } from '../public-api'; - -export class FormFields { - - selectFormDropdown = new DropdownPage($$(`.adf-attach-form ${materialLocators.Select.arrow.class}`).first()); - formContent = $('adf-form-renderer'); - refreshButton = $(`div[class*="form-reload-button"] ${materialLocators.Icon.root}`); - saveButton = element(by.cssContainingText(`${materialLocators.Card.actions}[class*="adf-for"] span`, 'SAVE')); - valueLocator: Locator = by.css('input'); - labelLocator: Locator = by.css('label'); - noFormMessage = $('.adf-empty-content__title'); - noFormMessageStandaloneTask = $('adf-task-standalone #adf-no-form-message'); - noFormTemplate = $('adf-empty-content'); - completedTaskNoFormMessage = $('div[id*="completed-form-message"] p'); - completedStandaloneTaskNoFormMessage = $('adf-task-standalone #adf-completed-form-message'); - attachFormButton = $('#adf-attach-form-attach-button'); - completeButton = $('#adf-form-complete'); - completeNoFormButton = $('#adf-no-form-complete-button'); - cancelButton = $('#adf-no-form-cancel-button'); - errorMessage: Locator = by.css('.adf-error-container .adf-error-text'); - - getWidget = (fieldId: string): ElementFinder => $(`div[id='field-${fieldId}-container']`); - - async setFieldValue(field: string, value: string): Promise { - const fieldElement = $(`#${field}`); - await BrowserActions.clearSendKeys(fieldElement, value); - } - - async checkFieldValue(field: string, value: string): Promise { - const fieldElement = $(`#${field}`); - await BrowserVisibility.waitUntilElementHasValue(fieldElement, value); - } - - async checkWidgetIsVisible(fieldId: string): Promise { - const fieldElement = $$(`div[id='field-${fieldId}-container']`).first(); - await BrowserVisibility.waitUntilElementIsVisible(fieldElement); - } - - async checkWidgetsAreVisible(fieldsId: string[]): Promise { - for (const fieldId of fieldsId) { - await this.checkWidgetIsVisible(fieldId); - } - } - - async checkWidgetIsClickable(fieldId: string): Promise { - const fieldElement = $$(`div[id='field-${fieldId}-container']`).first(); - await BrowserVisibility.waitUntilElementIsClickable(fieldElement); - } - - async checkWidgetIsHidden(fieldId: string): Promise { - const hiddenElement = $(`div[id='field-${fieldId}-container']`); - await BrowserVisibility.waitUntilElementIsNotVisible(hiddenElement, 6000); - } - - async getFieldValue(fieldId: string, valueLocatorParam?: any): Promise { - const valueWidget = await (await this.getWidget(fieldId)).element(valueLocatorParam || this.valueLocator); - await BrowserVisibility.waitUntilElementIsVisible(valueWidget); - - return BrowserActions.getInputValue(valueWidget); - } - - async getFieldLabel(fieldId: string, labelLocatorParam?: any) { - const label = await (await this.getWidget(fieldId)).all(labelLocatorParam || this.labelLocator).first(); - return BrowserActions.getText(label); - } - - async getFieldErrorMessage(fieldId: string): Promise { - const error = await this.getWidget(fieldId).element(this.errorMessage); - return BrowserActions.getText(error); - } - - async getFieldText(fieldId: string, labelLocatorParam?: any) { - const label = await (await this.getWidget(fieldId)).element(labelLocatorParam || this.labelLocator); - return BrowserActions.getText(label); - } - - async getFieldPlaceHolder(fieldId: string, locator = 'input'): Promise { - const placeHolderLocator = $(`${locator}#${fieldId}`); - await BrowserVisibility.waitUntilElementIsVisible(placeHolderLocator); - return BrowserActions.getAttribute(placeHolderLocator, 'placeholder'); - } - - async refreshForm(): Promise { - await BrowserActions.click(this.refreshButton); - await browser.sleep(500); - } - - async saveForm(): Promise { - await BrowserActions.click(this.saveButton); - } - - async isNoFormTemplateDisplayed(): Promise { - try { - await BrowserVisibility.waitUntilElementIsVisible( - this.noFormTemplate - ); - return true; - } catch (error) { - return false; - } - } - - async noFormIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.formContent); - } - - async checkFormIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.formContent); - } - - async getNoFormMessage(): Promise { - return BrowserActions.getText(this.noFormMessage); - } - - async getNoFormMessageStandaloneTask(): Promise { - return BrowserActions.getText(this.noFormMessageStandaloneTask); - } - - async getCompletedTaskNoFormMessage(): Promise { - return BrowserActions.getText(this.completedTaskNoFormMessage); - } - - async getCompletedStandaloneTaskNoFormMessage(): Promise { - return BrowserActions.getText(this.completedStandaloneTaskNoFormMessage); - } - - async isStandaloneTaskNoFormMessageDisplayed(): Promise { - try { - await BrowserVisibility.waitUntilElementIsVisible(this.noFormMessageStandaloneTask); - return true; - } catch (error) { - return false; - } - } - - async isAttachFormButtonDisplayed(): Promise { - try { - await BrowserVisibility.waitUntilElementIsVisible(this.attachFormButton); - return true; - } catch (error) { - return false; - } - } - - async clickOnAttachFormButton(): Promise { - await BrowserActions.click(this.attachFormButton); - } - - async selectForm(formName: string): Promise { - await this.selectFormDropdown.selectDropdownOption(formName); - } - - async selectFormFromDropDown(formName: string): Promise { - const formNameElement = element(by.cssContainingText('span', formName)); - await BrowserActions.click(formNameElement); - } - - async checkWidgetIsReadOnlyMode(fieldId: string): Promise { - const widget = $(`adf-form-field #field-${fieldId}-container .adf-readonly`); - await BrowserVisibility.waitUntilElementIsVisible(widget); - return widget; - } - - async isFormFieldEnabled(formFieldId: string): Promise { - return $(`#${formFieldId}`).isEnabled(); - } - - async completeForm(): Promise { - await BrowserActions.click(this.completeButton); - } - - async completeNoFormTask(): Promise { - await BrowserActions.click(this.completeNoFormButton); - } - - async clickCancelButton(): Promise { - await BrowserActions.click(this.cancelButton); - } - - async setValueInInputById(fieldId: string, value: string): Promise { - const input = $(`#${fieldId}`); - await BrowserActions.clearSendKeys(input, value); - } - - async isCompleteButtonDisplayed(): Promise { - try { - await BrowserVisibility.waitUntilElementIsVisible(this.completeButton); - return true; - } catch (error) { - return false; - } - } - - async isCompleteNoFormButtonDisplayed(): Promise { - try { - await BrowserVisibility.waitUntilElementIsVisible(this.completeNoFormButton); - return true; - } catch (error) { - return false; - } - } - - async isSaveFormButtonEnabled(): Promise { - return this.saveButton.isEnabled(); - } - - async isCompleteFormButtonEnabled(): Promise { - return this.completeButton.isEnabled(); - } - - async isCompleteNoFormButtonEnabled(): Promise { - return this.completeNoFormButton.isEnabled(); - } - - async isCancelButtonDisplayed(): Promise { - try { - await BrowserVisibility.waitUntilElementIsVisible(this.cancelButton); - return true; - } catch (error) { - return false; - } - } - - async isCancelButtonEnabled(): Promise { - return this.cancelButton.isEnabled(); - } - -} diff --git a/lib/testing/src/lib/protractor/core/pages/form/form.page.ts b/lib/testing/src/lib/protractor/core/pages/form/form.page.ts deleted file mode 100644 index 35030e70074..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/form.page.ts +++ /dev/null @@ -1,80 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { element, by, $ } from 'protractor'; -import { BrowserVisibility } from '../../utils/browser-visibility'; -import { BrowserActions } from '../../utils/public-api'; -import { materialLocators } from '../public-api'; - -export class FormPage { - - errorLog = $('div[class*="console"]'); - saveButton = element(by.cssContainingText(`${materialLocators.Card.actions}[class*="adf-for"] span`, 'SAVE')); - - async checkErrorMessageForWidgetIsDisplayed(errorMessage: string): Promise { - await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('.adf-error-text', errorMessage))); - } - - async checkErrorMessageForWidgetIsNotDisplayed(errorMessage: string): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('.adf-error-text', errorMessage))); - } - - async checkErrorLogMessage(errorMessage: string): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.errorLog); - await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('div[class*="console"] p', errorMessage))); - } - - async checkErrorMessageIsNotDisplayed(errorMessage: string): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.errorLog); - await BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('div[class*="console"] p', errorMessage))); - } - - async saveForm() { - await BrowserActions.click(this.saveButton); - } - - async isSaveButtonDisabled(): Promise { - const saveButtonDisabled = $('#adf-form-save[disabled]'); - try { - await saveButtonDisabled.isDisplayed(); - return true; - } catch { - return false; - } - } - - async isValidationIconBlue(): Promise { - const validationIcon = $('#adf-valid-form-icon'); - try { - await validationIcon.isDisplayed(); - return true; - } catch { - return false; - } - } - - async isValidationIconRed(): Promise { - const validationIcon = $('#adf-invalid-form-icon'); - try { - await validationIcon.isDisplayed(); - return true; - } catch { - return false; - } - } - -} diff --git a/lib/testing/src/lib/protractor/core/pages/form/public-api.ts b/lib/testing/src/lib/protractor/core/pages/form/public-api.ts deleted file mode 100644 index 8b26e5ac568..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/public-api.ts +++ /dev/null @@ -1,22 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './widgets/public-api'; - -export * from './form-fields'; -export * from './form.page'; -export * from './start-form.page'; diff --git a/lib/testing/src/lib/protractor/core/pages/form/start-form.page.ts b/lib/testing/src/lib/protractor/core/pages/form/start-form.page.ts deleted file mode 100644 index 8cfd2432e9a..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/start-form.page.ts +++ /dev/null @@ -1,22 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { TestElement } from '../../test-element'; - -export class StartFormPage { - startProcessForm = TestElement.byCss('.adf-start-form-container'); -} diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/amount-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/amount-widget.page.ts deleted file mode 100644 index 9a0fd10a2c2..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/amount-widget.page.ts +++ /dev/null @@ -1,64 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { $$, $ } from 'protractor'; -import { BrowserVisibility, BrowserActions } from '../../../utils/public-api'; -import { FormFields } from '../form-fields'; - -export class AmountWidgetPage { - - currency = '.adf-amount-widget__prefix-spacing'; - formFields: FormFields = new FormFields(); - - async getAmountFieldLabel(fieldId: string): Promise { - const label = $$(`adf-form-field div[id="field-${fieldId}-container"] label`).first(); - return BrowserActions.getText(label); - } - - async getAmountFieldCurrency(fieldId: string): Promise { - const widget = await this.formFields.getWidget(fieldId); - return BrowserActions.getText(widget.$(this.currency)); - } - - async setFieldValue(fieldId: string, value: any): Promise { - await this.formFields.setValueInInputById(fieldId, value); - } - - async removeFromAmountWidget(fieldId: string) { - const amountWidgetInput = $(`#${fieldId}`); - await BrowserActions.clearWithBackSpace(amountWidgetInput); - } - - async clearFieldValue(fieldId: string): Promise { - const numberField = $(`#${fieldId}`); - await BrowserVisibility.waitUntilElementIsVisible(numberField); - await numberField.clear(); - } - - async checkWidgetIsVisible(fieldId: string): Promise { - await this.formFields.checkWidgetIsVisible(fieldId); - } - - async getErrorMessage(fieldId: string): Promise { - const errorMessage = $(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`); - return BrowserActions.getText(errorMessage); - } - - async getPlaceholder(fieldId: string): Promise { - return this.formFields.getFieldPlaceHolder(fieldId); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/attach-file-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/attach-file-widget.page.ts deleted file mode 100644 index 92fbaf3ba39..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/attach-file-widget.page.ts +++ /dev/null @@ -1,169 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { FormFields } from '../form-fields'; -import { BrowserVisibility, BrowserActions } from '../../../utils/public-api'; -import { by, browser, $ } from 'protractor'; -import { TestElement } from '../../../test-element'; -import { materialLocators } from '../../public-api'; - -export class AttachFileWidgetPage { - formFields = new FormFields(); - alfrescoTypeUploadLocator = 'button[id="attachfile"]'; - localStorageButton = $('input[id="attachfile"]'); - filesListLocator = 'div[data-automation-id="adf-attach-widget-readonly-list"]'; - attachFileWidget = $('#attachfile'); - attachedFileMenu = $(`${materialLocators.List.item.root} button`); - attachedFileOptions = $(`${materialLocators.Menu.panel} ${materialLocators.Menu.content.class}`); - viewFileOptionButton = $(`${materialLocators.Menu.panel} ${materialLocators.Menu.content.class} button[id$="show-file"]`); - downloadFileOptionButton = $(`${materialLocators.Menu.panel} ${materialLocators.Menu.content.class} button[id$="download-file"]`); - removeFileOptionButton = TestElement.byCss(`${materialLocators.Menu.panel} ${materialLocators.Menu.content.class} button[id$="remove"]`); - - async attachFile(fieldId: string, fileLocation: string): Promise { - const widget = await this.formFields.getWidget(fieldId); - const uploadButton = await widget.$(this.alfrescoTypeUploadLocator); - await BrowserActions.click(uploadButton); - await BrowserVisibility.waitUntilElementIsPresent(this.localStorageButton); - await this.localStorageButton.sendKeys(fileLocation); - } - - async checkNoFileIsAttached(fieldId: string): Promise { - const widget = await this.formFields.getWidget(fieldId); - const fileItem = widget.$(this.filesListLocator).$(materialLocators.List.item.root); - await BrowserVisibility.waitUntilElementIsNotVisible(fileItem); - } - - async checkNoFileIsAttachedToWidgets(fieldIds: string[]): Promise { - for (const fieldId of fieldIds) { - await this.checkNoFileIsAttached(fieldId); - } - } - - async checkFileIsAttached(fieldId: string, name: string): Promise { - const fileAttached = await this.getFileAttachedNotAttachedLocator(fieldId, name); - await BrowserVisibility.waitUntilElementIsVisible(fileAttached); - } - - async checkFilesAreAttachedToWidget(fieldId: string, names: string[]): Promise { - for (const fileName of names) { - await this.checkFileIsAttached(fieldId, fileName); - } - } - - async checkFileIsNotAttached(fieldId: string, name: string): Promise { - const fileNotAttached = await this.getFileAttachedNotAttachedLocator(fieldId, name); - await BrowserVisibility.waitUntilElementIsNotVisible(fileNotAttached); - } - - async viewFile(name: string): Promise { - const fileView = $(this.filesListLocator).element(by.cssContainingText(`${materialLocators.List.item.root} span `, name)); - await BrowserActions.click(fileView); - await browser.actions().doubleClick(fileView).perform(); - } - - async attachFileWidgetDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.attachFileWidget); - } - - async toggleAttachedFileMenu(fieldId: string, fileName: string): Promise { - await BrowserActions.closeMenuAndDialogs(); - const widget = await this.formFields.getWidget(fieldId); - const fileAttached = await this.getFileAttachedNotAttachedLocator(fieldId, fileName); - const id = await BrowserActions.getAttribute(fileAttached, 'id'); - const optionMenu = widget.$(`button[id='${id}-option-menu']`); - await BrowserActions.click(optionMenu); - } - - async checkAttachFileOptionsActiveForm(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.attachedFileOptions); - await BrowserVisibility.waitUntilElementIsVisible(this.viewFileOptionButton); - await BrowserVisibility.waitUntilElementIsVisible(this.downloadFileOptionButton); - await this.removeFileOptionButton.waitVisible(); - } - - async checkAttachFileOptionsCompletedForm(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.attachedFileOptions); - await BrowserVisibility.waitUntilElementIsVisible(this.viewFileOptionButton); - await BrowserVisibility.waitUntilElementIsVisible(this.downloadFileOptionButton); - await this.removeFileOptionButton.waitNotVisible(); - } - - async viewAttachedFile(): Promise { - await BrowserActions.click(this.viewFileOptionButton); - } - - async downloadFile(): Promise { - await BrowserActions.click(this.downloadFileOptionButton); - } - - async removeAttachedFile(): Promise { - await this.removeFileOptionButton.click(); - } - - async viewFileEnabled(): Promise { - return this.viewFileOptionButton.isEnabled(); - } - - async downloadFileEnabled(): Promise { - return this.downloadFileOptionButton.isEnabled(); - } - - async removeFileEnabled(): Promise { - return this.removeFileOptionButton.isEnabled(); - } - - async checkUploadIsNotVisible(fieldId: string): Promise { - const alfrescoTypeUploadLocator = `button[id="${fieldId}"]`; - const widget = await this.formFields.getWidget(fieldId); - const uploadButton = await widget.$(alfrescoTypeUploadLocator); - await BrowserVisibility.waitUntilElementIsNotPresent(uploadButton); - } - - async checkUploadIsVisible(fieldId: string): Promise { - const alfrescoTypeUploadLocator = `button[id="${fieldId}"]`; - const widget = await this.formFields.getWidget(fieldId); - const uploadButton = await widget.$(alfrescoTypeUploadLocator); - await BrowserVisibility.waitUntilElementIsPresent(uploadButton); - } - - async checkLocalTypeUploadIsPresent(fieldId: string): Promise { - const localTypeUpload = $(`input[id="${fieldId}"]`); - await BrowserVisibility.waitUntilElementIsPresent(localTypeUpload); - } - - async checkLocalTypeUploadIsNotPresent(fieldId: string): Promise { - const localTypeUpload = $(`input[id="${fieldId}"]`); - await BrowserVisibility.waitUntilElementIsNotPresent(localTypeUpload); - } - - async selectUploadSource(name: string): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.attachedFileOptions); - await BrowserActions.click($(`button[id="attach-${name}"]`)); - } - - async clickUploadButton(fieldId: string): Promise { - await BrowserActions.closeMenuAndDialogs(); - const widget = await this.formFields.getWidget(fieldId); - const uploadButton = await widget.$(this.alfrescoTypeUploadLocator); - await BrowserActions.click(uploadButton); - } - - private async getFileAttachedNotAttachedLocator(fieldId: string, name: string) { - const widget = await this.formFields.getWidget(fieldId); - return widget.$(this.filesListLocator).element(by.cssContainingText(`.adf-attach-widget__label span`, name)); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/attach-folder-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/attach-folder-widget.page.ts deleted file mode 100644 index 052e7622bae..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/attach-folder-widget.page.ts +++ /dev/null @@ -1,59 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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, $ } from 'protractor'; -import { FormFields } from '../form-fields'; -import { BrowserActions, BrowserVisibility } from '../../../utils/public-api'; - -export class AttachFolderWidgetPage { - - formFields: FormFields = new FormFields(); - foldersListLocator = '.adf-attach-folder-result'; - - async clickWidget(fieldId: string): Promise { - const widget = await this.formFields.getWidget(fieldId).$(`button[id="folder-${fieldId}-button"]`); - await BrowserActions.click(widget); - } - - async checkFolderIsAttached(fieldId: string, name: string): Promise { - const folderAttached = await this.getFolderAttachedLocator(fieldId, name); - await BrowserVisibility.waitUntilElementIsVisible(folderAttached); - } - - async checkFolderIsNotAttached(fieldId: string, name: string): Promise { - const folderAttached = await this.getFolderAttachedLocator(fieldId, name); - await BrowserVisibility.waitUntilElementIsNotPresent(folderAttached); - } - - async attachFileWidgetDisplayed(id: string): Promise { - const locator = $(id ? id : '#attachfolder'); - await BrowserVisibility.waitUntilElementIsVisible(locator); - } - - async removeFolder(fieldId: string, name: string): Promise { - await this.checkFolderIsAttached(fieldId, name); - const widget = await this.formFields.getWidget(fieldId); - const folderToBeRemoved = widget.$(this.foldersListLocator).$(`[id="folder-${fieldId}-remove"]`); - await BrowserActions.click(folderToBeRemoved); - } - - private async getFolderAttachedLocator(fieldId: string, name: string) { - const widget = await this.formFields.getWidget(fieldId); - return widget.$(this.foldersListLocator).element(by.cssContainingText('span', name)); - } - -} diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/checkbox-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/checkbox-widget.page.ts deleted file mode 100644 index d636a2d6c63..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/checkbox-widget.page.ts +++ /dev/null @@ -1,51 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { FormFields } from '../form-fields'; -import { BrowserActions } from '../../../utils/public-api'; -import { $ } from 'protractor'; -import { materialLocators } from '../../public-api'; - -export class CheckboxWidgetPage { - - formFields = new FormFields(); - checkboxLabel = $(`${materialLocators.Checkbox.root} label`); - checkboxLocator = materialLocators.Checkbox.root; - - getCheckboxLabel(): Promise { - return BrowserActions.getText(this.checkboxLabel); - } - - async clickCheckboxInput(fieldId: string): Promise { - const checkboxInput = $(`${this.checkboxLocator}[id="${fieldId}"] input`); - await BrowserActions.click(checkboxInput); - } - - async isCheckboxDisplayed(fieldId: string): Promise { - await this.formFields.checkWidgetIsVisible(fieldId); - } - - async isCheckboxHidden(fieldId: string): Promise { - await this.formFields.checkWidgetIsHidden(fieldId); - } - - async isCheckboxChecked(fieldId: string): Promise { - const checkboxWidget = await (await this.formFields.getWidget(fieldId)).$(this.checkboxLocator); - const attributeValue = await BrowserActions.getAttribute(checkboxWidget, 'class'); - return attributeValue.includes(materialLocators.Checkbox.checked.root); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/container-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/container-widget.page.ts deleted file mode 100644 index 77be2f00ffd..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/container-widget.page.ts +++ /dev/null @@ -1,30 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { FormFields } from '../form-fields'; -import { by, Locator } from 'protractor'; - -export class ContainerWidgetPage { - - formFields = new FormFields(); - - fileLocator: Locator = by.css(`div [class*='upload-widget__content-text']`); - - getFieldText(fieldId: string): Promise { - return this.formFields.getFieldText(fieldId, this.fileLocator); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/date-time-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/date-time-widget.page.ts deleted file mode 100644 index 816ad77917f..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/date-time-widget.page.ts +++ /dev/null @@ -1,93 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { FormFields } from '../form-fields'; -import { element, by, $ } from 'protractor'; -import { BrowserVisibility, BrowserActions } from '../../../utils/public-api'; -import { materialLocators } from '../../public-api'; - -export class DateTimeWidgetPage { - - formFields = new FormFields(); - outsideLayer = $('div[class*="cdk-overlay-container"]'); - - async checkWidgetIsVisible(fieldId: string): Promise { - await this.formFields.checkWidgetIsVisible(fieldId); - } - - async getDateTimeLabel(fieldId: string): Promise { - const label = $(`adf-form-field div[id="field-${fieldId}-container"] label`); - return BrowserActions.getText(label); - } - - async setDateTimeInput(fieldId: string, value: string): Promise { - await this.formFields.setValueInInputById(fieldId, value); - } - - async clickOutsideWidget(fieldId: string): Promise { - const form = await this.formFields.getWidget(fieldId); - await BrowserActions.click(form); - } - - async closeDataTimeWidget(): Promise { - await BrowserActions.click(this.outsideLayer); - } - - async getErrorMessage(fieldId: string): Promise { - const errorMessage = $(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`); - return BrowserActions.getText(errorMessage); - } - - async selectDay(day: string): Promise { - const selectedDay = element(by.cssContainingText(`div[class*="${materialLocators.DatetimePicker.calendar.body.cell.root}"]`, day)); - await BrowserActions.click(selectedDay); - } - - async openDatepicker(fieldId: string): Promise { - await BrowserActions.click($(`#${fieldId}`)); - } - - async selectTime(time: string): Promise { - const selectedTime = element.all(by.cssContainingText(`div[class*="${materialLocators.DatetimePicker.clock.cell()}"]`, time)).first(); - await BrowserActions.click(selectedTime); - } - - async selectHour(hour: string): Promise { - return this.selectTime(hour); - } - - async selectMinute(minute: string): Promise { - return this.selectTime(minute); - } - - async getPlaceholder(fieldId: string): Promise { - return this.formFields.getFieldPlaceHolder(fieldId); - } - - async removeFromDatetimeWidget(fieldId: string): Promise { - const amountWidgetInput = $(`#${fieldId}`); - await BrowserVisibility.waitUntilElementIsVisible(await this.formFields.getWidget(fieldId)); - await BrowserActions.clearWithBackSpace(amountWidgetInput); - } - - async clearDateTimeInput(fieldId: string): Promise { - const dateInput = $(`#${fieldId}`); - await BrowserVisibility.waitUntilElementIsVisible(dateInput); - await dateInput.clear(); - } - -} diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/date-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/date-widget.page.ts deleted file mode 100644 index 796b90524e3..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/date-widget.page.ts +++ /dev/null @@ -1,73 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { FormFields } from '../form-fields'; -import { $$, $ } from 'protractor'; -import { BrowserVisibility, BrowserActions } from '../../../utils/public-api'; - -export class DateWidgetPage { - - formFields = new FormFields(); - - async checkWidgetIsVisible(fieldId: string): Promise { - await this.formFields.checkWidgetIsVisible(fieldId); - } - - async checkLabelIsVisible(fieldId: string): Promise { - await this.formFields.checkWidgetIsVisible(fieldId); - } - - async getDateLabel(fieldId: string): Promise { - const label = $$(`adf-form-field div[id="field-${fieldId}-container"] label`).first(); - return BrowserActions.getText(label); - } - - async setDateInput(fieldId: string, value: string): Promise { - await this.removeFromDatetimeWidget(fieldId); - await this.formFields.setValueInInputById(fieldId, value); - } - - async getDateInput(fieldId: string): Promise { - return this.formFields.getFieldValue(fieldId); - } - - async clearDateInput(fieldId: string): Promise { - const dateInput = $(`#${fieldId}`); - await BrowserActions.clearWithBackSpace(dateInput); - } - - async clickOutsideWidget(fieldId: string): Promise { - const form = await this.formFields.getWidget(fieldId); - await BrowserActions.click(form); - } - - async checkErrorMessageIsNotDisplayed(fieldId: string): Promise { - const errorMessage = $(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`); - await BrowserVisibility.waitUntilElementIsNotVisible(errorMessage); - } - - async getErrorMessage(fieldId: string): Promise { - const errorMessage = $(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`); - return BrowserActions.getText(errorMessage); - } - - async removeFromDatetimeWidget(fieldId: string): Promise { - const widget = await this.formFields.getWidget(fieldId); - await BrowserVisibility.waitUntilElementIsVisible(widget); - await BrowserActions.clearSendKeys($(`#${fieldId}`), ''); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/display-text-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/display-text-widget.page.ts deleted file mode 100644 index 01163c6d78d..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/display-text-widget.page.ts +++ /dev/null @@ -1,39 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { FormFields } from '../form-fields'; -import { by, Locator } from 'protractor'; - -export class DisplayTextWidgetPage { - - formFields: FormFields = new FormFields(); - labelLocator: Locator = by.css('div[class*="adf-display-text-widget"]'); - inputLocator: Locator = by.css('input'); - - getFieldLabel(fieldId): Promise { - return this.formFields.getFieldLabel(fieldId, this.labelLocator); - } - - getFieldValue(fieldId): Promise { - return this.formFields.getFieldValue(fieldId, this.inputLocator); - } - - getFieldText(fieldId): Promise { - return this.formFields.getFieldText(fieldId, this.labelLocator); - } - -} diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/display-value-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/display-value-widget.page.ts deleted file mode 100644 index 6d081700c92..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/display-value-widget.page.ts +++ /dev/null @@ -1,71 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { FormFields } from '../form-fields'; -import { by, Locator, $ } from 'protractor'; -import { BrowserVisibility, BrowserActions } from '../../../utils/public-api'; -import { EditJsonDialog } from '../../../dialog/public-api'; - -export class DisplayValueWidgetPage { - - formFields: FormFields = new FormFields(); - labelLocator: Locator = by.css(`label[class*='adf-label']`); - inputLocator: Locator = by.css('input'); - editJsonDialog = new EditJsonDialog(); - - getFieldLabel(fieldId): Promise { - return this.formFields.getFieldLabel(fieldId, this.labelLocator); - } - - getFieldValue(fieldId): Promise { - return this.formFields.getFieldValue(fieldId, this.inputLocator); - } - - async isDisplayValueWidgetVisible(fieldId: string): Promise { - try { - await this.formFields.checkWidgetIsVisible(fieldId); - return true; - } catch { - return false; - } - } - - async checkDisplayValueWidgetIsHidden(fieldId: string): Promise { - const hiddenElement = $(`adf-form-field div[id='field-${fieldId}-container'][hidden]`); - try { - await BrowserVisibility.waitUntilElementIsNotVisible(hiddenElement); - return true; - } catch { - return false; - } - } - - async clickOnDisplayJsonValueWidget(fieldId: string) { - const jsonButton = $(`adf-form-field div[id='field-${fieldId}-container'] button`); - await BrowserActions.click(jsonButton); - await this.editJsonDialog.checkDialogIsDisplayed(); - } - - async getDisplayJsonValueDialogContent(): Promise { - return JSON.parse(await this.editJsonDialog.getDialogContent()); - } - - async closeDisplayJsonValuedDialog() { - await this.editJsonDialog.clickCloseButton(); - await this.editJsonDialog.checkDialogIsNotDisplayed(); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/dropdown-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/dropdown-widget.page.ts deleted file mode 100644 index ea555048949..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/dropdown-widget.page.ts +++ /dev/null @@ -1,86 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { FormFields } from '../form-fields'; -import { $, by, protractor } from 'protractor'; -import { TestElement } from '../../../test-element'; -import { materialLocators } from '../../public-api'; - -export class DropdownWidgetPage { - - formFields: FormFields = new FormFields(); - - readonly searchElementLocator = TestElement.byCss('[aria-label="Search options"]'); - - async getSelectedOptionText(fieldId: string = 'dropdown'): Promise { - return this.formFields.getFieldText(fieldId, by.css(`${materialLocators.Select.root}[id="${fieldId}"] ${materialLocators.Select.value.text} span`)); - } - - async selectOption(option: string, locator: string = '#dropdown'): Promise { - await this.openDropdown(locator); - const row = TestElement.byText(`${materialLocators.Option.root} span`, option); - await row.click(); - } - - async selectMultipleOptions(options: string[]): Promise { - for (const option of options) { - await this.clickOption(option); - } - } - - async closeDropdownFor(dropdownId: string): Promise { - const dropdownElement = TestElement.byCss(`#${dropdownId}-panel`); - await $('body').sendKeys(protractor.Key.ESCAPE); - await dropdownElement.waitNotPresent(); - } - - async openDropdown(locator: string = '#dropdown'): Promise { - await this.checkDropdownIsDisplayed(locator); - const dropdown = TestElement.byCss(`${locator}`); - await dropdown.click(); - } - - async searchAndChooseOptionFromList(name: string): Promise { - await this.searchElementLocator.typeText(name); - await this.clickOption(name); - } - - async searchAndChooseOptionsFromList(...names: string[]): Promise { - for (const name of names) { - await this.searchElementLocator.typeText(name); - await this.clickOption(name); - } - } - - async checkDropdownIsDisplayed(locator: string = '#dropdown'): Promise { - const dropdown = TestElement.byCss(`${locator}`); - await dropdown.waitVisible(); - } - - async isWidgetVisible(fieldId: string): Promise { - await this.formFields.checkWidgetIsVisible(fieldId); - } - - async isWidgetHidden(fieldId: string): Promise { - await this.formFields.checkWidgetIsHidden(fieldId); - } - - private async clickOption(name: string): Promise { - const optionLocator = TestElement.byText(`${materialLocators.Option.root} span`, name); - await optionLocator.click(); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/dynamic-table-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/dynamic-table-widget.page.ts deleted file mode 100644 index 748dd2a5cd4..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/dynamic-table-widget.page.ts +++ /dev/null @@ -1,128 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { FormFields } from '../form-fields'; -import { Locator, by, element, protractor, $, $$ } from 'protractor'; -import { BrowserVisibility, BrowserActions } from '../../../utils/public-api'; -import { materialLocators } from '../../public-api'; - -export class DynamicTableWidgetPage { - formFields = new FormFields(); - - labelLocator: Locator = by.css('dynamic-table-widget div div'); - columnNameLocator: Locator = by.css('table[id*="dynamic-table"] th'); - cancelButton = element(by.cssContainingText('button span', 'Cancel')); - editButton = element(by.css('[data-automation-id="dynamic-table-button-edit"]')); - columnDateTime = $('#columnDateTime'); - columnDate = $('#columnDate'); - calendarHeader = $(materialLocators.DatetimePicker.calendar.header.date.time); - calendarContent = $(materialLocators.DatetimePicker.calendar.content); - saveButton = element(by.cssContainingText('button span', 'Save')); - errorMessage = $('.adf-error-text'); - dateWidget = $$(`${materialLocators.DatetimePicker.toggle.root} button`).first(); - tableRow = $$('tbody tr'); - - getFieldLabel(fieldId: string): Promise { - return this.formFields.getFieldLabel(fieldId, this.labelLocator); - } - - getColumnName(fieldId: string): Promise { - return this.formFields.getFieldText(fieldId, this.columnNameLocator); - } - - async clickAddRow(id?: string): Promise { - const rowButton = $(`#${id ? id : 'label'}-add-row`); - await BrowserActions.click(rowButton); - } - - async clickTableRow(rowNumber): Promise { - const tableRowByIndex = this.getTableRowByIndex(rowNumber); - await BrowserActions.click(tableRowByIndex); - } - - async clickEditButton(): Promise { - await BrowserActions.click(this.editButton); - } - - async clickCancelButton(): Promise { - await BrowserActions.click(this.cancelButton); - } - - async setDatatableInput(text, id = 'id'): Promise { - const dataTableInput = $(`#${id}`); - await BrowserVisibility.waitUntilElementIsVisible(dataTableInput); - await BrowserActions.clearSendKeys(dataTableInput, text); - } - - async getTableRowText(rowNumber): Promise { - const tableRowByIndex = this.getTableRowByIndex(rowNumber); - return BrowserActions.getText(tableRowByIndex); - } - - async checkTableRowIsNotVisible(rowNumber): Promise { - const tableRowByIndex = this.getTableRowByIndex(rowNumber); - await BrowserVisibility.waitUntilElementIsNotVisible(tableRowByIndex); - } - - async clickColumnDateTime(): Promise { - await BrowserActions.click(this.columnDateTime); - await BrowserVisibility.waitUntilElementIsVisible(this.calendarHeader); - await BrowserVisibility.waitUntilElementIsVisible(this.calendarContent); - await BrowserActions.closeMenuAndDialogs(); - } - - async addRandomStringOnDateTime(randomText: string): Promise { - await BrowserActions.click(this.columnDateTime); - await BrowserActions.closeMenuAndDialogs(); - await this.columnDateTime.sendKeys(randomText); - await this.columnDateTime.sendKeys(protractor.Key.ENTER); - return BrowserActions.getInputValue(this.columnDateTime); - } - - async addRandomStringOnDate(randomText: string): Promise { - await BrowserActions.click(this.columnDate); - await this.columnDate.sendKeys(randomText); - } - - async clickSaveButton(): Promise { - await BrowserActions.click(this.saveButton); - } - - async checkErrorMessage(): Promise { - return BrowserActions.getText(this.errorMessage); - } - - async clickDateWidget(): Promise { - await BrowserActions.click(this.dateWidget); - } - - async getTableRow(rowNumber): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.tableRow.get(rowNumber)); - } - - async getTableCellText(rowNumber: number, columnNumber: number): Promise { - return BrowserActions.getText(this.tableRow.get(rowNumber).element(by.xpath(`td[${columnNumber}]`))); - } - - async checkItemIsPresent(item): Promise { - const row = element(by.cssContainingText('table tbody tr td span', item)); - const present = await BrowserVisibility.waitUntilElementIsVisible(row); - expect(present).toBe(true); - } - - private getTableRowByIndex = (idx: string) => $(`#dynamictable-row-${idx}`); -} diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/group-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/group-widget.page.ts deleted file mode 100644 index 718c68c6c50..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/group-widget.page.ts +++ /dev/null @@ -1,78 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { FormFields } from '../form-fields'; -import { Locator, by, element, $ } from 'protractor'; -import { BrowserVisibility, BrowserActions } from '../../../utils/public-api'; -import { materialLocators } from '../../public-api'; - -export class GroupWidgetPage { - groupField = $('input[data-automation-id="adf-group-search-input"]'); - firstResult = $('#adf-group-widget-user-0'); - formFields = new FormFields(); - groupDropDownList: Locator = by.css(materialLocators.Autocomplete.panel.class); - - getFieldLabel(fieldId: string): Promise { - return this.formFields.getFieldLabel(fieldId); - } - - getFieldValue(fieldId: string): Promise { - return this.formFields.getFieldValue(fieldId); - } - - getFieldText(fieldId: string): Promise { - return this.formFields.getFieldText(fieldId); - } - - insertGroup(fieldId: string, value: string): Promise { - return this.formFields.setValueInInputById(fieldId, value); - } - - async checkDropDownListIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(element(this.groupDropDownList)); - } - - async checkGroupIsListed(group): Promise { - const groupElement = element(by.cssContainingText('[id="adf-group-label-name"]', group)); - await BrowserVisibility.waitUntilElementIsVisible(groupElement); - } - - async getDropDownList(): Promise { - const user: Locator = by.css('[id="adf-group-label-name"]'); - await BrowserVisibility.waitUntilElementIsVisible(element(user)); - return element.all(user).map((elementFinder) => elementFinder.getText()); - } - - async selectGroupFromDropDown(groupName: string): Promise { - const group = element(by.cssContainingText('[id="adf-group-label-name"]', groupName)); - await BrowserActions.click(group); - } - - async checkGroupFieldIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.groupField); - } - - async fillGroupField(value): Promise { - await BrowserVisibility.waitUntilElementIsClickable(this.groupField); - await this.groupField.sendKeys(value); - } - - async selectGroupFromDropdown(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.firstResult); - await BrowserActions.click(this.firstResult); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/header-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/header-widget.page.ts deleted file mode 100644 index 7f98c70b1e0..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/header-widget.page.ts +++ /dev/null @@ -1,30 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { FormFields } from '../form-fields'; -import { TestElement } from '../../../test-element'; - -export class HeaderWidgetPage { - - formFields: FormFields = new FormFields(); - - getFieldLabel(fieldId): Promise { - const labelLocator = TestElement.byCss(`span[id="container-header-label-${fieldId}"]`); - return labelLocator.getText(); - } - -} diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/hyperlink-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/hyperlink-widget.page.ts deleted file mode 100644 index 2b4c84f2be8..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/hyperlink-widget.page.ts +++ /dev/null @@ -1,39 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { FormFields } from '../form-fields'; -import { Locator, by, $$ } from 'protractor'; -import { BrowserActions } from '../../../utils/public-api'; - -export class HyperlinkWidgetPage { - - formFields = new FormFields(); - fieldLocator: Locator = by.css('.adf-hyperlink-widget a'); - - async getFieldText(fieldId: string): Promise { - return this.formFields.getFieldText(fieldId, this.fieldLocator); - } - - async getFieldHref(fieldId: string): Promise { - return BrowserActions.getAttribute(this.formFields.getWidget(fieldId).element(this.fieldLocator), 'href'); - } - - async getFieldLabel(fieldId: string): Promise { - const label = $$(`adf-form-field div[id="field-${fieldId}-container"] label`).first(); - return BrowserActions.getText(label); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/json-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/json-widget.page.ts deleted file mode 100644 index d5d082ab255..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/json-widget.page.ts +++ /dev/null @@ -1,34 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { FormFields } from '../form-fields'; -import { BrowserActions } from '../../../utils/public-api'; - -export class JsonWidgetPage { - formFields = new FormFields(); - jsonButtonLocator = 'button'; - - async clickJsonButton(fieldId: string): Promise { - const widget = await this.formFields.getWidget(fieldId); - const uploadButton = await widget.$(this.jsonButtonLocator); - await BrowserActions.click(uploadButton); - } - - async checkWidgetIsVisible(fieldId: string): Promise { - await this.formFields.checkWidgetIsVisible(fieldId); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/multiline-text-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/multiline-text-widget.page.ts deleted file mode 100644 index 78db740b933..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/multiline-text-widget.page.ts +++ /dev/null @@ -1,48 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { FormFields } from '../form-fields'; -import { Locator, by } from 'protractor'; - -export class MultilineTextWidgetPage { - - formFields: FormFields = new FormFields(); - - valueLocator: Locator = by.css('textarea'); - labelLocator: Locator = by.css(`label[class*='adf-label']`); - - getFieldValue(fieldId): Promise { - return this.formFields.getFieldValue(fieldId, this.valueLocator); - } - - getFieldLabel(fieldId): Promise { - return this.formFields.getFieldLabel(fieldId, this.labelLocator); - } - - getFieldPlaceHolder(fieldId): Promise { - return this.formFields.getFieldPlaceHolder(fieldId, 'textarea'); - } - - setValue(fieldId, value): Promise { - return this.formFields.setFieldValue(fieldId, value); - } - - getErrorMessage(fieldId): Promise { - return this.formFields.getFieldErrorMessage(fieldId); - } - -} diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/number-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/number-widget.page.ts deleted file mode 100644 index 8fc763f0ab0..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/number-widget.page.ts +++ /dev/null @@ -1,57 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { $$, $ } from 'protractor'; -import { FormFields } from '../form-fields'; -import { BrowserVisibility, BrowserActions } from '../../../utils/public-api'; - -export class NumberWidgetPage { - - formFields = new FormFields(); - - async getNumberFieldLabel(fieldId: string): Promise { - const label = $$(`adf-form-field div[id="field-${fieldId}-container"] label`).first(); - return BrowserActions.getText(label); - } - - getFieldValue(fieldId: string): Promise { - return this.formFields.getFieldValue(fieldId); - } - - setFieldValue(fieldId: string, value: any): Promise { - return this.formFields.setValueInInputById(fieldId, value); - } - - async clearFieldValue(fieldId: string): Promise { - const numberField = $(`#${fieldId}`); - await BrowserVisibility.waitUntilElementIsVisible(numberField); - await numberField.clear(); - } - - checkWidgetIsVisible(fieldId: string): Promise { - return this.formFields.checkWidgetIsVisible(fieldId); - } - - async getErrorMessage(fieldId: string): Promise { - const errorMessage = $(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`); - return BrowserActions.getText(errorMessage); - } - - getPlaceholder(fieldId: string): Promise { - return this.formFields.getFieldPlaceHolder(fieldId); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/people-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/people-widget.page.ts deleted file mode 100644 index d48d056148a..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/people-widget.page.ts +++ /dev/null @@ -1,81 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { FormFields } from '../form-fields'; -import { by, element, Locator, $ } from 'protractor'; -import { BrowserVisibility, BrowserActions } from '../../../utils/public-api'; - -export class PeopleWidgetPage { - - peopleField = $('input[data-automation-id="adf-people-search-input"]'); - firstResult = $('#adf-people-widget-user-0'); - formFields = new FormFields(); - labelLocator: Locator = by.css('div[class*="display-text-widget"]'); - inputLocator: Locator = by.id('involvepeople'); - peopleDropDownList = $('div[class*="adf-people-widget-list"]'); - - getFieldLabel(fieldId: string): Promise { - return this.formFields.getFieldLabel(fieldId, this.labelLocator); - } - - getFieldValue(fieldId: string): Promise { - return this.formFields.getFieldValue(fieldId, this.inputLocator); - } - - getFieldText(fieldId: string): Promise { - return this.formFields.getFieldText(fieldId, this.labelLocator); - } - - insertUser(fieldId: string, value: string): Promise { - return this.formFields.setValueInInputById(fieldId, value); - } - - async checkDropDownListIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.peopleDropDownList); - } - - async checkUserIsListed(userName: string): Promise { - const user = element(by.cssContainingText('.adf-people-label-name', userName)); - await BrowserVisibility.waitUntilElementIsVisible(user); - } - - async selectUserFromDropDown(userName: string): Promise { - const user = element(by.cssContainingText('.adf-people-label-name', userName)); - await BrowserActions.click(user); - } - - async getDropDownList(): Promise { - await this.checkDropDownListIsDisplayed(); - const users = by.css('.adf-people-label-name'); - await BrowserVisibility.waitUntilElementIsVisible(element(users)); - return element.all(users).map((elementFinder) => elementFinder.getText()); - } - - async checkPeopleFieldIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.peopleField); - } - - async fillPeopleField(value): Promise { - await BrowserVisibility.waitUntilElementIsClickable(this.peopleField); - await this.peopleField.sendKeys(value); - } - - async selectUserFromDropdown(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.firstResult); - await BrowserActions.click(this.firstResult); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/public-api.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/public-api.ts deleted file mode 100644 index 424362d205c..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/public-api.ts +++ /dev/null @@ -1,18 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './widget'; diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/radio-buttons-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/radio-buttons-widget.page.ts deleted file mode 100644 index 4793be1deac..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/radio-buttons-widget.page.ts +++ /dev/null @@ -1,54 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { FormFields } from '../form-fields'; -import { $$, by, Locator } from 'protractor'; -import { BrowserVisibility, BrowserActions } from '../../../utils/public-api'; -import { materialLocators } from '../../public-api'; - -export class RadioButtonsWidgetPage { - - selectedOption: Locator = by.css(`${materialLocators.Radio.button.root}[ng-pristine]`); - - formFields: FormFields = new FormFields(); - - async getSpecificOptionLabel(fieldId, optionNumber): Promise { - const optionLocator: Locator = by.css('label[for*="radiobuttons-option_' + optionNumber + '"]'); - const widget = await this.formFields.getWidget(fieldId); - const option = widget.element(optionLocator); - return BrowserActions.getText(option); - } - - async selectOption(fieldId, optionNumber): Promise { - const optionLocator: Locator = by.css(`label[for*="${fieldId}-option_${optionNumber}"]`); - const widget = await this.formFields.getWidget(fieldId); - const option = widget.element(optionLocator); - await BrowserActions.click(option); - } - - async isSelectionClean(fieldId): Promise { - const widget = await this.formFields.getWidget(fieldId); - const option = widget.element(this.selectedOption); - await BrowserVisibility.waitUntilElementIsNotVisible(option); - } - - async getRadioWidgetLabel(fieldId): Promise { - const label = $$(`adf-form-field div[id="field-${fieldId}-container"] label`).first(); - return BrowserActions.getText(label); - } - -} diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/tab.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/tab.page.ts deleted file mode 100644 index 17001b2359b..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/tab.page.ts +++ /dev/null @@ -1,42 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { TestElement } from '../../../test-element'; -import { BrowserActions, BrowserVisibility } from '../../../utils/public-api'; -import { materialLocators } from '../../public-api'; - -export class TabPage { - - changeTabAnimation = $(`${materialLocators.Tab.labels.class} div[class="${materialLocators.Ripple.element.root}"]`); - - public disabledContentNodeSelectorTabInfoIcon = TestElement.byCss('[data-automation-id="adf-content-node-selector-disabled-tab-info-icon"]'); - - async clickTabByLabel(tabLabel): Promise { - const user = element(by.cssContainingText(materialLocators.Tab.label.content.class, tabLabel)); - await BrowserActions.click(user); - await BrowserVisibility.waitUntilElementIsNotVisible(this.changeTabAnimation); - } - - async checkTabIsDisplayedByLabel(tabLabel): Promise { - await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText(materialLocators.Tab.label.content.class, tabLabel))); - } - - async checkTabIsNotDisplayedByLabel(tabLabel): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText(materialLocators.Tab.label.content.class, tabLabel))); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/text-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/text-widget.page.ts deleted file mode 100644 index 8520ff8c336..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/text-widget.page.ts +++ /dev/null @@ -1,58 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { FormFields } from '../form-fields'; -import { by, Locator } from 'protractor'; - -export class TextWidgetPage { - - formFields: FormFields = new FormFields(); - - labelLocator: Locator = by.css(`label[class*='adf-label']`); - - getFieldLabel(fieldId): Promise { - return this.formFields.getFieldLabel(fieldId, this.labelLocator); - } - - getFieldPlaceHolder(fieldId): Promise { - return this.formFields.getFieldPlaceHolder(fieldId); - } - - async setValue(fieldId, value): Promise { - await this.formFields.setFieldValue(fieldId, value); - } - - getFieldValue(fieldId): Promise { - return this.formFields.getFieldValue(fieldId); - } - - getErrorMessage(fieldId): Promise { - return this.formFields.getFieldErrorMessage(fieldId); - } - - async isWidgetVisible(fieldId): Promise { - await this.formFields.checkWidgetIsVisible(fieldId); - } - - async isWidgetClickable(fieldId): Promise { - await this.formFields.checkWidgetIsClickable(fieldId); - } - - async isWidgetNotVisible(fieldId): Promise { - await this.formFields.checkWidgetIsHidden(fieldId); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/widget.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/widget.ts deleted file mode 100644 index d3413c37278..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/widget.ts +++ /dev/null @@ -1,124 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { MultilineTextWidgetPage } from './multiline-text-widget.page'; -import { HeaderWidgetPage } from './header-widget.page'; -import { DisplayTextWidgetPage } from './display-text-widget.page'; -import { DisplayValueWidgetPage } from './display-value-widget.page'; -import { AttachFileWidgetPage } from './attach-file-widget.page'; -import { RadioButtonsWidgetPage } from './radio-buttons-widget.page'; -import { HyperlinkWidgetPage } from './hyperlink-widget.page'; -import { DropdownWidgetPage } from './dropdown-widget.page'; -import { DynamicTableWidgetPage } from './dynamic-table-widget.page'; -import { TextWidgetPage } from './text-widget.page'; -import { CheckboxWidgetPage } from './checkbox-widget.page'; -import { DateWidgetPage } from './date-widget.page'; -import { DateTimeWidgetPage } from './date-time-widget.page'; -import { NumberWidgetPage } from './number-widget.page'; -import { AmountWidgetPage } from './amount-widget.page'; -import { ContainerWidgetPage } from './container-widget.page'; -import { PeopleWidgetPage } from './people-widget.page'; -import { TabPage } from './tab.page'; -import { GroupWidgetPage } from './group-widget.page'; -import { AttachFolderWidgetPage } from './attach-folder-widget.page'; -import { JsonWidgetPage } from './json-widget.page'; - -export class Widget { - multilineTextWidget(): MultilineTextWidgetPage { - return new MultilineTextWidgetPage(); - } - - headerWidget(): HeaderWidgetPage { - return new HeaderWidgetPage(); - } - - displayTextWidget(): DisplayTextWidgetPage { - return new DisplayTextWidgetPage(); - } - - attachFileWidget(): AttachFileWidgetPage { - return new AttachFileWidgetPage(); - } - - attachFolderWidget(): AttachFolderWidgetPage { - return new AttachFolderWidgetPage(); - } - - displayValueWidget(): DisplayValueWidgetPage { - return new DisplayValueWidgetPage(); - } - - radioWidget(): RadioButtonsWidgetPage { - return new RadioButtonsWidgetPage(); - } - - hyperlink(): HyperlinkWidgetPage { - return new HyperlinkWidgetPage(); - } - - dropdown(): DropdownWidgetPage { - return new DropdownWidgetPage(); - } - - dynamicTable(): DynamicTableWidgetPage { - return new DynamicTableWidgetPage(); - } - - textWidget(): TextWidgetPage { - return new TextWidgetPage(); - } - - checkboxWidget(): CheckboxWidgetPage { - return new CheckboxWidgetPage(); - } - - dateWidget(): DateWidgetPage { - return new DateWidgetPage(); - } - - dateTimeWidget(): DateTimeWidgetPage { - return new DateTimeWidgetPage(); - } - - numberWidget(): NumberWidgetPage { - return new NumberWidgetPage(); - } - - amountWidget(): AmountWidgetPage { - return new AmountWidgetPage(); - } - - containerWidget(): ContainerWidgetPage { - return new ContainerWidgetPage(); - } - - peopleWidget(): PeopleWidgetPage { - return new PeopleWidgetPage(); - } - - groupWidget(): GroupWidgetPage { - return new GroupWidgetPage(); - } - - tab(): TabPage { - return new TabPage(); - } - - json(): JsonWidgetPage { - return new JsonWidgetPage(); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/header.page.ts b/lib/testing/src/lib/protractor/core/pages/header.page.ts deleted file mode 100644 index 0cb907bcbf1..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/header.page.ts +++ /dev/null @@ -1,132 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { element, by, protractor, browser, $, $$ } from 'protractor'; -import { BrowserVisibility } from '../utils/browser-visibility'; -import { BrowserActions } from '../utils/browser-actions'; -import { materialLocators } from './public-api'; - -export class HeaderPage { - - checkBox = element(by.cssContainingText(materialLocators.Checkbox.label.class, 'Show menu button')); - headerColor = $('option[value="primary"]'); - titleInput = $('input[name="title"]'); - iconInput = $('input[placeholder="URL path"]'); - hexColorInput = $('input[placeholder="hex color code"]'); - logoHyperlinkInput = $('input[placeholder="Redirect URL"]'); - logoTooltipInput = $('input[placeholder="Tooltip text"]'); - positionStart = $$(`${materialLocators.Radio.button.root}[value="start"]`).first(); - positionEnd = $$(`${materialLocators.Radio.button.root}[value="end"]`).first(); - sideBarPositionRight = $(`${materialLocators.Sidenav.root}${materialLocators.Drawer.class}${materialLocators.Sidenav.root}${materialLocators.Drawer.end}`); - sideBarPositionLeft = $(`${materialLocators.Sidenav.root}${materialLocators.Drawer.class}${materialLocators.Sidenav.root}`); - - async checkShowMenuCheckBoxIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.checkBox); - } - - async checkChooseHeaderColourIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.headerColor); - } - - async checkChangeTitleIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.titleInput); - } - - async checkChangeUrlPathIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.iconInput); - } - - async clickShowMenuButton(): Promise { - const checkBox = $$(materialLocators.Checkbox.root).first(); - await BrowserActions.click(checkBox); - } - - async changeHeaderColor(color: string): Promise { - const headerColor = $('option[value="' + color + '"]'); - await BrowserActions.click(headerColor); - } - - async checkAppTitle(name: string): Promise { - const title = element(by.cssContainingText('.adf-app-title', name)); - await BrowserVisibility.waitUntilElementIsVisible(title); - } - - async addTitle(title: string): Promise { - await BrowserActions.click(this.titleInput); - await BrowserActions.clearSendKeys(this.titleInput, title); - await this.titleInput.sendKeys(protractor.Key.ENTER); - } - - async checkIconIsDisplayed(url: string): Promise { - const icon = $('img[src="' + url + '"]'); - await BrowserVisibility.waitUntilElementIsVisible(icon); - } - - async addIcon(url: string): Promise { - await BrowserActions.click(this.iconInput); - await BrowserActions.clearSendKeys(this.iconInput, url); - await this.iconInput.sendKeys(protractor.Key.ENTER); - } - - async checkHexColorInputIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.hexColorInput); - } - - async checkLogoHyperlinkInputIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.logoHyperlinkInput); - } - - async checkLogoTooltipInputIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.logoTooltipInput); - } - - async addHexCodeColor(hexCode: string): Promise { - await BrowserActions.click(this.hexColorInput); - await BrowserActions.clearSendKeys(this.hexColorInput, hexCode); - await this.hexColorInput.sendKeys(protractor.Key.ENTER); - } - - async addLogoHyperlink(hyperlink: string): Promise { - await BrowserActions.click(this.logoHyperlinkInput); - await BrowserActions.clearSendKeys(this.logoHyperlinkInput, hyperlink); - await this.logoHyperlinkInput.sendKeys(protractor.Key.ENTER); - } - - async addLogoTooltip(tooltip: string): Promise { - await BrowserActions.click(this.logoTooltipInput); - await BrowserActions.clearSendKeys(this.logoTooltipInput, tooltip); - await this.logoTooltipInput.sendKeys(protractor.Key.ENTER); - } - - async sideBarPositionStart(): Promise { - await BrowserActions.click(this.positionStart); - } - - async sideBarPositionEnd(): Promise { - await browser.executeScript('arguments[0].scrollIntoView()', this.positionEnd); - await BrowserActions.click(this.positionEnd); - } - - async checkSidebarPositionStart(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.sideBarPositionLeft); - } - - async checkSidebarPositionEnd(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.sideBarPositionRight); - } - -} diff --git a/lib/testing/src/lib/protractor/core/pages/login.page.ts b/lib/testing/src/lib/protractor/core/pages/login.page.ts deleted file mode 100644 index 3c556de137f..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/login.page.ts +++ /dev/null @@ -1,152 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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, protractor, $ } from 'protractor'; -import { BrowserVisibility } from '../utils/browser-visibility'; -import { BrowserActions } from '../utils/browser-actions'; -import { LocalStorageUtil } from '../utils/local-storage.util'; -import { Logger } from '../utils/logger'; - -export interface LoginOptions { - waitForUserIcon: boolean; -} -export class LoginPage { - loginUrl = `${browser.baseUrl}/login`; - ssoButton = $(`[data-automation-id="login-button-sso"]`); - usernameField = $('#username'); - passwordField = $('#password'); - loginButton = $('input[type="submit"]'); - userIcon = $(`[data-automation-id='user-initials-image']`); - visibilityLabel = $('#v'); - - txtUsernameBasicAuth = $('input[id="username"]'); - txtPasswordBasicAuth = $('input[id="password"]'); - signInButtonBasicAuth = $('#login-button'); - - async goToLoginPage(): Promise { - let currentUrl; - - try { - currentUrl = await browser.getCurrentUrl(); - } catch (e) { - /* do nothing */ - } - - if (!currentUrl || currentUrl.indexOf(this.loginUrl) === -1) { - await BrowserActions.getUrl(this.loginUrl); - } - - await BrowserVisibility.waitUntilElementIsVisible(this.txtUsernameBasicAuth); - await BrowserVisibility.waitUntilElementIsVisible(this.txtPasswordBasicAuth); - } - - async loginWithProfile(profileName: string): Promise { - const profile = browser.params.testConfig.users[profileName]; - if (profile) { - await this.login(profile.username, profile.password); - } else { - throw new Error(`Login profile "${profileName}" not found on "browser.params.testConfig".`); - } - } - - async login(username: string, password: string, options: LoginOptions = { waitForUserIcon: true }) { - Logger.log('Login With ' + username); - const authType = await LocalStorageUtil.getConfigField('authType'); - - Logger.log(`AuthType ${authType}`); - - if (!authType || authType === 'OAUTH') { - await this.loginSSOIdentityService(username, password, options); - } else { - await this.loginBasicAuth(username, password, options); - } - - await browser.waitForAngular(); - } - - async loginSSOIdentityService(username: string, password: string, options: LoginOptions = { waitForUserIcon: true }) { - browser.ignoreSynchronization = true; - const loginURL: string = browser.baseUrl + (browser.params.loginRoute ? browser.params.loginRoute : ''); - - const oauth2 = await LocalStorageUtil.getConfigField('oauth2'); - await BrowserActions.getUrl(loginURL); - - if (oauth2 && oauth2.silentLogin === false) { - Logger.log(`Login SSO`); - await this.clickOnSSOButton(); - } else { - Logger.log(`Login SSO silent login`); - } - - await BrowserVisibility.waitUntilElementIsVisible(this.usernameField); - await this.displayPassword(); - await this.enterUsername(username); - await this.enterPassword(password); - await this.clickLoginButton(); - await browser.actions().sendKeys(protractor.Key.ENTER).perform(); - if (options.waitForUserIcon) { - await BrowserVisibility.waitUntilElementIsVisible(this.userIcon, BrowserVisibility.DEFAULT_TIMEOUT * 2); - } - } - - async loginBasicAuth(username: string, password: string, options: LoginOptions = { waitForUserIcon: true }): Promise { - Logger.log(`Login Basic`); - - await this.goToLoginPage(); - - await this.enterUsernameBasicAuth(username); - await this.enterPasswordBasicAuth(password); - await this.clickSignInBasicAuthButton(); - if (options.waitForUserIcon) { - await BrowserVisibility.waitUntilElementIsVisible(this.userIcon); - } - } - - async clickSignInBasicAuthButton(): Promise { - await BrowserActions.click(this.signInButtonBasicAuth); - } - - async enterUsernameBasicAuth(username: string): Promise { - await BrowserActions.clearSendKeys(this.txtUsernameBasicAuth, username); - } - - async enterPasswordBasicAuth(password: string): Promise { - await BrowserActions.clearSendKeys(this.txtPasswordBasicAuth, password); - } - - async clickOnSSOButton() { - await BrowserActions.click(this.ssoButton); - } - - async enterUsername(username: string) { - await BrowserActions.clearSendKeys(this.usernameField, username); - } - - async enterPassword(password: string) { - await BrowserActions.clearSendKeys(this.passwordField, password); - } - - async clickLoginButton() { - await BrowserActions.click(this.loginButton); - } - - async displayPassword(): Promise { - await BrowserActions.click(this.visibilityLabel); - const passwordInputTypeText = $(`input[name="password"][type="text"]`); - await BrowserVisibility.waitUntilElementIsVisible(passwordInputTypeText); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/material/checkbox.page.ts b/lib/testing/src/lib/protractor/core/pages/material/checkbox.page.ts deleted file mode 100644 index 1017f25d0ba..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/material/checkbox.page.ts +++ /dev/null @@ -1,37 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { BrowserActions } from '../../utils/browser-actions'; -import { materialLocators } from './material-locators'; - -export class CheckboxPage { - - static async uncheck(el: ElementFinder) { - const classList = await BrowserActions.getAttribute(el, 'class'); - if (classList && classList.indexOf(materialLocators.Checked.root) > -1) { - await BrowserActions.click(el); - } - } - - static async check(el: ElementFinder) { - const classList = await BrowserActions.getAttribute(el, 'class'); - if (classList && classList.indexOf(materialLocators.Checked.root) === -1) { - await BrowserActions.click(el); - } - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/material/date-picker-calendar.page.ts b/lib/testing/src/lib/protractor/core/pages/material/date-picker-calendar.page.ts deleted file mode 100644 index 9b241c24d0b..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/material/date-picker-calendar.page.ts +++ /dev/null @@ -1,115 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { element, by, $ } from 'protractor'; -import { BrowserVisibility } from '../../utils/browser-visibility'; -import { BrowserActions } from '../../utils/browser-actions'; -import { TestElement } from '../../test-element'; -import { addDays, format, subDays } from 'date-fns'; -import { materialLocators } from './material-locators'; - -export class DatePickerCalendarPage { - datePicker = $(`${materialLocators.Calendar.root}[id*="${materialLocators.Datepicker.root}"]`); - nextMonthButton = $(`button[class*="${materialLocators.Calendar.button('next')}"]`); - previousMonthButton = $(`button[class*="${materialLocators.Calendar.button('previous')}"]`); - todayDate = TestElement.byCss(`${materialLocators.Calendar.body.today.class}`); - periodButton = $(`button[class*=${materialLocators.Calendar.button('period')}]`); - - focusedElement = `span${materialLocators.Calendar.body.cell.content.class}${materialLocators.Calendar.focus}`; - - async getSelectedDate(): Promise { - return BrowserActions.getAttribute($(`button[class*="${materialLocators.Calendar.body.active.root}"]`), 'aria-label'); - } - - async checkDatesAfterDateAreDisabled(date: Date): Promise { - const afterDate = format(addDays(date, 1), 'dd-MM-yy'); - const afterCalendar = $(`td[class*="${materialLocators.Calendar.body.cell.root}"][aria-label="${afterDate}"]`); - if (await afterCalendar.isPresent()) { - const aria = await BrowserActions.getAttribute(afterCalendar, 'aria-disabled'); - expect(aria).toBe('true'); - } - const isEnabled = await this.nextMonthButton.isEnabled(); - expect(isEnabled).toBe(false); - } - - async checkDatesBeforeDateAreDisabled(date: Date): Promise { - const beforeDate = format(subDays(date, 1), 'dd-MM-yy'); - const beforeCalendar = $(`td[class*="${materialLocators.Calendar.body.cell.root}"][aria-label="${beforeDate}"]`); - if (await beforeCalendar.isPresent()) { - const aria = await BrowserActions.getAttribute(beforeCalendar, 'aria-disabled'); - expect(aria).toBe('true'); - } - const isEnabled = await this.previousMonthButton.isEnabled(); - expect(isEnabled).toBe(false); - } - - async selectTodayDate(): Promise { - await this.todayDate.waitPresent(); - await this.todayDate.click(); - await this.checkDatePickerIsNotDisplayed(); - } - - async closeDatePicker(): Promise { - await BrowserActions.closeMenuAndDialogs(); - await this.checkDatePickerIsNotDisplayed(); - } - - async checkDatePickerIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.datePicker); - } - - async checkDatePickerIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.datePicker); - } - - async selectDateRange(startDay: number, endDay: number): Promise { - const startDayElement = element(by.cssContainingText(this.focusedElement, `${startDay}`)); - const endDayElement = element(by.cssContainingText(this.focusedElement, `${endDay}`)); - await this.checkDatePickerIsDisplayed(); - await BrowserActions.click(startDayElement); - await BrowserActions.click(endDayElement); - await this.checkDatePickerIsNotDisplayed(); - } - - async selectExactDate(date: Date): Promise { - await this.checkDatePickerIsDisplayed(); - await this.setDateUsingPeriodButton(date); - await this.checkDatePickerIsNotDisplayed(); - } - - async selectExactDateRange(start: Date, end: Date): Promise { - await this.checkDatePickerIsDisplayed(); - await this.setDateUsingPeriodButton(start); - await this.setDateUsingPeriodButton(end); - await this.checkDatePickerIsNotDisplayed(); - } - - private async setDateUsingPeriodButton(date: Date) { - const months = ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC']; - const year = date.getFullYear(); - const month = months[date.getMonth()]; - const day = date.getDate(); - const yearElement = element(by.cssContainingText(this.focusedElement, `${year}`)); - const monthElement = element(by.cssContainingText(this.focusedElement, `${month}`)); - const dayElement = element(by.cssContainingText(this.focusedElement, `${day}`)); - - await BrowserActions.click(this.periodButton); - await BrowserActions.click(yearElement); - await BrowserActions.click(monthElement); - await BrowserActions.click(dayElement); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/material/date-picker.page.ts b/lib/testing/src/lib/protractor/core/pages/material/date-picker.page.ts deleted file mode 100644 index d5d74ce1f48..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/material/date-picker.page.ts +++ /dev/null @@ -1,45 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { BrowserActions } from '../../utils/browser-actions'; -import { DatePickerCalendarPage } from './date-picker-calendar.page'; -import { materialLocators } from './material-locators'; - -export class DatePickerPage { - - datePicker: ElementFinder; - dateTime = new DatePickerCalendarPage(); - - constructor(datePickerElement?: ElementFinder) { - const locator = $(materialLocators.Datepicker.toggle.class); - this.datePicker = datePickerElement ? datePickerElement : locator; - } - - async clickDatePicker() { - await BrowserActions.click(this.datePicker); - } - - async setTodayDateValue(): Promise { - await this.dateTime.selectTodayDate(); - } - - async setDateRange(start: Date, end: Date): Promise { - await this.clickDatePicker(); - await this.dateTime.selectExactDateRange(start, end); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/material/date-time-picker-calendar.page.ts b/lib/testing/src/lib/protractor/core/pages/material/date-time-picker-calendar.page.ts deleted file mode 100644 index 437d447fcf2..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/material/date-time-picker-calendar.page.ts +++ /dev/null @@ -1,73 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { element, by, $, $$ } from 'protractor'; -import { BrowserVisibility } from '../../utils/browser-visibility'; -import { BrowserActions } from '../../utils/browser-actions'; -import { materialLocators } from './material-locators'; - -export class DateTimePickerCalendarPage { - - datePicker = $(`[class*='picker-content']`); - today = $(`[class*='calendar-body-today']`); - timePicker = $(materialLocators.DatetimePicker.clock.class); - hourTime = $$(`${materialLocators.DatetimePicker.clock.hours.class} .${materialLocators.DatetimePicker.clock.cell()}`).first(); - minutesTime = $$(`${materialLocators.DatetimePicker.clock.minutes.class} .${materialLocators.DatetimePicker.clock.cell()}`).first(); - firstEnabledSelector = `.${materialLocators.DatetimePicker.clock.cell()}:not(.${materialLocators.DatetimePicker.clock.cell('disabled')}`; - hoursPicker = $(materialLocators.DatetimePicker.clock.hours.class); - minutePicker = $(materialLocators.DatetimePicker.clock.minutes.class); - - async waitTillDateDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.datePicker); - } - - async setToday(): Promise { - await BrowserActions.click(this.today); - } - - async setTime(): Promise { - await BrowserActions.clickScript(this.hourTime); - await BrowserActions.clickScript(this.minutesTime); - } - - async setDate(date?: string): Promise { - try { - if (date) { - await BrowserActions.clickScript(element.all(by.cssContainingText(materialLocators.Datepicker.calendar.body.cell.content.class, date)).first()); - } else { - await this.setToday(); - } - await this.setTime(); - return true; - } catch { - return false; - } - } - - async checkCalendarTodayDayIsDisabled(): Promise { - const locatorString = materialLocators.Calendar.body.cell.content.class; - await BrowserVisibility.waitUntilElementIsPresent(element(by.cssContainingText(locatorString, await BrowserActions.getText(this.today)))); - } - - async setDefaultEnabledHour(): Promise { - await BrowserActions.click(this.hoursPicker.$$(this.firstEnabledSelector).first()); - } - - async setDefaultEnabledMinutes() { - await BrowserActions.click(this.minutePicker.$$(this.firstEnabledSelector).first()); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/material/date-time-picker.page.ts b/lib/testing/src/lib/protractor/core/pages/material/date-time-picker.page.ts deleted file mode 100644 index c72356b7c1c..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/material/date-time-picker.page.ts +++ /dev/null @@ -1,63 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { BrowserActions } from '../../utils/browser-actions'; -import { DateTimePickerCalendarPage } from './date-time-picker-calendar.page'; -import { materialLocators } from './material-locators'; - -export class DateTimePickerPage { - - rootElement: ElementFinder; - dateTimePicker = $(materialLocators.DatetimePicker.toggle.class); - datePicker = $(materialLocators.Datepicker.toggle.class); - dateTime = new DateTimePickerCalendarPage(); - - constructor(rootElement?: ElementFinder) { - if (rootElement) { - this.rootElement = rootElement; - this.dateTimePicker = this.rootElement.$(materialLocators.DatetimePicker.toggle.class); - this.datePicker = this.rootElement.$(materialLocators.Datepicker.toggle.class); - } - } - - async setTodayDateTimeValue(): Promise { - await BrowserActions.click(this.dateTimePicker); - await this.dateTime.waitTillDateDisplayed(); - await this.dateTime.setToday(); - await this.dateTime.setTime(); - } - - async setTodayDateValue(): Promise { - await BrowserActions.click(this.dateTimePicker); - await this.dateTime.waitTillDateDisplayed(); - await this.dateTime.setToday(); - } - - async setDate(date?: string): Promise { - await BrowserActions.click(this.datePicker); - return this.dateTime.setDate(date); - } - - async clickDateTimePicker(): Promise { - await BrowserActions.click(this.datePicker); - } - - async checkCalendarTodayDayIsDisabled(): Promise { - await this.dateTime.checkCalendarTodayDayIsDisabled(); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/material/dropdown.page.ts b/lib/testing/src/lib/protractor/core/pages/material/dropdown.page.ts deleted file mode 100644 index a218bac20d6..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/material/dropdown.page.ts +++ /dev/null @@ -1,106 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { element, by, ElementFinder, browser, $$, $ } from 'protractor'; -import { BrowserVisibility } from '../../utils/browser-visibility'; -import { BrowserActions } from '../../utils/browser-actions'; -import { Logger } from '../../utils/logger'; -import { materialLocators } from './material-locators'; - -export class DropdownPage { - dropDownElement: ElementFinder; - - constructor(dropDownElement = $$(`div[class="${materialLocators.Select.arrow.wrapper.root}"]`).first()) { - this.dropDownElement = dropDownElement; - } - - async clickDropdown(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.dropDownElement); - await BrowserActions.click(this.dropDownElement); - } - - async selectOption(option: string): Promise { - Logger.log(`Select dropdown option ${option}`); - const optionElement = element - .all(by.cssContainingText(`${materialLocators.Option.root.trim()} span${materialLocators.Option.text.class}`, option)) - .first(); - await BrowserActions.click(optionElement); - await browser.waitForAngular(); - } - - async getValue(): Promise { - return BrowserActions.getText($(`${materialLocators.Form.field.root} span`)); - } - - async getDropdownOptionList(): Promise { - return BrowserActions.getArrayText(this.dropDownElement.$$(`[role*='option']`)); - } - - async getNumberOfOptions(): Promise { - const dropdownOptions = $$(`${materialLocators.Select.panel.class} ${materialLocators.Option.root}`); - return dropdownOptions.count(); - } - - async checkDropdownIsVisible(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.dropDownElement); - } - - async checkDropdownIsNotVisible(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.dropDownElement); - } - - async checkDropdownIsClickable(): Promise { - await BrowserVisibility.waitUntilElementIsClickable(this.dropDownElement); - } - - async checkOptionIsSelected(option: string): Promise { - const selectedOption = this.dropDownElement.element(by.cssContainingText(`${materialLocators.Select.value.text} span`, option)); - await BrowserVisibility.waitUntilElementIsVisible(selectedOption); - } - - async selectOptionFromIndex(index: number): Promise { - const value = element.all(by.className(materialLocators.Option.root)).get(index); - await BrowserActions.click(value); - } - - async checkOptionsPanelIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible($$(materialLocators.Select.panel.class).first()); - } - - async getSelectedOptionText(): Promise { - const selectedOption = this.dropDownElement.$(`${materialLocators.Select.value.text} span`); - return BrowserActions.getText(selectedOption); - } - - async checkOptionIsDisplayed(option: string): Promise { - await BrowserVisibility.waitUntilElementIsVisible( - element.all(by.cssContainingText(`${materialLocators.Option.root} span${materialLocators.Option.text.class}`, option)).first() - ); - } - - async checkOptionIsNotDisplayed(option: string): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible( - element.all(by.cssContainingText(`${materialLocators.Option.root} span${materialLocators.Option.text.class}`, option)).first() - ); - } - - async selectDropdownOption(option: string): Promise { - await this.clickDropdown(); - await this.checkOptionsPanelIsDisplayed(); - await this.selectOption(option); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/material/material-locators.ts b/lib/testing/src/lib/protractor/core/pages/material/material-locators.ts deleted file mode 100644 index 4c823962453..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/material/material-locators.ts +++ /dev/null @@ -1,453 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export const materialLocators = { - Accent: { - class: '.mat-mdc-accent' - }, - Accordion: { - root: 'mat-accordion' - }, - Autocomplete: { - panel: { - class: '.mat-mdc-autocomplete-panel', - root: 'mat-autocomplete-panel' - } - }, - Button: { - class: '.mat-mdc-button', - disabled: 'mat-button-disabled', - label: '.mdc-button__label' - }, - Calendar: { - root: 'mat-calendar', - focus: '.mat-focus-indicator', - body: { - cell: { - root: 'mat-calendar-body-cell', - content: { - class: '.mat-calendar-body-cell-content' - } - }, - today: { - class: '.mat-calendar-body-today' - }, - active: { - root: 'mat-calendar-body-active' - } - }, - button: (navigation: 'next' | 'previous' | 'period') => `mat-calendar-${navigation}-button` - }, - Card: { - root: 'mat-card', - class: '.mat-mdc-card', - content: { - class: '.mat-mdc-card-content', - root: 'mat-card-content' - }, - title: { - class: '.mat-mdc-card-title', - root: 'mat-card-title' - }, - actions: 'mat-card-actions', - subtitle: { - root: 'mat-card-subtitle' - } - }, - Checkbox: { - root: 'mat-checkbox', - class: '.mat-mdc-checkbox', - layout: '.mat-mdc-checkbox-layout', - label: { - class: '.mat-mdc-checkbox-label', - root: 'mat-checkbox-label' - }, - checked: { - class: '.mat-mdc-checkbox-checked', - root: 'mat-checkbox-checked' - }, - disabled: { - root: 'mat-checkbox-disabled' - }, - inner: { - container: { - class: '.mat-mdc-checkbox-inner-container' - } - } - }, - Checked: { - root: 'mdc-switch--checked' - }, - Chip: { - root: 'mat-chip', - class: '.mat-mdc-chip', - list: { - root: 'mat-chip-listbox', - class: '.mat-mdc-chip-list', - option: { - class: 'mat-chip-option', - value: '.mat-mdc-chip-action-label' - } - }, - grid: { - root: 'mat-chip-grid', - class: '.mat-mdc-chip-grid', - row: { - root: 'mat-chip-row', - class: '.mat-mdc-chip-row' - } - } - }, - Datepicker: { - root: 'mat-datepicker', - calendar: { - body: { - cell: { - content: { - class: '.mat-mdc-datepicker-calendar-body-cell-content' - } - } - } - }, - toggle: { - root: 'mat-datepicker-toggle', - class: '.mat-datepicker-toggle' - } - }, - DatetimePicker: { - root: 'mat-datetimepicker-content', - popup: '.mat-datetimepicker-popup', - calendar: { - header: { - date: { - class: '.mat-datetimepicker-calendar-header-date', - time: '.mat-datetimepicker-calendar-header-date-time' - }, - year: '.mat-datetimepicker-calendar-header-year' - }, - body: { - active: '.mat-datetimepicker-calendar-body-active', - cell: { - class: '.mat-datetimepicker-calendar-body-cell-content', - root: 'mat-datetimepicker-calendar-body-cell-content' - } - }, - content: '.mat-datetimepicker-calendar-content', - nextButton: '.mat-datetimepicker-calendar-next-button' - }, - clock: { - class: '.mat-datetimepicker-clock', - hours: { - class: '.mat-datetimepicker-clock-hours' - }, - minutes: { - class: '.mat-datetimepicker-clock-minutes' - }, - cell: (attribute?: 'selected' | 'disabled') => - attribute ? `mat-datetimepicker-clock-cell-${attribute}` : 'mat-datetimepicker-clock-cell' - }, - month: { - view: 'mat-datetimepicker-month-view' - }, - toggle: { - root: 'mat-datetimepicker-toggle', - class: '.mat-datetimepicker-toggle' - } - }, - Dialog: { - container: { - root: 'mat-dialog-container', - class: '.mat-mdc-dialog-container' - }, - content: { - root: 'mat-dialog-content', - class: '.mat-mdc-dialog-content' - }, - actions: { - class: `.mat-mdc-dialog-actions`, - root: `mat-dialog-actions` - }, - title: '.mat-mdc-dialog-title' - }, - Disabled: { - root: 'mat-disabled' - }, - Drawer: { - class: '.mat-mdc-drawer', - end: '.mat-mdc-drawer-end' - }, - Error: { - class: '.mat-mdc-error', - root: 'mat-error' - }, - Expanded: { - class: '.mat-expanded', - root: 'mat-expanded' - }, - Expansion: { - panel: { - root: 'mat-expansion-panel', - class: '.mat-expansion-panel', - body: { - class: '.mat-mdc-expansion-panel-body' - }, - content: { - class: '.mat-expansion-panel-content' - }, - header: { - class: '.mat-expansion-panel-header', - root: 'mat-expansion-panel-header' - }, - title: '.mat-expansion-panel-header-title', - expanded: '.mat-expanded' - }, - indicator: '.mat-expansion-indicator' - }, - Focus: { - indicator: '.mat-mdc-focus-indicator' - }, - Focused: { - root: 'mat-focused' - }, - Form: { - field: { - class: '.mat-mdc-form-field', - root: 'mat-form-field', - label: { - wrapper: '.mat-mdc-form-field-label-wrapper' - } - }, - fieldInfix: '.mat-mdc-form-field-infix' - }, - Header: { - cell: '.mat-mdc-header-cell' - }, - Hint: { - class: 'mat-hint' - }, - Icon: { - root: 'mat-icon', - class: '.mat-mdc-icon', - button: { - class: '.mat-mdc-icon-button', - root: 'mat-icon-button' - } - }, - Input: { - class: '.mat-mdc-input-element' - }, - Label: { - root: 'mat-label' - }, - List: { - class: '.mat-mdc-list', - root: 'mat-list', - item: { - root: 'mat-list-item', - class: '.mat-mdc-list-item' - }, - option: 'mat-list-option', - text: { - class: '.mat-mdc-list-text' - }, - content: { - class: '.mdc-list-item__content' - }, - selectionList: 'mat-selection-list' - }, - Menu: { - content: { - class: '.mat-mdc-menu-content', - root: 'mat-mdc-menu-content' - }, - panel: '.mat-mdc-menu-panel', - item: { - class: '.mat-mdc-menu-item', - submenu: { - trigger: { - root: `mat-menu-item-submenu-trigger` - } - } - } - }, - Month: { - content: '.mat-mdc-month-content' - }, - Option: { - root: 'mat-option', - class: '.mat-mdc-option', - group: 'mat-optgroup', - text: { - class: '.mdc-list-item__primary-text', - root: 'span' - } - }, - Paginator: { - class: '.mat-mdc-paginator', - range: { - label: '.mat-mdc-paginator-range-label' - }, - navigation: (rangeAction: string) => `.mat-mdc-paginator-navigation-${rangeAction}` - }, - Panel: { - title: 'mat-panel-title' - }, - Primary: { - class: '.mat-mdc-primary' - }, - Progress: { - bar: { - root: 'mat-progress-bar', - class: '.mat-mdc-progress-bar' - }, - spinner: { - root: 'mat-progress-spinner', - class: '.mat-mdc-progress-spinner' - } - }, - Radio: { - root: 'mat-radio', - button: { - class: '.mat-mdc-radio-button', - root: 'mat-radio-button' - }, - group: 'mat-radio-group', - checked: 'mat-radio-checked', - label: '.mat-mdc-radio-label' - }, - Ripple: { - class: '.mat-mdc-ripple', - element: { - class: '.mat-mdc-ripple-element', - root: 'mat-ripple-element' - } - }, - Select: { - root: 'mat-select', - class: '.mat-mdc-select', - arrow: { - class: '.mat-mdc-select-arrow', - wrapper: { - root: '.mat-mdc-select-arrow-wrapper' - } - }, - placeholder: { - class: '.mat-mdc-select-placeholder' - }, - panel: { - class: '.mat-mdc-select-panel', - wrap: '.mat-mdc-select-panel-wrap' - }, - value: { - class: '.mat-mdc-select-value', - text: '.mat-mdc-select-value-text' - }, - minLine: '.mat-mdc-select-min-line', - trigger: '.mat-mdc-select-trigger' - }, - Slide: { - toggle: { - class: '.mat-mdc-slide-toggle', - root: 'mat-slide-toggle', - input: '.mat-mdc-slide-toggle-input', - checked: 'mat-mdc-slide-toggle-checked' - } - }, - Selection: { - list: { - root: 'mat-selection-list' - } - }, - Sidenav: { - root: 'mat-sidenav' - }, - Snackbar: { - container: { - class: '.mat-mdc-snack-bar-container' - } - }, - Sort: { - header: { - container: '.mat-mdc-sort-header-container' - } - }, - Spinner: { - root: 'mat-spinner' - }, - Tab: { - disabled: '.mat-mdc-tab-disabled', - header: { - class: '.mat-mdc-tab-header', - pagination: { - after: '.mat-mdc-tab-header-pagination-after', - before: '.mat-mdc-tab-header-pagination-before', - chevron: '.mat-mdc-tab-header-pagination-chevron' - } - }, - body: { - active: '.mat-mdc-tab-body-active', - content: '.mat-mdc-tab-body-content' - }, - label: { - class: '.mdc-tab', - root: 'mat-tab-label', - active: { - class: '.mdc-tab--active', - root: 'mat-tab-label-active' - }, - content: { - class: '.mdc-tab__content', - root: 'mat-tab-label-content' - } - }, - labels: { - class: '.mdc-tab__text-label', - container: { - class: '.mat-mdc-tab-labels' - } - }, - list: '.mat-mdc-tab-list' - }, - Table: { - class: '.mat-mdc-table', - root: 'mat-table', - row: { - root: 'mat-row', - class: '.mat-mdc-row' - }, - cell: { - class: '.mat-mdc-cell', - root: 'mat-cell' - }, - column: (matColumn: string) => `.mat-mdc-column-${matColumn}` - }, - Toolbar: { - root: 'mat-toolbar', - class: '.mat-mdc-toolbar' - }, - Tooltip: { - root: 'mat-tooltip-component', - class: '.mat-mdc-tooltip', - trigger: '.mat-mdc-tooltip-trigger' - }, - Tree: { - root: 'mat-tree', - node: { - root: 'mat-tree-node' - } - } -}; diff --git a/lib/testing/src/lib/protractor/core/pages/material/public-api.ts b/lib/testing/src/lib/protractor/core/pages/material/public-api.ts deleted file mode 100644 index f2e16fc6e1b..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/material/public-api.ts +++ /dev/null @@ -1,26 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './material-locators'; -export * from './tabs.page'; -export * from './date-picker-calendar.page'; -export * from './date-time-picker.page'; -export * from './date-picker.page'; -export * from './date-time-picker-calendar.page'; -export * from './dropdown.page'; -export * from './toggle.page'; -export * from './checkbox.page'; diff --git a/lib/testing/src/lib/protractor/core/pages/material/tabs.page.ts b/lib/testing/src/lib/protractor/core/pages/material/tabs.page.ts deleted file mode 100644 index 5520c27f5cf..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/material/tabs.page.ts +++ /dev/null @@ -1,46 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { element, by, $$ } from 'protractor'; -import { BrowserActions } from '../../utils/browser-actions'; -import { BrowserVisibility } from '../../utils/browser-visibility'; -import { materialLocators } from './material-locators'; - -export class TabsPage { - tabs = $$(`div[id*='${materialLocators.Tab.label.root}']`); - - async clickTabByTitle(tabTitle): Promise { - const tab = element(by.cssContainingText(`div[id*='${materialLocators.Tab.label.root}']`, tabTitle)); - await BrowserActions.click(tab); - } - - async checkTabIsSelectedByTitle(tabTitle): Promise { - const tab = element(by.cssContainingText(`div[id*='${materialLocators.Tab.label.root}']`, tabTitle)); - const result: string = await BrowserActions.getAttribute(tab, 'aria-selected'); - expect(result).toBe('true'); - } - - async getNoOfTabs(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.tabs.first()); - return this.tabs.count(); - } - - async getTabsLabels(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.tabs.first()); - return this.tabs.getText(); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/material/toggle.page.ts b/lib/testing/src/lib/protractor/core/pages/material/toggle.page.ts deleted file mode 100644 index 722ca8a45b8..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/material/toggle.page.ts +++ /dev/null @@ -1,39 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { BrowserActions } from '../../utils/browser-actions'; -import { materialLocators } from './material-locators'; - -export class TogglePage { - - async enableToggle(toggle: ElementFinder): Promise { - const slideToggle = await BrowserActions.getAttribute(toggle, 'class'); - if (slideToggle.indexOf(materialLocators.Slide.toggle.checked) < 0) { - const elem = toggle.$$('button').first(); - await BrowserActions.clickScript(elem); - } - } - - async disableToggle(toggle: ElementFinder): Promise { - const slideToggle = await BrowserActions.getAttribute(toggle, 'class'); - if (slideToggle.indexOf(materialLocators.Slide.toggle.checked) >= 0) { - const elem = toggle.$$('button').first(); - await BrowserActions.clickScript(elem); - } - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/pagination.page.ts b/lib/testing/src/lib/protractor/core/pages/pagination.page.ts deleted file mode 100644 index 4cc8790a554..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/pagination.page.ts +++ /dev/null @@ -1,147 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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, browser, $, $$ } from 'protractor'; -import { BrowserVisibility } from '../utils/browser-visibility'; -import { BrowserActions } from '../utils/browser-actions'; -import { Logger } from '../utils/logger'; -import { materialLocators } from './public-api'; - -export class PaginationPage { - - pageSelectorDropDown = $('div[class*="adf-pagination__page-selector"]'); - pageSelectorArrow = $('button[data-automation-id="page-selector"]'); - itemsPerPage = $('.adf-pagination__max-items'); - itemsPerPageOpenDropdown = $('.adf-pagination__perpage-block button'); - itemsPerPageOptions = $$(`.adf-pagination__page-selector ${materialLocators.Menu.item.class}`); - currentPage = $('.adf-pagination__current-page'); - totalPages = $('.adf-pagination__total-pages'); - paginationRange = $('.adf-pagination__range'); - nextPageButton = $('button[class*="adf-pagination__next-button"]'); - nextButtonDisabled = $('button[class*="adf-pagination__next-button"][disabled]'); - previousButtonDisabled = $('button[class*="adf-pagination__previous-button"][disabled]'); - pageDropDown = $('div[class*="adf-pagination__actualinfo-block"] button'); - pageDropDownOptions = $$(`div[class*="${materialLocators.Menu.content.root}"] button`); - paginationSection = $('adf-pagination'); - paginationSectionEmpty = $('adf-pagination[class*="adf-pagination__empty"]'); - totalFiles = $('.adf-pagination__range'); - - async selectItemsPerPage(numberOfItem: string): Promise { - await BrowserActions.clickExecuteScript(`div[class*="adf-pagination__perpage-block"] button`); - await BrowserVisibility.waitUntilElementIsVisible(this.pageSelectorDropDown); - const itemsPerPage = element.all(by.cssContainingText(materialLocators.Menu.item.class, numberOfItem)).first(); - await BrowserVisibility.waitUntilElementIsPresent(itemsPerPage); - await BrowserActions.click(itemsPerPage); - await BrowserVisibility.waitUntilElementIsNotVisible(this.pageSelectorDropDown); - Logger.log('Select page size ', numberOfItem); - await browser.sleep(500); - } - - async checkPageSelectorIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.pageSelectorArrow); - } - - async checkPageSelectorIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.pageSelectorArrow); - } - - async clickItemsPerPageDropdown(): Promise { - await BrowserActions.clickScript(this.itemsPerPageOpenDropdown); - } - - async checkPaginationIsNotDisplayed() { - await BrowserVisibility.waitUntilElementIsVisible(this.paginationSectionEmpty); - } - - async getCurrentItemsPerPage(): Promise { - return BrowserActions.getText(this.itemsPerPage); - } - - async getCurrentPage(): Promise { - return BrowserActions.getText(this.currentPage); - } - - async getTotalPages(): Promise { - return BrowserActions.getText(this.totalPages); - } - - async getPaginationRange(): Promise { - return BrowserActions.getText(this.paginationRange); - } - - async clickOnNextPage(): Promise { - Logger.log('Next page'); - return BrowserActions.click(this.nextPageButton); - } - - async clickOnPageDropdown(): Promise { - await BrowserActions.click(this.pageDropDown); - Logger.log('Click page dropdown'); - } - - async clickOnPageDropdownOption(numberOfItemPerPage: string): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.pageDropDownOptions.first()); - const option = element(by.cssContainingText(`div[class*="${materialLocators.Menu.content.root}"] button`, numberOfItemPerPage)); - await BrowserActions.click(option); - } - - async getPageDropdownOptions() { - await BrowserVisibility.waitUntilElementIsVisible(this.pageDropDownOptions.first()); - const initialList = []; - await this.pageDropDownOptions.each(async (currentOption) => { - const text = await BrowserActions.getText(currentOption); - if (text !== '') { - initialList.push(text); - } - }); - return initialList; - } - - async getItemsPerPageDropdownOptions() { - await BrowserVisibility.waitUntilElementIsVisible(this.itemsPerPageOptions.first()); - const initialList = []; - await this.itemsPerPageOptions.each(async (currentOption) => { - const text = await BrowserActions.getText(currentOption); - if (text !== '') { - initialList.push(text); - } - }); - return initialList; - } - - async checkNextPageButtonIsDisabled(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.nextButtonDisabled); - } - - async checkPreviousPageButtonIsDisabled(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.previousButtonDisabled); - } - - async checkNextPageButtonIsEnabled(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.nextButtonDisabled); - } - - async checkPreviousPageButtonIsEnabled(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.previousButtonDisabled); - } - - async getTotalNumberOfFiles() { - await BrowserVisibility.waitUntilElementIsVisible(this.totalFiles); - const totalNumberOfFiles = await BrowserActions.getText(this.totalFiles); - return totalNumberOfFiles.split('of ')[1]; - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/public-api.ts b/lib/testing/src/lib/protractor/core/pages/public-api.ts deleted file mode 100644 index 7a68c36144d..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/public-api.ts +++ /dev/null @@ -1,33 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './bread-crumb.page'; -export * from './header.page'; -export * from './user-info.page'; -export * from './login.page'; - -export { LoginPage as LoginSSOPage } from './login.page'; - -export * from './data-table-component.page'; -export * from './pagination.page'; -export * from './form/public-api'; -export * from './material/public-api'; -export * from './card-view/public-api'; -export * from './viewer.page'; -export * from './snackbar.page'; -export * from './data-table/public-api'; -export * from './context-menu.page'; diff --git a/lib/testing/src/lib/protractor/core/pages/snackbar.page.ts b/lib/testing/src/lib/protractor/core/pages/snackbar.page.ts deleted file mode 100644 index 3cc2cff5011..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/snackbar.page.ts +++ /dev/null @@ -1,70 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { $, $$ } from 'protractor'; -import { BrowserVisibility } from '../utils/browser-visibility'; -import { BrowserActions } from '../utils/browser-actions'; - -/** @deprecated Use Playwright API instead */ -export class SnackbarPage { - - notificationSnackBar = $$(`[data-automation-id='adf-snackbar-message-content']`).first(); - snackBarAction = $(`[data-automation-id='adf-snackbar-message-content-action-button']`); - snackBarContainerCss = $$('adf-snackbar-content'); - decorativeIconSnackBar = $(`[data-automation-id='adf-snackbar-decorative-icon']`); - - async waitForSnackBarToAppear(timeout = 5000) { - return BrowserVisibility.waitUntilElementIsVisible(this.snackBarContainerCss.first(), timeout, - 'snackbar did not appear' - ); - } - - async waitForSnackBarToClose(timeout = 15000) { - return BrowserVisibility.waitUntilElementIsNotVisible(this.snackBarContainerCss.first(), timeout); - } - - async getSnackBarMessage(): Promise { - await this.waitForSnackBarToAppear(); - return this.notificationSnackBar.getText(); - } - - /** @deprecated Use Playwright API instead */ - async getSnackBarActionMessage(): Promise { - await this.waitForSnackBarToAppear(); - return this.snackBarAction.getText(); - } - - async getSnackBarDecorativeIcon(): Promise { - await this.waitForSnackBarToAppear(); - return this.decorativeIconSnackBar.getText(); - } - - /** @deprecated Use Playwright API instead */ - async clickSnackBarAction(): Promise { - await this.waitForSnackBarToAppear(); - await BrowserActions.click(this.snackBarAction); - } - - async isNotificationSnackBarDisplayed(): Promise { - try { - await BrowserVisibility.waitUntilElementIsVisible(this.notificationSnackBar, 2000); - return true; - } catch { - return false; - } - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/user-info.page.ts b/lib/testing/src/lib/protractor/core/pages/user-info.page.ts deleted file mode 100644 index e7af4a7edbe..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/user-info.page.ts +++ /dev/null @@ -1,54 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { $, $$ } from 'protractor'; -import { BrowserVisibility } from '../utils/browser-visibility'; -import { BrowserActions } from '../utils/browser-actions'; -import { materialLocators } from './public-api'; - -export class UserInfoPage { - dialog = $$(`${materialLocators.Card.root}[class*="adf-userinfo-card"]`).first(); - userInfoSsoHeaderTitle = this.dialog.$('div[id="identity-username"]'); - userInfoSsoTitle = $('.adf-userinfo__detail-title'); - ssoEmail = $('#identity-email'); - userProfileButton = $('button[data-automation-id="adf-user-profile"]'); - - async dialogIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.dialog); - } - - async clickUserProfile(): Promise { - await BrowserActions.click(this.userProfileButton); - } - - async getSsoHeaderTitle(): Promise { - return BrowserActions.getText(this.userInfoSsoHeaderTitle); - } - - async getSsoTitle(): Promise { - return BrowserActions.getText(this.userInfoSsoTitle); - } - - async getSsoEmail(): Promise { - return BrowserActions.getText(this.ssoEmail); - } - - async closeUserProfile(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.dialog); - await BrowserActions.closeMenuAndDialogs(); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/viewer.page.ts b/lib/testing/src/lib/protractor/core/pages/viewer.page.ts deleted file mode 100644 index 2efd2c10edd..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/viewer.page.ts +++ /dev/null @@ -1,347 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { BrowserActions } from '../utils/browser-actions'; -import { TabsPage } from './material/tabs.page'; -import { BrowserVisibility } from '../utils/browser-visibility'; -import { element, by, browser, protractor, $, $$ } from 'protractor'; -import { Logger } from '../utils/logger'; -import { materialLocators } from './public-api'; - -const MAX_LOADING_TIME = 120000; - -export class ViewerPage { - tabsPage = new TabsPage(); - closeButton = $('button.adf-viewer-close-button'); - fileName = $('#adf-viewer-display-name'); - infoButton = $('button[data-automation-id="adf-toolbar-sidebar"]'); - previousPageButton = $('#viewer-previous-page-button'); - nextPageButton = $('#viewer-next-page-button'); - zoomInButton = $('#viewer-zoom-in-button'); - zoomOutButton = $('#viewer-zoom-out-button'); - scalePageButton = $('#viewer-scale-page-button'); - fullScreenButton = $('button[data-automation-id="adf-toolbar-fullscreen"]'); - scaleImg = $('button[id="viewer-reset-button"]'); - fileThumbnail = $('img[data-automation-id="adf-file-thumbnail"]'); - pageSelectorInput = $('input[data-automation-id="adf-page-selector"]'); - imgContainer = $('div[data-automation-id="adf-image-container"]'); - mediaContainer = $('.adf-media-player'); - percentage = $('div[data-automation-id="adf-page-scale"]'); - thumbnailsBtn = $('button[data-automation-id="adf-thumbnails-button"]'); - thumbnailsContent = $('div[data-automation-id="adf-thumbnails-content"]'); - thumbnailsClose = $('button[data-automation-id="adf-thumbnails-close"]'); - secondThumbnail = $('adf-pdf-thumb > img[title="Page 2"]'); - lastThumbnailDisplayed = $$('adf-pdf-thumb').last(); - infoSideBar = $('#adf-right-sidebar'); - viewer = $('adf-viewer'); - imgViewer = $('adf-img-viewer'); - activeTab = $(`div${materialLocators.Tab.label.active.class}`); - toolbar = $('#adf-viewer-toolbar'); - canvasLayer = $$('.canvasWrapper > canvas').first(); - - pdfPageLoaded = $('[data-page-number="1"][data-loaded="true"], adf-img-viewer, adf-txt-viewer'); - downloadButton = $('#adf-alfresco-viewer-download'); - unknownFormat = $(`adf-viewer-unknown-format .adf-viewer__unknown-format-view`); - - async viewFile(fileName: string): Promise { - const fileView = $$(`#document-list-container div[data-automation-id="${fileName}"]`).first(); - await BrowserActions.click(fileView); - await browser.actions().sendKeys(protractor.Key.ENTER).perform(); - await this.waitTillContentLoaded(); - } - - async waitTillContentLoaded(): Promise { - await browser.sleep(500); - - if (await this.isSpinnerPresent()) { - Logger.log('wait spinner disappear'); - await BrowserVisibility.waitUntilElementIsNotVisible(element(by.tagName(materialLocators.Progress.spinner.root)), MAX_LOADING_TIME); - } else { - try { - Logger.log('wait spinner is present'); - await BrowserVisibility.waitUntilElementIsVisible(element(by.tagName(materialLocators.Progress.spinner.root))); - await BrowserVisibility.waitUntilElementIsNotVisible(element(by.tagName(materialLocators.Progress.spinner.root)), MAX_LOADING_TIME); - } catch (error) { - Logger.error('Spinner is not present'); - } - } - } - - async clearPageNumber(): Promise { - await BrowserActions.clearSendKeys(this.pageSelectorInput); - } - - async getZoom(): Promise { - return BrowserActions.getText(this.percentage); - } - - async getCanvasWidth(): Promise { - return BrowserActions.getAttribute(this.canvasLayer, `width`); - } - - async getCanvasHeight(): Promise { - return BrowserActions.getAttribute(this.canvasLayer, `height`); - } - - async getDisplayedFileName(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.fileName); - return BrowserActions.getText(this.fileName); - } - - async exitFullScreen(): Promise { - const jsCode = 'document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen&&document.webkitExitFullscreen();'; - await browser.executeScript(jsCode); - } - - async checkFileIsLoaded(fileName?: string): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.pdfPageLoaded, 60000, `${fileName} not loaded`); - } - - async checkImgViewerIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.imgViewer); - } - - async checkAllThumbnailsDisplayed(nbPages): Promise { - const defaultThumbnailHeight = 143; - expect(await BrowserActions.getAttribute(this.thumbnailsContent, 'style')).toEqual( - 'height: ' + nbPages * defaultThumbnailHeight + 'px; transform: translate(-50%, 0px);' - ); - } - - async checkCurrentThumbnailIsSelected(): Promise { - const selectedThumbnail = $('adf-pdf-thumb.adf-pdf-thumbnails__thumb.adf-pdf-thumbnails__thumb--selected > img'); - const pageNumber = await BrowserActions.getInputValue(this.pageSelectorInput); - - expect('Page ' + pageNumber).toEqual(await BrowserActions.getAttribute(selectedThumbnail, 'title')); - } - - async checkThumbnailsCloseIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.thumbnailsClose); - } - - async checkThumbnailsBtnIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.thumbnailsBtn); - } - - async checkThumbnailsBtnIsDisabled(): Promise { - await BrowserVisibility.waitUntilElementIsVisible($('button[data-automation-id="adf-thumbnails-button"]:disabled')); - } - - async checkThumbnailsContentIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.thumbnailsContent); - } - - async checkThumbnailsContentIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.thumbnailsContent); - } - - async checkCloseButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.closeButton); - } - - async checkDownloadButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.downloadButton); - } - - async checkInfoButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.infoButton); - } - - async checkFileThumbnailIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.fileThumbnail); - } - - async checkFileNameIsDisplayed(filename: string): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.fileName); - await BrowserVisibility.waitUntilElementHasText(this.fileName, filename); - } - - async checkPreviousPageButtonIsDisplayed() { - await BrowserVisibility.waitUntilElementIsVisible(this.previousPageButton); - } - - async checkNextPageButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.nextPageButton); - } - - async checkZoomInButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.zoomInButton); - } - - async checkZoomInButtonIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.zoomInButton); - } - - async checkZoomOutButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.zoomOutButton); - } - - async checkScalePageButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.scalePageButton); - } - - async checkPageSelectorInputIsDisplayed(checkNumber: string): Promise { - expect(await BrowserActions.getInputValue(this.pageSelectorInput)).toEqual(checkNumber); - } - - async checkImgContainerIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.imgContainer); - } - - async checkMediaPlayerContainerIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.mediaContainer); - } - - async checkFileContent(pageNumber: string, text: string): Promise { - const allPages = this.canvasLayer; - const pageLoaded = $$('div[data-page-number="' + pageNumber + '"][data-loaded="true"]').first(); - const textLayerLoaded = $$('div[data-page-number="' + pageNumber + '"] .textLayer').first(); - const specificText = element.all(by.cssContainingText('div[data-page-number="' + pageNumber + '"] .textLayer', text)).first(); - - await BrowserVisibility.waitUntilElementIsVisible(allPages); - await BrowserVisibility.waitUntilElementIsVisible(pageLoaded); - await BrowserVisibility.waitUntilElementIsVisible(textLayerLoaded); - await BrowserVisibility.waitUntilElementIsVisible(specificText); - } - - async checkFullScreenButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.fullScreenButton); - } - - async checkPercentageIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.percentage); - } - - async checkZoomedIn(zoom): Promise { - expect(await BrowserActions.getText(this.percentage)).toBeGreaterThan(zoom); - } - - async checkZoomedOut(zoom): Promise { - expect(await BrowserActions.getText(this.percentage)).toBeLessThan(zoom); - } - - async checkScaleImgButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.scaleImg); - } - - async checkInfoSideBarIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.infoSideBar); - } - - async checkInfoSideBarIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.infoSideBar); - } - - async clickInfoButton(): Promise { - await BrowserActions.click($('button[data-automation-id="adf-toolbar-sidebar"]')); - } - - async clickOnTab(tabName: string): Promise { - await this.tabsPage.clickTabByTitle(tabName); - } - - async checkTabIsActive(tabName: string): Promise { - const materialLocatorPart = `div${materialLocators.Tab.label.active.class} ${materialLocators.Tab.label.content.class}`; - const tab = element(by.cssContainingText(`.adf-info-drawer-layout-content ${materialLocatorPart}`, tabName)); - await BrowserVisibility.waitUntilElementIsVisible(tab); - } - - async clickSecondThumbnail(): Promise { - await BrowserActions.click(this.secondThumbnail); - } - - async clickLastThumbnailDisplayed(): Promise { - await BrowserActions.click(this.lastThumbnailDisplayed); - } - - async clickThumbnailsClose(): Promise { - await BrowserActions.click(this.thumbnailsClose); - } - - async clickThumbnailsBtn(): Promise { - await BrowserActions.click(this.thumbnailsBtn); - } - - async clickDownloadButton(): Promise { - await BrowserActions.click(this.downloadButton); - } - - async clickCloseButton(): Promise { - await BrowserActions.click(this.closeButton); - } - - async clickPreviousPageButton(): Promise { - await BrowserActions.click(this.previousPageButton); - } - - async clickNextPageButton(): Promise { - await BrowserActions.click(this.nextPageButton); - } - - async clickZoomInButton(): Promise { - await BrowserActions.click(this.zoomInButton); - } - - async clickZoomOutButton(): Promise { - await BrowserActions.click(this.zoomOutButton); - } - - async clickActualSize(): Promise { - await BrowserActions.click(this.scalePageButton); - } - - async clickFullScreenButton(): Promise { - await BrowserActions.click(this.fullScreenButton); - } - - async getActiveTab(): Promise { - return BrowserActions.getText(this.activeTab); - } - - async clickOnCommentsTab(): Promise { - await this.tabsPage.clickTabByTitle('Comments'); - } - - async checkToolbarIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.toolbar); - } - - async checkUnknownFormatIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.unknownFormat); - } - - async getUnknownFormatMessage(): Promise { - const unknownFormatLabel = this.unknownFormat.$(`.adf-viewer__unknown-label`); - return BrowserActions.getText(unknownFormatLabel); - } - - async expectUrlToContain(text: string): Promise { - expect(browser.getCurrentUrl()).toContain(text); - } - - private async isSpinnerPresent(): Promise { - let isSpinnerPresent; - - try { - isSpinnerPresent = await element(by.tagName(materialLocators.Progress.spinner.root)).isDisplayed(); - } catch (error) { - isSpinnerPresent = false; - } - - return isSpinnerPresent; - } -} diff --git a/lib/testing/src/lib/protractor/core/public-api.ts b/lib/testing/src/lib/protractor/core/public-api.ts deleted file mode 100644 index 20519289acb..00000000000 --- a/lib/testing/src/lib/protractor/core/public-api.ts +++ /dev/null @@ -1,23 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './actions/public-api'; -export * from './pages/public-api'; -export * from './models/public-api'; -export * from './dialog/public-api'; -export * from './utils/public-api'; -export * from './test-element'; diff --git a/lib/testing/src/lib/protractor/core/test-element.ts b/lib/testing/src/lib/protractor/core/test-element.ts deleted file mode 100644 index a86c3a653a3..00000000000 --- a/lib/testing/src/lib/protractor/core/test-element.ts +++ /dev/null @@ -1,216 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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, ElementFinder, protractor, $ } from 'protractor'; -import { BrowserActions } from './utils/browser-actions'; -import { BrowserVisibility } from './utils/browser-visibility'; - -/** - * Provides a wrapper for the most common operations with the page elements. - */ -export class TestElement { - constructor(public elementFinder: ElementFinder) { - } - - /** - * Create a new instance with the element located by the id - * - * @param id The id of the element - * @returns test element wrapper - */ - static byId(id: string): TestElement { - return new TestElement(element(by.id(id))); - } - - /** - * Create a new instance with the element located by the CSS class name - * - * @param selector The CSS class name to lookup - * @returns test element wrapper - */ - static byCss(selector: string): TestElement { - return new TestElement($(selector)); - } - - /** - * Create a new instance with the element that contains specific text - * - * @param selector the CSS selector - * @param text the text within the target element - * @returns test element wrapper - */ - static byText(selector: string, text: string): TestElement { - return new TestElement(element(by.cssContainingText(selector, text))); - } - - /** - * Create a new instance with the element with specific HTML tag name - * - * @param selector the HTML tag name - * @returns test element wrapper - */ - static byTag(selector: string): TestElement { - return new TestElement(element(by.tagName(selector))); - } - - /** - * Performs a click on this element - */ - async click() { - return BrowserActions.click(this.elementFinder); - } - - /** - * Checks that an element is present on the DOM of a page and visible - * - * @param waitTimeout How long to wait for the condition to be true - */ - async isVisible(waitTimeout?: number): Promise { - try { - await BrowserVisibility.waitUntilElementIsVisible(this.elementFinder, waitTimeout); - return true; - } catch { - return false; - } - } - - /** - * Waits until the element is present on the DOM of a page and visible - * - * @param waitTimeout How long to wait for the condition to be true - */ - async waitVisible(waitTimeout?: number): Promise { - return BrowserVisibility.waitUntilElementIsVisible(this.elementFinder, waitTimeout); - } - - /** - * Waits until the element is either invisible or not present on the DOM - * - * @param waitTimeout How long to wait for the condition to be true - */ - async waitNotVisible(waitTimeout?: number): Promise { - return BrowserVisibility.waitUntilElementIsNotVisible(this.elementFinder, waitTimeout); - } - - /** - * Checks that an element is present on the DOM of a page - * - * @param waitTimeout How long to wait for the condition to be true - */ - async isPresent(waitTimeout?: number): Promise { - try { - await BrowserVisibility.waitUntilElementIsPresent(this.elementFinder, waitTimeout); - return true; - } catch { - return false; - } - } - - /** - * Waits until the element is present on the DOM of a page - * - * @param waitTimeout How long to wait for the condition to be true - */ - async waitPresent(waitTimeout?: number): Promise { - return BrowserVisibility.waitUntilElementIsPresent(this.elementFinder, waitTimeout); - } - - /** - * Waits until the element is not attached to the DOM of a page - * - * @param waitTimeout How long to wait for the condition to be true - */ - async waitNotPresent(waitTimeout?: number): Promise { - return BrowserVisibility.waitUntilElementIsNotPresent(this.elementFinder, waitTimeout); - } - - /** - * Waits until the given text is present in the element’s value - * - * @param value the text to check - */ - async waitHasValue(value: string): Promise { - return BrowserVisibility.waitUntilElementHasValue(this.elementFinder, value); - } - - /** - * Query whether the DOM element represented by this instance is enabled. - */ - async isEnabled(): Promise { - return this.elementFinder.isEnabled(); - } - /** - * Query whether the DOM element represented by this instance is disabled. - */ - async isDisabled(): Promise { - return !(await this.elementFinder.isEnabled()); - } - - /** - * Test whether this element is currently displayed. - */ - async isDisplayed(): Promise { - try { - await this.elementFinder.isDisplayed(); - return true; - } catch { - return false; - } - } - - /** - * Query for the value of the given attribute of the element. - * - * @param attributeName The name of the attribute to query. - */ - async getAttribute(attributeName: string): Promise { - return BrowserActions.getAttribute(this.elementFinder, attributeName); - } - - /** - * Get the visible (i.e. not hidden by CSS) innerText of this element, including sub-elements, without any leading or trailing whitespace. - */ - async getText(): Promise { - return BrowserActions.getText(this.elementFinder); - } - - /** - * Gets the `value` attribute for the given input element - * - * @returns input value - */ - getInputValue(): Promise { - return BrowserActions.getInputValue(this.elementFinder); - } - - /** - * Enter the text - * - * @param text the text to enter - */ - async typeText(text: string): Promise { - await BrowserActions.clearSendKeys(this.elementFinder, text); - } - - /** - * Clears the input using Ctrl+A and Backspace combination - */ - async clearInput() { - await this.elementFinder.clear(); - await this.elementFinder.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE); - } -} diff --git a/lib/testing/src/lib/protractor/core/utils/array.util.ts b/lib/testing/src/lib/protractor/core/utils/array.util.ts deleted file mode 100644 index 5ea9a1f1c31..00000000000 --- a/lib/testing/src/lib/protractor/core/utils/array.util.ts +++ /dev/null @@ -1,33 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export class ArrayUtil { - - /** - * Returns TRUE if the first array contains all elements from the second one. - * - * @param superset source array - * @param subset target array - * @returns `true` if array is included, otherwise `false` - */ - static arrayContainsArray(superset: any[], subset: any[]): boolean { - if (0 === subset.length) { - return false; - } - return subset.every((value) => (superset.indexOf(value) >= 0)); - } -} diff --git a/lib/testing/src/lib/protractor/core/utils/browser-actions.ts b/lib/testing/src/lib/protractor/core/utils/browser-actions.ts deleted file mode 100644 index 132764b4947..00000000000 --- a/lib/testing/src/lib/protractor/core/utils/browser-actions.ts +++ /dev/null @@ -1,216 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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, by, element, ElementArrayFinder, ElementFinder, protractor, $ } from 'protractor'; -import { BrowserVisibility } from '../utils/browser-visibility'; -import { Logger } from './logger'; - -import * as path from 'path'; -import * as fs from 'fs'; -import { ApiUtil } from '../../../shared/api/api.util'; - -export class BrowserActions { - - static async clickUntilIsNotVisible(elementToClick: ElementFinder, elementToFind: ElementFinder): Promise { - Logger.info(`Click until element is not present: ${elementToClick.locator().toString()}`); - const predicate = (isVisible: boolean) => isVisible; - - const apiCall = async () => { - await this.click(elementToClick); - - try { - await BrowserVisibility.waitUntilElementIsVisible(elementToFind); - return true; - } catch (error) { - return false; - } - }; - - return ApiUtil.waitForApi(apiCall, predicate, 10, 2000); - } - - static async click(elementToClick: ElementFinder): Promise { - try { - Logger.info(`Click element: ${elementToClick.locator().toString()}`); - await BrowserVisibility.waitUntilElementIsVisible(elementToClick); - await BrowserVisibility.waitUntilElementIsClickable(elementToClick); - await elementToClick.click(); - } catch (clickErr) { - Logger.warn(`click error element ${elementToClick.locator().toString()} consider to use directly clickScript`); - await this.clickScript(elementToClick); - } - } - - static async clickScript(elementToClick: ElementFinder): Promise { - Logger.info(`Click script ${elementToClick.locator().toString()}`); - - await browser.executeScript(`arguments[0].scrollIntoView();`, elementToClick); - await browser.executeScript(`arguments[0].click();`, elementToClick); - } - - static async clickExecuteScript(elementCssSelector: string): Promise { - Logger.info(`Click execute script ${elementCssSelector}`); - - await BrowserVisibility.waitUntilElementIsVisible($(elementCssSelector)); - await browser.executeScript(`document.querySelector('${elementCssSelector}').click();`); - } - - static async waitUntilActionMenuIsVisible(): Promise { - Logger.info(`wait Until Action Menu Is Visible`); - - const actionMenu = element.all(by.css('div[role="menu"]')).first(); - await BrowserVisibility.waitUntilElementIsVisible(actionMenu); - } - - static async waitUntilActionMenuIsNotVisible(): Promise { - Logger.info(`wait Until Action Menu Is Not Visible`); - - const actionMenu = element.all(by.css('div[role="menu"]')).first(); - await BrowserVisibility.waitUntilElementIsNotVisible(actionMenu); - } - - static async getUrl(url: string, timeout: number = 10000): Promise { - Logger.info(`Get URL ${url}`); - return browser.get(url, timeout); - } - - static async getAttribute(elementFinder: ElementFinder, attribute: string): Promise { - await BrowserVisibility.waitUntilElementIsPresent(elementFinder); - const attributeValue: string = await browser.executeScript(`return arguments[0].getAttribute(arguments[1])`, elementFinder, attribute); - return attributeValue || ''; - } - - static async getText(elementFinder: ElementFinder): Promise { - Logger.info(`Get Text ${elementFinder.locator().toString()}`); - - const present = await BrowserVisibility.waitUntilElementIsVisible(elementFinder); - - if (present) { - let text = await elementFinder.getText(); - - if (text === '') { // DO NOT REMOVE BUG sometime wrongly return empty text for cdk elements - Logger.info(`Use backup get text script`); - - text = await this.getTextScript(elementFinder); - return text?.trim(); - } - - return text; - } else { - Logger.error(`Get Text ${elementFinder.locator().toString()} not present`); - return ''; - } - } - - static async getInputValue(elementFinder: ElementFinder): Promise { - Logger.info(`Get Input value ${elementFinder.locator().toString()}`); - - const present = await BrowserVisibility.waitUntilElementIsVisible(elementFinder); - if (present) { - return browser.executeScript(`return arguments[0].value`, elementFinder); - } else { - Logger.error(`Get Input value ${elementFinder.locator().toString()} not present`); - return ''; - } - } - - static async getArrayText(elementFinders: ElementArrayFinder): Promise { - return elementFinders.getText(); - } - - static async getColor(elementFinder: ElementFinder): Promise { - await BrowserVisibility.waitUntilElementIsVisible(elementFinder); - const webElem = await elementFinder.getWebElement(); - return webElem.getCssValue('color'); - } - - static async clearWithBackSpace(elementFinder: ElementFinder, sleepTime: number = 0) { - await BrowserVisibility.waitUntilElementIsVisible(elementFinder); - await elementFinder.click(); - await elementFinder.sendKeys(protractor.Key.END); - - const value: string = await browser.executeScript(`return arguments[0].value`, elementFinder); - if (value) { - for (let i = value.length; i >= 0; i--) { - await elementFinder.sendKeys(protractor.Key.BACK_SPACE); - await browser.sleep(sleepTime); - } - } - } - - static async clearSendKeys(elementFinder: ElementFinder, text: string = '', sleepTime: number = 0): Promise { - Logger.info(`Clear and sendKeys text:${text} locator:${elementFinder.locator().toString()}`); - - await this.click(elementFinder); - await elementFinder.sendKeys(''); - await elementFinder.clear(); - - if (sleepTime === 0) { - await elementFinder.sendKeys(text); - } else { - // eslint-disable-next-line @typescript-eslint/prefer-for-of - for (let i = 0; i < text.length; i++) { - await elementFinder.sendKeys(text[i]); - await browser.sleep(sleepTime); - } - } - - try { - if (text !== protractor.Key.SPACE && text !== protractor.Key.ENTER) { - await BrowserVisibility.waitUntilElementHasValue(elementFinder, text, 1000); - } - } catch (e) { - Logger.info(`Set value different from the input`); - } - } - - static async rightClick(elementFinder: ElementFinder): Promise { - Logger.info(`Right click locator:${elementFinder.locator().toString()}`); - - await browser.actions().mouseMove(elementFinder).mouseDown().mouseMove(elementFinder).perform(); - await browser.actions().click(elementFinder, protractor.Button.RIGHT).perform(); - } - - static async closeMenuAndDialogs(): Promise { - Logger.info(`Close Menu And Dialogs`); - - const container = $('div.cdk-overlay-backdrop.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing'); - await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); - await BrowserVisibility.waitUntilElementIsNotVisible(container, 1000); - } - - static async closeDisabledMenu(): Promise { - // if the opened menu has only disabled items, pressing escape to close it won't work - await browser.actions().sendKeys(protractor.Key.ENTER).perform(); - } - - static async takeScreenshot(screenshotFilePath: string, fileName: string) { - const pngData = await browser.takeScreenshot(); - const filenameWithExt = `${fileName}.png`; - Logger.info('Taking screenshot: ', filenameWithExt); - - const fileWithPath = path.join(screenshotFilePath, filenameWithExt); - const stream = fs.createWriteStream(fileWithPath); - stream.write(Buffer.from(pngData, 'base64')); - stream.end(); - } - - // Don't make it pub,ic use getText - private static async getTextScript(elementFinder: ElementFinder): Promise { - return browser.executeScript(`return arguments[0].textContent`, elementFinder); - } -} diff --git a/lib/testing/src/lib/protractor/core/utils/browser-visibility.ts b/lib/testing/src/lib/protractor/core/utils/browser-visibility.ts deleted file mode 100644 index 17734513ae1..00000000000 --- a/lib/testing/src/lib/protractor/core/utils/browser-visibility.ts +++ /dev/null @@ -1,125 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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, ElementFinder, protractor, until, $ } from 'protractor'; -import { Logger } from './logger'; -import { falseIfMissing } from 'protractor/built/util'; - -export class BrowserVisibility { - // eslint-disable-next-line @typescript-eslint/naming-convention - static NOT_VISIBLE_DEFAULT_TIMEOUT = BrowserVisibility.getNoVisibleTimeout() ? browser.params.testConfig.timeouts.no_visible_timeout : 10000; - // eslint-disable-next-line @typescript-eslint/naming-convention - static DEFAULT_TIMEOUT = BrowserVisibility.getVisibleTimeout() ? browser.params.testConfig.timeouts.visible_timeout : 10000; - - static getVisibleTimeout() { - if (browser?.params?.testConfig?.timeouts) { - return browser.params.testConfig.timeouts.visible_timeout; - } - } - - static getNoVisibleTimeout() { - if (browser?.params?.testConfig?.timeouts) { - return browser.params.testConfig.timeouts.no_visible_timeout; - } - } - - static async waitUntilElementIsLocated(elementToCheck: ElementFinder, waitTimeout: number = BrowserVisibility.DEFAULT_TIMEOUT): Promise { - Logger.info(`Wait Until Element Is Located ${elementToCheck.locator().toString()} for ${waitTimeout}`); - - return browser.wait(until.elementLocated(elementToCheck), waitTimeout, 'Element is not located ' + elementToCheck.locator()); - } - - static async waitUntilElementIsPresent(elementToCheck: ElementFinder, waitTimeout: number = BrowserVisibility.DEFAULT_TIMEOUT): Promise { - Logger.info(`Wait Until Element Is Present ${elementToCheck.locator().toString()} for ${waitTimeout}`); - - return browser.wait(protractor.ExpectedConditions.presenceOf(elementToCheck), waitTimeout, 'Element is not present ' + elementToCheck.locator()); - } - - /* - * Wait for element to be visible - */ - static async waitUntilElementIsVisible(elementToCheck: ElementFinder, waitTimeout: number = BrowserVisibility.DEFAULT_TIMEOUT, message: string = 'Element is not visible'): Promise { - Logger.info(`Wait Until Element Is Visible ${elementToCheck.locator().toString()} for ${waitTimeout}`); - - return browser.wait(protractor.ExpectedConditions.visibilityOf(elementToCheck), waitTimeout, message + elementToCheck.locator()); - } - - /* - * Wait for element to be clickable - */ - static async waitUntilElementIsClickable(elementToCheck: ElementFinder, waitTimeout: number = BrowserVisibility.DEFAULT_TIMEOUT): Promise { - Logger.info(`Wait Until Element Is Clickable ${elementToCheck.locator().toString()} for ${waitTimeout}`); - - return browser.wait(protractor.ExpectedConditions.elementToBeClickable(elementToCheck), waitTimeout, 'Element is not Clickable ' + elementToCheck.locator()); - } - - /* - * Wait for element to not be present on the page - */ - static async waitUntilElementIsStale(elementToCheck: ElementFinder, waitTimeout: number = BrowserVisibility.DEFAULT_TIMEOUT): Promise { - Logger.info(`Wait Until Element Is Stale ${elementToCheck.locator().toString()} for ${waitTimeout}`); - - return browser.wait(protractor.ExpectedConditions.stalenessOf(elementToCheck), waitTimeout, 'Element is not in stale ' + elementToCheck.locator()); - } - - /* - * Wait for element to not be visible - */ - static async waitUntilElementIsNotVisible(elementToCheck: ElementFinder, waitTimeout: number = BrowserVisibility.NOT_VISIBLE_DEFAULT_TIMEOUT): Promise { - Logger.info(`Wait Until Element Is Not Visible ${elementToCheck.locator().toString()} for ${waitTimeout}`); - - return browser.wait(protractor.ExpectedConditions.invisibilityOf(elementToCheck), waitTimeout, 'Element is Visible and it should not' + elementToCheck.locator()); - } - - /* - * Wait for element to have value - */ - static async waitUntilElementHasValue(elementToCheck: ElementFinder, elementValue, waitTimeout: number = BrowserVisibility.DEFAULT_TIMEOUT): Promise { - Logger.info(`Wait Until Element has value ${elementToCheck.locator().toString()} for ${waitTimeout}`); - - return browser.wait(BrowserVisibility.textToBePresentInElementValue(elementToCheck, elementValue), waitTimeout, `Element doesn't have a value ${elementValue} ${elementToCheck.locator()}`); - } - - /* - * Wait for element to have text - */ - static async waitUntilElementHasText(elementToCheck: ElementFinder, text, waitTimeout: number = BrowserVisibility.DEFAULT_TIMEOUT): Promise { - Logger.info(`Wait Until Element has value ${elementToCheck.locator().toString()} for ${waitTimeout}`); - - return browser.wait(protractor.ExpectedConditions.textToBePresentInElement(elementToCheck, text), waitTimeout, `Element doesn't have the text ${text} ${elementToCheck.locator()}`); - } - - static async waitUntilElementIsNotPresent(elementToCheck: ElementFinder, waitTimeout: number = BrowserVisibility.NOT_VISIBLE_DEFAULT_TIMEOUT): Promise { - Logger.info(`Wait Until Element is not present ${elementToCheck.locator().toString()} for ${waitTimeout}`); - - return browser.wait(protractor.ExpectedConditions.stalenessOf(elementToCheck), waitTimeout, 'Element is present ' + elementToCheck.locator()); - } - - static async waitUntilDialogIsClose(): Promise { - Logger.info(`Wait Until dialog close`); - - const dialog = $('mat-dialog-container'); - await this.waitUntilElementIsNotPresent(dialog); - } - - private static textToBePresentInElementValue(elementFinder: ElementFinder, text: string) { - const hasText = async () => browser.executeScript(`return arguments[0].value`, elementFinder).then( - (actualText: string) => actualText.indexOf(text) > -1, falseIfMissing - ); - return protractor.ExpectedConditions.and(protractor.ExpectedConditions.presenceOf(elementFinder), hasText); - } -} diff --git a/lib/testing/src/lib/protractor/core/utils/file-browser.util.ts b/lib/testing/src/lib/protractor/core/utils/file-browser.util.ts deleted file mode 100644 index 4396e42ef31..00000000000 --- a/lib/testing/src/lib/protractor/core/utils/file-browser.util.ts +++ /dev/null @@ -1,34 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 * as path from 'path'; -import * as fs from 'fs'; -import { browser } from 'protractor'; - -export class FileBrowserUtil { - static async isFileDownloaded(fileName: string): Promise { - const DEFAULT_ROOT_PATH = browser.params.testConfig ? browser.params.testConfig.main.rootPath : __dirname; - const file: boolean = await browser.driver.wait( - () => fs.existsSync(path.join(DEFAULT_ROOT_PATH, 'downloads', fileName)), - 30000, - `${fileName} not downloaded` - ); - - expect(file).toBe(true); - return !!file; - } -} diff --git a/lib/testing/src/lib/protractor/core/utils/form.util.ts b/lib/testing/src/lib/protractor/core/utils/form.util.ts deleted file mode 100644 index 1ff6c303387..00000000000 --- a/lib/testing/src/lib/protractor/core/utils/form.util.ts +++ /dev/null @@ -1,37 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { ApiService } from '../../../shared/api/api.service'; -import { FormModelsApi, FormRepresentation } from '@alfresco/js-api'; - -export class FormUtil { - api: ApiService; - editorApi: FormModelsApi; - - constructor(apiService?: ApiService) { - if (apiService) { - this.api = apiService; - this.editorApi = new FormModelsApi(apiService.getInstance()); - } - } - - async getFormByName(name: string): Promise { - const forms: any = await this.editorApi.getForms(undefined); - - return forms.data.find((currentForm) => currentForm.name === name); - } -} diff --git a/lib/testing/src/lib/protractor/core/utils/local-storage.util.ts b/lib/testing/src/lib/protractor/core/utils/local-storage.util.ts deleted file mode 100644 index 55beffb1047..00000000000 --- a/lib/testing/src/lib/protractor/core/utils/local-storage.util.ts +++ /dev/null @@ -1,47 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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'; - -/* -Open the CoreAutomationService in ADF core to see where we augment the window -*/ -export class LocalStorageUtil { - static async getConfigField(field: string): Promise { - return browser.executeScript('return window.adf ? window.adf.getConfigField(`' + field + '`) : null;'); - } - - static async setConfigField(field: string, value: string): Promise { - await browser.executeScript('window.adf.setConfigField(`' + field + '`, `' + value + '`);'); - } - - static async setStorageItem(field: string, value: string): Promise { - await browser.executeScript('window.adf.setStorageItem(`' + field + '`, `' + value + '`);'); - } - - static async setUserPreference(field: string, value: any): Promise { - await browser.executeScript('window.adf.setUserPreference(`' + field + '`, `' + value + '`);'); - } - - static async clearStorage(): Promise { - await browser.executeScript('window.adf.clearStorage();'); - } - - static async apiReset(): Promise { - await browser.executeScript(`window.adf.apiReset();`); - } -} diff --git a/lib/testing/src/lib/protractor/core/utils/logger.ts b/lib/testing/src/lib/protractor/core/utils/logger.ts deleted file mode 100644 index a53c38af40c..00000000000 --- a/lib/testing/src/lib/protractor/core/utils/logger.ts +++ /dev/null @@ -1,24 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { GenericLogger } from '../../../shared/utils/logger'; -import { browser } from 'protractor'; - -// This was previously a static class, that is why we need this constant starting with uppercase -// Otherwise, feel free to update everywhere in the codebase, where we were using it :) -/* eslint-disable @typescript-eslint/naming-convention, no-underscore-dangle, id-blacklist, id-match */ -export const Logger = new GenericLogger(browser?.params?.testConfig?.appConfig?.log); diff --git a/lib/testing/src/lib/protractor/core/utils/protractor.util.ts b/lib/testing/src/lib/protractor/core/utils/protractor.util.ts deleted file mode 100644 index 48905522ae7..00000000000 --- a/lib/testing/src/lib/protractor/core/utils/protractor.util.ts +++ /dev/null @@ -1,32 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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, browser } from 'protractor'; - -/** - * Tagged template to convert a sting to an `ElementFinder`. - * - * @example ```const item = byCss`.adf-breadcrumb-item-current`;``` - * @example ```const item = byCss`${variable}`;``` - * @param literals literals - * @param placeholders placeholders - * @returns Instance of `ElementFinder` type. - */ -export const byCss = (literals: TemplateStringsArray, ...placeholders: string[]): ElementFinder => { - const selector = literals[0] || placeholders[0]; - return browser.$(selector); -}; diff --git a/lib/testing/src/lib/protractor/core/utils/public-api.ts b/lib/testing/src/lib/protractor/core/utils/public-api.ts deleted file mode 100644 index f4ce5288823..00000000000 --- a/lib/testing/src/lib/protractor/core/utils/public-api.ts +++ /dev/null @@ -1,26 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './browser-visibility'; -export * from './browser-actions'; -export * from './array.util'; -export * from './protractor.util'; -export * from './local-storage.util'; -export * from './file-browser.util'; -export * from './form.util'; -export * from './wait-actions'; -export * from './logger'; diff --git a/lib/testing/src/lib/protractor/core/utils/wait-actions.ts b/lib/testing/src/lib/protractor/core/utils/wait-actions.ts deleted file mode 100644 index 226256972ab..00000000000 --- a/lib/testing/src/lib/protractor/core/utils/wait-actions.ts +++ /dev/null @@ -1,62 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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, NodesApi } from '@alfresco/js-api'; -import { ApiService } from '../../../shared/api/api.service'; -import { ApiUtil } from '../../../shared/api/api.util'; -import { Logger } from './logger'; - -const DELAY_API_CALL = 5000; -export class WaitActions { - apiService: ApiService; - nodesApi: NodesApi; - - constructor(apiService: ApiService) { - this.nodesApi = new NodesApi(apiService.getInstance()); - this.apiService = apiService; - } - - async nodeIsPresent(nodeId: string): Promise { - const predicate = (result) => result.entry.id === nodeId; - - const apiCall = async () => { - try { - return this.nodesApi.getNode(nodeId); - } catch (error) { - Logger.error('Node not present'); - return null; - } - }; - - return ApiUtil.waitForApi(apiCall, predicate, DELAY_API_CALL); - } - - async nodeIsUnlock(nodeId: string): Promise { - const predicate = (result) => result.entry.isLocked === false; - - const apiCall = async () => { - try { - return this.nodesApi.getNode(nodeId); - } catch (error) { - Logger.error('Node not present'); - return null; - } - }; - - return ApiUtil.waitForApi(apiCall, predicate, DELAY_API_CALL); - } -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/actions/application.ts b/lib/testing/src/lib/protractor/process-services-cloud/actions/application.ts deleted file mode 100644 index f62974ca8de..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/actions/application.ts +++ /dev/null @@ -1,81 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { E2eRequestApiHelper } from '../../../shared/api/e2e-request-api.helper'; -import { Logger } from '../../core/utils/logger'; -import { ResultSetPaging } from '@alfresco/js-api'; -import { ApiService } from '../../../shared/api/api.service'; -import { ApiUtil } from '../../../shared/api/api.util'; - -export class Application { - requestApiHelper: E2eRequestApiHelper; - endPoint = `/deployment-service/v1/applications/`; - - constructor(api: ApiService) { - this.requestApiHelper = new E2eRequestApiHelper(api); - } - - async deploy(model: any): Promise { - await this.requestApiHelper.post(`${this.endPoint}`, { bodyParam: model }); - Logger.info(`[Application] Application '${model.name}' was deployed successfully.`); - } - - async delete(applicationId: string): Promise { - await this.requestApiHelper.delete(`${this.endPoint}${applicationId}`); - Logger.info(`[Application] Application: '${applicationId}' was deleted successfully.`); - } - - async undeploy(applicationName: string): Promise { - const isApplicationUndeployed = (response: any) => { - if (JSON.stringify(response) === '{}') { - Logger.info(`[Application] Application was undeployed successfully`); - return true; - } else { - Logger.warn(`[Application] Application was not undeployed`); - return false; - } - }; - - const apiCall = async () => { - try { - Logger.info(`[Application] Undeploy application ${applicationName} ...`); - return this.requestApiHelper.delete(`${this.endPoint}${applicationName}`); - } catch (error) { - Logger.error(`[Application] Undeploy application ${applicationName} failed with error: ${error.message}`); - return null; - } - }; - return ApiUtil.waitForApi(apiCall, isApplicationUndeployed, 10, 3000); - } - - async deleteDescriptor(name: string): Promise { - await this.requestApiHelper.delete(`v1/descriptors/${name}`); - Logger.info(`[Descriptor] Descriptor: '${name}' was deleted successfully.`); - } - - async getDescriptors(): Promise { - Logger.info(`[Descriptor] Return descriptors`); - return this.requestApiHelper.get(`v1/descriptors`, {}); - } - - async getApplicationsByStatus(status: string): Promise { - Logger.info(`[Application] Return application by status: ${status}`); - return this.requestApiHelper.get(this.endPoint, { - queryParams: { status, sort: 'name' } - }); - } -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/actions/descriptor.ts b/lib/testing/src/lib/protractor/process-services-cloud/actions/descriptor.ts deleted file mode 100644 index 8218b762bf3..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/actions/descriptor.ts +++ /dev/null @@ -1,88 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 } from '@alfresco/js-api'; -import { E2eRequestApiHelper } from '../../../shared/api/e2e-request-api.helper'; -import { ApplicationRepresentation } from '../../core/models/application-model'; -import { Logger } from '../../core/utils/logger'; -import { ApiUtil } from '../../../shared/api/api.util'; -import { ApiService } from '../../../shared/api/api.service'; - -export class Descriptor { - requestApiHelper: E2eRequestApiHelper; - endPoint = `deployment-service/v1/descriptors/`; - - constructor(api: ApiService) { - this.requestApiHelper = new E2eRequestApiHelper(api); - } - - async create(model: ApplicationRepresentation): Promise { - try { - await this.requestApiHelper.post(this.endPoint, { - bodyParam: model - }); - Logger.info(`[Descriptor] Descriptor has been created with name: ${model.name}.`); - } catch (error) { - Logger.error(`[Descriptor] Create descriptor ${model.name} failed with message: ${error.message}`); - throw error; - } - } - - async delete(name: string): Promise { - const isDescriptorDeleted = (response: any) => { - if (JSON.stringify(response) === '{}') { - Logger.info(`[Descriptor] Descriptor was deleted successfully`); - return true; - } else { - Logger.warn(`[Descriptor] Descriptor was not deleted`); - return false; - } - }; - - const apiCall = async () => { - try { - await this.retryUntilDescriptorIsInStatus(name, `DescriptorCreated`); - Logger.info(`[Descriptor] Deleting descriptor ${name} ...`); - return this.requestApiHelper.delete(`${this.endPoint}${name}`); - } catch (error) { - Logger.error(`[Descriptor] Delete descriptor ${name} failed with error: ${error.message}`); - return null; - } - }; - return ApiUtil.waitForApi(apiCall, isDescriptorDeleted, 10, 15000); - } - - async get(name: string): Promise { - Logger.info(`[Descriptor] Get descriptor ${name} details.`); - try { - return this.requestApiHelper.get(`${this.endPoint}${name}`); - } catch (error) { - Logger.error(`[Descriptor] Get descriptor ${name} details failed with message: ${error.message}`); - } - } - - async retryUntilDescriptorIsInStatus(name: string, expectedStatus: string): Promise { - const predicate = (result: { status: string }) => { - Logger.info(`[Descriptor] Descriptor ${name} status is: ${result.status}`); - return result.status === expectedStatus; - }; - - const apiCall = async () => this.get(name); - - return ApiUtil.waitForApi(apiCall, predicate); - } -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/actions/form-cloud.service.ts b/lib/testing/src/lib/protractor/process-services-cloud/actions/form-cloud.service.ts deleted file mode 100644 index 4cb3ec49bee..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/actions/form-cloud.service.ts +++ /dev/null @@ -1,77 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { ApiService } from '../../../shared/api/api.service'; -import { Logger } from '../../core/utils/logger'; - -export class FormCloudService { - - api: ApiService; - - constructor(api: ApiService) { - this.api = api; - } - - async submitForm(formId, appName, taskId, processInstanceId, values): Promise { - try { - const path = '/' + appName + '/form/v1/forms/' + formId + '/submit'; - const method = 'POST'; - - const queryParams = {}; - const postBody = { - values, - taskId, - processInstanceId - }; - - return this.api.performBpmOperation(path, method, queryParams, postBody); - - } catch (error) { - Logger.error('Form Submit Service not working', error.message); - } - - } - - async getForms(appName: string): Promise { - try { - const path = '/' + appName + '/form/v1/forms'; - const method = 'GET'; - - const queryParams = {}; - const postBody = {}; - - return this.api.performBpmOperation(path, method, queryParams, postBody); - - } catch (error) { - Logger.error('Get forms error ', error.message); - } - - return []; - } - - async getIdByFormName(appName: string, formName: string): Promise { - const forms = await this.getForms(appName); - const formEntry = forms.find((currentForm) => currentForm.formRepresentation.name === formName); - - if (formEntry.formRepresentation) { - return formEntry.formRepresentation.id; - } - - return null; - } - -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/actions/message-events.service.ts b/lib/testing/src/lib/protractor/process-services-cloud/actions/message-events.service.ts deleted file mode 100644 index 9d3073c3cfa..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/actions/message-events.service.ts +++ /dev/null @@ -1,69 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { ApiService } from '../../../shared/api/api.service'; -import { Logger } from '../../core/utils/logger'; - -export class MessageEventsService { - - api: ApiService; - - constructor(api: ApiService) { - this.api = api; - } - - async startMessageEvent(startMessage: string, appName: string, options?: any): Promise { - try { - const path = '/' + appName + '/rb/v1/process-instances/message'; - const method = 'POST'; - - const queryParams = {}; - const postBody = { - name: startMessage, - variables: {}, - payloadType: 'StartMessagePayload', - ...options - }; - - return this.api.performBpmOperation(path, method, queryParams, postBody); - - } catch (error) { - Logger.error('Start Message Event Service not working', error.message); - } - - } - - async receiveMessageEvent(receiveMessage: string, appName: string, options?: any): Promise { - try { - const path = '/' + appName + '/rb/v1/process-instances/message'; - const method = 'PUT'; - - const queryParams = {}; - const postBody = { - name: receiveMessage, - variables: {}, - payloadType: 'ReceiveMessagePayload', - ...options - }; - - return this.api.performBpmOperation(path, method, queryParams, postBody); - - } catch (error) { - Logger.error('Receive Message Event Service not working', error.message); - } - } -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/actions/process-definitions.service.ts b/lib/testing/src/lib/protractor/process-services-cloud/actions/process-definitions.service.ts deleted file mode 100644 index 7bf96cbfa6f..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/actions/process-definitions.service.ts +++ /dev/null @@ -1,54 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { ApiService } from '../../../shared/api/api.service'; -import { Logger } from '../../core/utils/logger'; - -export class ProcessDefinitionsService { - - api: ApiService; - - constructor(api: ApiService) { - this.api = api; - } - - async getProcessDefinitions(appName: string): Promise { - const path = '/' + appName + '/rb/v1/process-definitions'; - const method = 'GET'; - - const queryParams = {}; - - try { - return this.api.performBpmOperation(path, method, queryParams, {}); - } catch (error) { - if (error.status === 404) { - Logger.error(`${appName} not present`); - } else if (error.status === 403) { - Logger.error(`Access to the requested resource has been denied ${appName}`); - } - } - } - - async getProcessDefinitionByName(processDefinitionName: string, appName: string) { - const processDefinitions = await this.getProcessDefinitions(appName); - return processDefinitions.list.entries.find((el) => { - if (el.entry.name === processDefinitionName) { - return el; - } - }); - } -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/actions/process-instances.service.ts b/lib/testing/src/lib/protractor/process-services-cloud/actions/process-instances.service.ts deleted file mode 100644 index ce941fa13e2..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/actions/process-instances.service.ts +++ /dev/null @@ -1,95 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { ApiService } from '../../../shared/api/api.service'; -import { Logger } from '../../core/utils/logger'; - -export class ProcessInstancesService { - - api: ApiService; - - constructor(api: ApiService) { - this.api = api; - } - - async createProcessInstance(processDefKey, appName, options?: any) { - try { - const path = '/' + appName + '/rb/v1/process-instances'; - const method = 'POST'; - - const queryParams = {}; - const postBody = { - processDefinitionKey: processDefKey, - payloadType: 'StartProcessPayload', - ...options - }; - - return this.api.performBpmOperation(path, method, queryParams, postBody); - - } catch (error) { - // eslint-disable-next-line no-console - Logger.error('create process-instances Service not working', error.message); - } - - } - - async suspendProcessInstance(processInstanceId, appName) { - try { - const path = '/' + appName + '/rb/v1/process-instances/' + processInstanceId + '/suspend'; - const method = 'POST'; - - const queryParams = {}; - const postBody = {}; - - return this.api.performBpmOperation(path, method, queryParams, postBody); - - } catch (error) { - // eslint-disable-next-line no-console - Logger.error('suspend process-instances Service not working', error.message); - } - } - - async deleteProcessInstance(processInstanceId, appName) { - try { - const path = '/' + appName + '/rb/v1/process-instances/' + processInstanceId; - const method = 'DELETE'; - const queryParams = {}; - const postBody = {}; - - return this.api.performBpmOperation(path, method, queryParams, postBody); - - } catch (error) { - // eslint-disable-next-line no-console - Logger.error('delete process-instances Service not working', error.message); - } - } - - async completeProcessInstance(processInstanceId, appName) { - try { - const path = '/' + appName + '/rb/v1/process-instances/' + processInstanceId + '/complete'; - const method = 'POST'; - const queryParams = {}; - const postBody = {}; - - return this.api.performBpmOperation(path, method, queryParams, postBody); - - } catch (error) { - // eslint-disable-next-line no-console - Logger.error('complete process-instances Service not working', error.message); - } - } -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/actions/process.services.ts b/lib/testing/src/lib/protractor/process-services-cloud/actions/process.services.ts deleted file mode 100644 index a9be596e245..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/actions/process.services.ts +++ /dev/null @@ -1,81 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { ApiService } from '../../../shared/api/api.service'; -import { ApiUtil } from '../../../shared/api/api.util'; -import { ProcessDefinitionsService } from './process-definitions.service'; -import { ProcessInstancesService } from './process-instances.service'; -import { QueryService } from '../../core/actions/identity/query.service'; -import { TasksService } from './tasks.service'; -import { StringUtil } from '../../../shared/utils/string.util'; -import { Logger } from '../../core/utils/logger'; - -export class ProcessServices { - processInstancesService: ProcessInstancesService; - processDefinitionsService: ProcessDefinitionsService; - tasksService: TasksService; - queryService: QueryService; - - private api: ApiService; - - constructor(api: ApiService) { - this.api = api; - this.processInstancesService = new ProcessInstancesService(this.api); - this.processDefinitionsService = new ProcessDefinitionsService(this.api); - this.tasksService = new TasksService(this.api); - this.queryService = new QueryService(this.api); - } - - async createProcessInstanceAndClaimFirstTask(processDefName: string, appName: string, taskIndex: number = 0, processInstanceName?: string) { - const processInstance = await this.createProcessInstance(processDefName, appName, processInstanceName); - const task = await this.queryService.getProcessInstanceTasks(processInstance.entry.id, appName); - await this.tasksService.claimTask(task.list.entries[taskIndex].entry.id, appName); - - return processInstance; - } - - async createProcessInstance(processDefName: string, appName: string, processInstanceName?: string) { - const processDefinition = await this.processDefinitionsService.getProcessDefinitionByName(processDefName, appName); - const processInstance = await this.processInstancesService.createProcessInstance(processDefinition.entry.key, appName, { - name: processInstanceName ? processInstanceName : StringUtil.generateRandomString(), - businessKey: StringUtil.generateRandomString() - }); - - return processInstance; - } - - async createProcessInstanceWithVariables(processDefName: string, appName: string, variables: any, processInstanceName?: string) { - const processDefinition = await this.processDefinitionsService.getProcessDefinitionByName(processDefName, appName); - const processInstance = await this.processInstancesService.createProcessInstance(processDefinition.entry.key, appName, { - name: processInstanceName ? processInstanceName : StringUtil.generateRandomString(), - businessKey: StringUtil.generateRandomString(), - variables - }); - - return processInstance; - } - - async waitForStatus(processInstanceId: string, appName: string, expectedStatus: string): Promise { - const predicate = (result: any) => { - Logger.info(`Process instance ${processInstanceId} status found: ${result.entry.status}`); - return result.entry.status === expectedStatus; - }; - - const apiCall = async () => this.queryService.getProcessInstance(processInstanceId, appName); - return ApiUtil.waitForApi(apiCall, predicate, 3, 500); - } -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/actions/project.ts b/lib/testing/src/lib/protractor/process-services-cloud/actions/project.ts deleted file mode 100644 index bdc64479f19..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/actions/project.ts +++ /dev/null @@ -1,138 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { NodeEntry, ResultSetPaging } from '@alfresco/js-api'; -import { ApiUtil } from '../../../shared/api/api.util'; -import { E2eRequestApiHelper, E2eRequestApiHelperOptions } from '../../../shared/api/e2e-request-api.helper'; -import * as fs from 'fs'; -import { StringUtil } from '../../../shared/utils/string.util'; -import { Logger } from '../../core/utils/logger'; -import { ApiService } from '../../../shared/api/api.service'; - -export class Project { - requestApiHelper: E2eRequestApiHelper; - endPoint = 'modeling-service/v1/projects/'; - namePrefix: string = browser.params.namePrefix; - - constructor(api: ApiService) { - this.requestApiHelper = new E2eRequestApiHelper(api); - } - - async create(modelName: string = this.getRandomName()): Promise { - const project = await this.requestApiHelper.post(this.endPoint, {bodyParam: { name: modelName }}); - - Logger.info( - `[Project] Project created with name: ${project.entry.name} and id: ${ - project.entry.id - }.` - ); - return project; - } - - async createAndWaitUntilAvailable(modelName: string = this.getRandomName()): Promise { - try { - const project = await this.create(modelName); - await this.retrySearchProject(project.entry.id); - return project; - } catch (error) { - Logger.error(`[Project] Create and wait for project to be available failed!`); - throw error; - } - } - - async get(projectId: string): Promise { - return this.requestApiHelper.get(`${this.endPoint}${projectId}`); - } - - async delete(projectId: string): Promise { - await this.requestApiHelper.delete(`${this.endPoint}${projectId}`); - Logger.info( - `[Project] Project '${projectId}' was deleted successfully.` - ); - } - - async release(projectId: string): Promise { - try { - const release = await this.requestApiHelper - .post(`${this.endPoint}${projectId}/releases`); - Logger.info(`[Project] Project '${projectId}' was released.`); - return release; - } catch (error) { - Logger.error(`[Project] Release project failed!`); - throw error; - } - } - - async getProjectRelease(projectId: string): Promise { - try { - return await this.requestApiHelper - .get(`${this.endPoint}${projectId}/releases`); - } catch (error) { - Logger.error(`[Project] Not able to fetch project release!`); - throw error; - } - } - - async deleteRelease(releaseId: string): Promise { - Logger.info(`[Project] Delete project release ${releaseId}`); - try { - await this.requestApiHelper.delete(`modeling-service/v1/releases/${releaseId}`); - Logger.info(`[Project] Release ${releaseId} was deleted successfully`); - } catch (error) { - throw new Error(`Delete project release ${releaseId} failed: ${JSON.stringify(error)}`); - } - } - - async import(projectFilePath: string): Promise { - const fileContent = fs.createReadStream(projectFilePath); - const requestOptions: E2eRequestApiHelperOptions = { - formParams: { file: fileContent }, - contentTypes: ['multipart/form-data'] - }; - try { - const project = await this.requestApiHelper - .post(`${this.endPoint}import`, requestOptions); - Logger.info(`[Project] Project imported with name '${project.entry.name}' and id '${project.entry.id}'.`); - return project; - } catch (error) { - Logger.error(`[Project] Import project failed!`); - throw error; - } - } - - async searchProjects(): Promise { - Logger.info(`[Project] Waiting created project to be ready for listing.`); - return this.requestApiHelper.get(this.endPoint, { - queryParams: { maxItems: 1000 } - }); - } - - private async retrySearchProject(modelId: string): Promise { - const predicate = (result: ResultSetPaging) => { - const foundModel = result.list.entries.find(model => model.entry.id === modelId); - return !!foundModel; - }; - const apiCall = () => this.searchProjects(); - - return ApiUtil.waitForApi(apiCall, predicate); - } - - private getRandomName(): string { - return this.namePrefix + StringUtil.generateRandomString(5).toLowerCase(); - } -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/actions/public-api.ts b/lib/testing/src/lib/protractor/process-services-cloud/actions/public-api.ts deleted file mode 100644 index d72b7076e6a..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/actions/public-api.ts +++ /dev/null @@ -1,26 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './process-definitions.service'; -export * from './process-instances.service'; -export * from './process.services'; -export * from './message-events.service'; -export * from './form-cloud.service'; -export * from './tasks.service'; -export * from './application'; -export * from './descriptor'; -export * from './project'; diff --git a/lib/testing/src/lib/protractor/process-services-cloud/actions/tasks.service.ts b/lib/testing/src/lib/protractor/process-services-cloud/actions/tasks.service.ts deleted file mode 100644 index 4538fd35472..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/actions/tasks.service.ts +++ /dev/null @@ -1,150 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { ApiService } from '../../../shared/api/api.service'; -import { Logger } from '../../core/utils/logger'; - -export class TasksService { - - api: ApiService; - - constructor(api: ApiService) { - this.api = api; - } - - async createStandaloneTask(taskName: string, appName: string, options?: any): Promise { - const path = '/' + appName + '/rb/v1/tasks'; - const method = 'POST'; - - const queryParams = {}; - const postBody = { - name: taskName, - payloadType: 'CreateTaskPayload', - ...options - }; - - return this.api.performBpmOperation(path, method, queryParams, postBody) - .catch((error) => { - Logger.error('Create Task - Service error, Response: ', JSON.stringify(error?.response?.text)); - }); - } - - async createStandaloneTaskWithForm(taskName: string, appName: string, formKey: string, options?: any): Promise { - const path = '/' + appName + '/rb/v1/tasks'; - const method = 'POST'; - - const queryParams = {}; - const postBody = { - name: taskName, - payloadType: 'CreateTaskPayload', - formKey, - ...options - }; - - return this.api.performBpmOperation(path, method, queryParams, postBody) - .catch((error) => { - Logger.error('Create standalone Task - Service error, Response: ', JSON.stringify(error?.response?.text)); - }); - } - - async completeTask(taskId: string, appName: string): Promise { - const path = '/' + appName + '/rb/v1/tasks/' + taskId + '/complete'; - const method = 'POST'; - - const queryParams = {}; - const postBody = { payloadType: 'CompleteTaskPayload' }; - - return this.api.performBpmOperation(path, method, queryParams, postBody) - .catch((error) => { - Logger.error('Complete Task - Service error, Response: ', JSON.stringify(error?.response?.text)); - }); - } - - async claimTask(taskId: string, appName: string): Promise { - const path = '/' + appName + '/rb/v1/tasks/' + taskId + `/claim`; - const method = 'POST'; - - const queryParams = {}; - const postBody = {}; - - return this.api.performBpmOperation(path, method, queryParams, postBody) - .catch((error) => { - Logger.error('claim Task - Service error, Response: ', JSON.stringify(error?.response?.text)); - }); - } - - async deleteTask(taskId: string, appName: string): Promise { - const path = '/' + appName + '/rb/v1/tasks/' + taskId; - const method = 'DELETE'; - - const queryParams = {}; - const postBody = {}; - - return this.api.performBpmOperation(path, method, queryParams, postBody) - .catch((error) => { - Logger.error('delete Task - Service error, Response: ', JSON.stringify(error?.response?.text)); - }); - } - - async createAndCompleteTask(taskName: string, appName: string): Promise { - const task = await this.createStandaloneTask(taskName, appName); - await this.claimTask(task.entry.id, appName); - await this.completeTask(task.entry.id, appName); - return task; - } - - async getTask(taskId: string, appName: string): Promise { - const path = '/' + appName + '/query/v1/tasks/' + taskId; - const method = 'GET'; - - const queryParams = {}; - const postBody = {}; - - return this.api.performBpmOperation(path, method, queryParams, postBody) - .catch((error) => { - Logger.error('Get Task - Service error, Response: ', JSON.stringify(error?.response?.text)); - }); - } - - async getTaskId(taskName: string, appName: string): Promise { - const path = '/' + appName + '/query/v1/tasks'; - const method = 'GET'; - - const queryParams = { name: taskName }; - const postBody = {}; - - const data = await this.api.performBpmOperation(path, method, queryParams, postBody) - .catch((error) => { - Logger.error('Get Task Id Service error, Response: ', JSON.stringify(error?.response?.text)); - }); - return data.list.entries && data.list.entries.length > 0 ? data.list.entries[0].entry.id : null; - } - - async createStandaloneSubtask(parentTaskId: string, appName: string, name: string): Promise { - const path = '/' + appName + '/rb/v1/tasks'; - const method = 'POST'; - - const queryParams = {}; - const postBody = { name, parentTaskId, payloadType: 'CreateTaskPayload' }; - - return this.api.performBpmOperation(path, method, queryParams, postBody) - .catch((error) => { - Logger.error('Create sub Task - Service error, Response: ', JSON.stringify(error?.response?.text)); - }); - } - -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/app/app-list-cloud.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/app/app-list-cloud.page.ts deleted file mode 100644 index 23474f7ab69..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/app/app-list-cloud.page.ts +++ /dev/null @@ -1,42 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 '../../core/utils/browser-visibility'; -import { BrowserActions } from '../../core/utils/browser-actions'; -import { materialLocators } from '../../public-api'; - -export class AppListCloudPage { - apsAppsContainer = $('adf-cloud-app-list'); - firstApp = $$('adf-cloud-app-details div[class*="item-card-title"] h1').first(); - - getAppNameLocatorByAppName = (appName: string): ElementFinder => $(`${materialLocators.Card.root}[title="${appName}"]`); - - async checkApsContainer(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.apsAppsContainer); - await BrowserVisibility.waitUntilElementIsVisible(this.firstApp); - } - - async goToApp(applicationName: string): Promise { - await BrowserActions.clickExecuteScript(`${materialLocators.Card.root}[title="` + applicationName + `"]`); - } - - async checkAppIsDisplayed(applicationName: string): Promise { - const app = this.getAppNameLocatorByAppName(applicationName); - await BrowserVisibility.waitUntilElementIsVisible(app); - } -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/app/public-api.ts b/lib/testing/src/lib/protractor/process-services-cloud/app/public-api.ts deleted file mode 100644 index d177dbe66d7..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/app/public-api.ts +++ /dev/null @@ -1,18 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './app-list-cloud.page'; diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/dialog/edit-process-filter-dialog.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/dialog/edit-process-filter-dialog.page.ts deleted file mode 100644 index 1b641fd7c80..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/dialog/edit-process-filter-dialog.page.ts +++ /dev/null @@ -1,69 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { BrowserVisibility } from '../../../core/utils/browser-visibility'; -import { BrowserActions } from '../../../core/utils/browser-actions'; - -export class EditProcessFilterDialogPage { - - componentElement = $('adf-cloud-process-filter-dialog-cloud'); - title = $('#adf-process-filter-dialog-title'); - filterNameInput = $('#adf-filter-name-id'); - saveButtonLocator = '#adf-save-button-id'; - cancelButtonLocator = '#adf-cancel-button-id'; - - async clickOnSaveButton(): Promise { - const saveButton = this.componentElement.$(this.saveButtonLocator); - await BrowserActions.click(saveButton); - await BrowserVisibility.waitUntilElementIsNotVisible(this.componentElement); - await browser.driver.sleep(1000); - } - - async checkSaveButtonIsEnabled(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.$(this.saveButtonLocator)); - return this.componentElement.$(this.saveButtonLocator).isEnabled(); - } - - async clickOnCancelButton(): Promise { - const cancelButton = this.componentElement.$(this.cancelButtonLocator); - await BrowserActions.click(cancelButton); - await BrowserVisibility.waitUntilElementIsNotVisible(this.componentElement); - } - - async checkCancelButtonIsEnabled(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.$(this.cancelButtonLocator)); - return this.componentElement.$(this.cancelButtonLocator).isEnabled(); - } - - async getFilterName(): Promise { - return BrowserActions.getInputValue(this.filterNameInput); - } - - async setFilterName(filterName: string): Promise { - await BrowserActions.clearSendKeys(this.filterNameInput, filterName); - } - - async getTitle(): Promise { - return BrowserActions.getText(this.title); - } - - async clearFilterName() { - await BrowserActions.clearWithBackSpace(this.filterNameInput); - } - -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/dialog/edit-task-filter-dialog.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/dialog/edit-task-filter-dialog.page.ts deleted file mode 100644 index 557a7d9a1d5..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/dialog/edit-task-filter-dialog.page.ts +++ /dev/null @@ -1,69 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { BrowserVisibility } from '../../../core/utils/browser-visibility'; -import { BrowserActions } from '../../../core/utils/browser-actions'; - -export class EditTaskFilterDialogPage { - - componentElement = $('adf-cloud-task-filter-dialog'); - title = $('#adf-task-filter-dialog-title'); - filterNameInput = $('#adf-filter-name-id'); - saveButtonLocator = '#adf-save-button-id'; - cancelButtonLocator = '#adf-cancel-button-id'; - - async clickOnSaveButton(): Promise { - const saveButton = this.componentElement.$(this.saveButtonLocator); - await BrowserActions.click(saveButton); - await BrowserVisibility.waitUntilElementIsNotVisible(this.componentElement); - await browser.driver.sleep(1000); - } - - async checkSaveButtonIsEnabled(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.$(this.saveButtonLocator)); - return this.componentElement.$(this.saveButtonLocator).isEnabled(); - } - - async clickOnCancelButton(): Promise { - const cancelButton = this.componentElement.$(this.cancelButtonLocator); - await BrowserActions.click(cancelButton); - await BrowserVisibility.waitUntilElementIsNotVisible(this.componentElement); - } - - async checkCancelButtonIsEnabled(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.$(this.cancelButtonLocator)); - return this.componentElement.$(this.cancelButtonLocator).isEnabled(); - } - - async getFilterName(): Promise { - return BrowserActions.getInputValue(this.filterNameInput); - } - - async setFilterName(filterName: string): Promise { - await BrowserActions.clearSendKeys(this.filterNameInput, filterName); - } - - async clearFilterName(): Promise { - await BrowserActions.clearWithBackSpace(this.filterNameInput); - } - - getTitle(): Promise { - return BrowserActions.getText(this.title); - } - -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/dialog/public-api.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/dialog/public-api.ts deleted file mode 100644 index 723759b5805..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/dialog/public-api.ts +++ /dev/null @@ -1,19 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './edit-process-filter-dialog.page'; -export * from './edit-task-filter-dialog.page'; diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/edit-process-filter-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/edit-process-filter-cloud-component.page.ts deleted file mode 100644 index e44d7bfbc66..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/edit-process-filter-cloud-component.page.ts +++ /dev/null @@ -1,300 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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, $$, $, by, element } from 'protractor'; -import { EditProcessFilterDialogPage } from './dialog/edit-process-filter-dialog.page'; -import { BrowserVisibility } from '../../core/utils/browser-visibility'; -import { BrowserActions } from '../../core/utils/browser-actions'; -import { DropdownPage } from '../../core/pages/material/dropdown.page'; -import { PeopleCloudComponentPage } from './people-cloud-component.page'; -import { DatePickerPage } from '../../core/pages/material/date-picker.page'; -import { TestElement } from '../../core/test-element'; -import { materialLocators } from '../../public-api'; - -export interface FilterProps { - name?: string; - status?: string; - sort?: string; - order?: string; - initiator?: string; - processName?: string; - suspendedDateRange?: string; -} - -export class EditProcessFilterCloudComponentPage { - rootElement = $$('adf-cloud-edit-process-filter').first(); - customiseFilter = $('#adf-edit-process-filter-sub-title-id'); - saveButton = $('button[data-automation-id="adf-filter-action-save"]'); - saveAsButton = $('button[data-automation-id="adf-filter-action-saveAs"]'); - deleteButton = $('button[data-automation-id="adf-filter-action-delete"]'); - filter = $(`adf-cloud-edit-process-filter ${materialLocators.Expansion.panel.header.root}`); - - appNameDropdown = new DropdownPage($(`${materialLocators.Select.root}[data-automation-id='adf-cloud-edit-process-property-appName']`)); - statusDropdown = new DropdownPage($(`${materialLocators.Select.root}[data-automation-id='adf-cloud-edit-process-property-status']`)); - sortDropdown = new DropdownPage($(`${materialLocators.Select.root}[data-automation-id='adf-cloud-edit-process-property-sort']`)); - orderDropdown = new DropdownPage($(`${materialLocators.Select.root}[data-automation-id='adf-cloud-edit-process-property-order']`)); - processDefinitionNameDropdown = new DropdownPage( - $(`${materialLocators.Select.root}[data-automation-id='adf-cloud-edit-process-property-processDefinitionName']`) - ); - suspendedDateRangeDropdown = new DropdownPage( - $(`${materialLocators.Select.root}[data-automation-id='adf-cloud-edit-process-property-suspendedDateRange']`) - ); - startedDateRangeDropdown = new DropdownPage( - $(`${materialLocators.Select.root}[data-automation-id='adf-cloud-edit-process-property-startedDateRange']`) - ); - completedDateRangeDropdown = new DropdownPage( - $(`${materialLocators.Select.root}[data-automation-id='adf-cloud-edit-process-property-completedDateRange']`) - ); - suspendedDateRangeWithin = new DatePickerPage( - $(`${materialLocators.Datepicker.toggle.root}[data-automation-id='adf-cloud-edit-process-property-date-range-suspendedDateRange']`) - ); - - peopleCloudComponent = new PeopleCloudComponentPage(); - editProcessFilterDialogPage = new EditProcessFilterDialogPage(); - - private expansionPanelExtended = this.rootElement.$(`${materialLocators.Expansion.panel.header.root}${materialLocators.Expanded.class}`); - private content = TestElement.byCss( - `adf-cloud-edit-process-filter ${materialLocators.Expansion.panel.root}${materialLocators.Expansion.panel.expanded} ${materialLocators.Expansion.panel.content.class}` - ); - - editProcessFilterDialog(): EditProcessFilterDialogPage { - return this.editProcessFilterDialogPage; - } - - isFilterDisplayed(): Promise { - return BrowserVisibility.waitUntilElementIsVisible(this.filter); - } - - async isDropdownFilterDisplayed(): Promise { - return this.content.isVisible(250); - } - - async openFilter() { - await this.isFilterDisplayed(); - await BrowserActions.click(this.customiseFilter); - await this.checkHeaderIsExpanded(); - } - - async checkHeaderIsExpanded() { - await BrowserVisibility.waitUntilElementIsVisible(this.expansionPanelExtended); - await this.content.waitVisible(); - } - - async closeFilter() { - await BrowserActions.click(this.customiseFilter); - await this.checkHeaderIsCollapsed(); - } - - async checkHeaderIsCollapsed() { - await BrowserVisibility.waitUntilElementIsNotVisible(this.expansionPanelExtended, 1000); - await this.content.waitNotVisible(1000); - } - - async setStatusFilterDropDown(option: string) { - await this.statusDropdown.selectDropdownOption(option); - } - - getStateFilterDropDownValue(): Promise { - return BrowserActions.getText($(`${materialLocators.Form.field.root}[data-automation-id='status'] span`)); - } - - async setSortFilterDropDown(option) { - await this.sortDropdown.selectDropdownOption(option); - await browser.sleep(500); - } - - async getSortFilterDropDownValue(): Promise { - const sortLocator = $$(`${materialLocators.Form.field.root}[data-automation-id='sort'] span`).first(); - return BrowserActions.getText(sortLocator); - } - - async setOrderFilterDropDown(option: string) { - await this.orderDropdown.selectDropdownOption(option); - await browser.sleep(1500); - } - - getOrderFilterDropDownValue(): Promise { - return BrowserActions.getText($(`${materialLocators.Form.field.root}[data-automation-id='order'] span`)); - } - - async setAppNameDropDown(option: string) { - await this.appNameDropdown.selectDropdownOption(option); - } - - async setProcessDefinitionNameDropDown(option: string) { - await this.processDefinitionNameDropdown.checkDropdownIsVisible(); - await this.processDefinitionNameDropdown.checkDropdownIsClickable(); - await this.processDefinitionNameDropdown.checkOptionIsDisplayed('ALL'); - await this.processDefinitionNameDropdown.selectDropdownOption(option); - } - - async setSuspendedDateRangeDropDown(option: string) { - await this.suspendedDateRangeDropdown.selectDropdownOption(option); - } - - async setStartedDateRangeDropDown(option: string) { - await this.startedDateRangeDropdown.selectDropdownOption(option); - } - - async setCompletedDateRangeDropDown(option: string) { - await this.completedDateRangeDropdown.selectDropdownOption(option); - } - - async setSuspendedDateRangeWithin(start: Date, end: Date) { - await this.setSuspendedDateRangeDropDown('Date within'); - await this.suspendedDateRangeWithin.setDateRange(start, end); - } - - async getApplicationSelected(): Promise { - const applicationDropdown = $(`[data-automation-id='adf-cloud-edit-process-property-appName']`); - return applicationDropdown.getText(); - } - - async checkAppNamesAreUnique(): Promise { - const appNameList = $$(`${materialLocators.Option.root}[data-automation-id="adf-cloud-edit-process-property-optionsappName"] span`); - const appTextList: any = await appNameList.getText(); - const uniqueArray = appTextList.filter((appName) => { - const sameAppNameArray = appTextList.filter((eachApp) => eachApp === appName); - return sameAppNameArray.length === 1; - }); - return uniqueArray.length === appTextList.length; - } - - async getNumberOfAppNameOptions(): Promise { - await this.appNameDropdown.clickDropdown(); - return this.appNameDropdown.getNumberOfOptions(); - } - - isApplicationListLoaded(): Promise { - const emptyList = $(`[data-automation-id='adf-cloud-edit-process-property-appName'] ${materialLocators.Select.placeholder.class}`); - return BrowserVisibility.waitUntilElementIsNotVisible(emptyList); - } - - async setProcessInstanceId(option: string) { - await this.setProperty('processInstanceId', option); - } - - async setProcessDefinitionKey(option: string) { - await this.setProperty('processDefinitionKey', option); - } - - async setProcessName(option: string) { - await this.setProperty('processName', option); - } - - async setInitiator(value: string) { - await this.peopleCloudComponent.searchAssigneeAndSelect(value); - } - - getProcessInstanceId(): Promise { - return this.getProperty('processInstanceId'); - } - - async getProperty(property: string): Promise { - const locator = $$('input[data-automation-id="adf-cloud-edit-process-property-' + property + '"]').first(); - return BrowserActions.getInputValue(locator); - } - - async setProperty(property: string, option: string): Promise { - const locator = $$('input[data-automation-id="adf-cloud-edit-process-property-' + property + '"]').first(); - await BrowserVisibility.waitUntilElementIsVisible(locator); - await BrowserActions.clearSendKeys(locator, option); - } - - async checkSaveButtonIsDisplayed() { - await BrowserVisibility.waitUntilElementIsVisible(this.saveButton); - } - - async checkSaveAsButtonIsDisplayed() { - await BrowserVisibility.waitUntilElementIsVisible(this.saveAsButton); - } - - async checkDeleteButtonIsDisplayed() { - await BrowserVisibility.waitUntilElementIsVisible(this.deleteButton); - } - - async checkDeleteButtonIsNotDisplayed() { - await BrowserVisibility.waitUntilElementIsNotVisible(this.deleteButton); - } - - async checkSaveButtonIsEnabled(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.saveButton); - return this.saveButton.isEnabled(); - } - - async checkSaveAsButtonIsEnabled(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.saveAsButton); - return this.saveAsButton.isEnabled(); - } - - async checkDeleteButtonIsEnabled(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.deleteButton); - return this.deleteButton.isEnabled(); - } - - async saveAs(name: string) { - await this.clickSaveAsButton(); - await this.editProcessFilterDialog().setFilterName(name); - await this.editProcessFilterDialog().clickOnSaveButton(); - - await browser.driver.sleep(1000); - } - - async clickSaveAsButton() { - await BrowserActions.click(this.saveAsButton); - await browser.driver.sleep(1000); - } - - async clickDeleteButton() { - await BrowserActions.click(this.deleteButton); - } - - async clickSaveButton() { - await BrowserActions.click(this.saveButton); - } - - async setFilter(props: FilterProps) { - await this.openFilter(); - if (props.name) { - await this.setProcessName(props.name); - } - if (props.status) { - await this.setStatusFilterDropDown(props.status); - } - if (props.sort) { - await this.setSortFilterDropDown(props.sort); - } - if (props.order) { - await this.setOrderFilterDropDown(props.order); - } - if (props.initiator) { - await this.setInitiator(props.initiator); - } - if (props.processName) { - await this.setProcessName(props.processName); - } - if (props.suspendedDateRange) { - await this.setSuspendedDateRangeDropDown(props.suspendedDateRange); - } - await this.closeFilter(); - } - - async isCustomFilterNameDisplayed(name: string): Promise { - const title = element(by.cssContainingText(`[id='adf-edit-process-filter-title-id']`, name)); - return BrowserVisibility.waitUntilElementIsVisible(title); - } -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/edit-task-filter-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/edit-task-filter-cloud-component.page.ts deleted file mode 100644 index 0437b0ae8e7..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/edit-task-filter-cloud-component.page.ts +++ /dev/null @@ -1,321 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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, protractor, ElementFinder, $$, $ } from 'protractor'; -import { BrowserVisibility } from '../../core/utils/browser-visibility'; -import { BrowserActions } from '../../core/utils/browser-actions'; -import { DropdownPage } from '../../core/pages/material/dropdown.page'; -import { DataTableComponentPage } from '../../core/pages/data-table-component.page'; -import { PeopleCloudComponentPage } from './people-cloud-component.page'; -import { GroupCloudComponentPage } from './group-cloud-component.page'; -import { DatePickerPage } from '../../core/pages/material/date-picker.page'; -import { materialLocators } from '../../public-api'; - -export type StatusType = 'All' | 'Created' | 'Assigned' | 'Cancelled' | 'Suspended' | 'Completed'; - -export class EditTaskFilterCloudComponentPage { - rootElement = $$('adf-cloud-edit-task-filter').first(); - customiseFilter = $('#adf-edit-task-filter-sub-title-id'); - assignee = $('input[data-automation-id="adf-cloud-edit-task-property-assignee"]'); - priority = $('[data-automation-id="adf-cloud-edit-task-property-priority"]'); - taskName = $('input[data-automation-id="adf-cloud-edit-task-property-taskName"]'); - id = $('input[data-automation-id="adf-cloud-edit-task-property-taskId"]'); - processDefinitionId = $('input[data-automation-id="adf-cloud-edit-task-property-processDefinitionId"]'); - processInstanceId = $('input[data-automation-id="adf-cloud-edit-task-property-processInstanceId"]'); - lastModifiedFrom = $('input[placeholder="LastModifiedFrom"]'); - lastModifiedTo = $('input[placeholder="LastModifiedTo"]'); - parentTaskId = $('input[data-automation-id="adf-cloud-edit-task-property-parentTaskId"]'); - owner = $('input[data-automation-id="adf-cloud-edit-task-property-owner"]'); - saveButton = $('[data-automation-id="adf-filter-action-save"]'); - saveAsButton = $('[data-automation-id="adf-filter-action-saveAs"]'); - deleteButton = $('[data-automation-id="adf-filter-action-delete"]'); - filter = $(`adf-cloud-edit-task-filter ${materialLocators.Expansion.panel.header.root}`); - - appNameDropdown = new DropdownPage($(`${materialLocators.Select.root}[data-automation-id='adf-cloud-edit-task-property-appName']`)); - statusDropdown = new DropdownPage($(`${materialLocators.Select.root}[data-automation-id='adf-cloud-edit-task-property-status']`)); - sortDropdown = new DropdownPage($(`${materialLocators.Select.root}[data-automation-id='adf-cloud-edit-task-property-sort']`)); - priorityDropdown = new DropdownPage(this.priority); - orderDropdown = new DropdownPage($(`${materialLocators.Select.root}[data-automation-id='adf-cloud-edit-task-property-order']`)); - completedDateDropdown = new DropdownPage( - $(`${materialLocators.Select.root}[data-automation-id="adf-cloud-edit-process-property-completedDateRange"]`) - ); - assignmentDropdown = new DropdownPage($(`.adf-task-assignment-filter`)); - processDefinitionNameDropdown = new DropdownPage( - $(`${materialLocators.Select.root}[data-automation-id="adf-cloud-edit-task-property-processDefinitionName"]`) - ); - createdDateRangeDropdown = new DropdownPage( - $(`${materialLocators.Select.root}[data-automation-id='adf-cloud-edit-process-property-createdDateRange']`) - ); - createdDateRangeWithin = new DatePickerPage( - $(`${materialLocators.Datepicker.toggle.root}[data-automation-id='adf-cloud-edit-process-property-date-range-createdDateRange']`) - ); - dueDateRangeDropdown = new DropdownPage($(`${materialLocators.Select.root}[data-automation-id='adf-cloud-edit-process-property-dueDateRange']`)); - dueDateRangeWithin = new DatePickerPage( - $(`${materialLocators.Datepicker.toggle.root}[data-automation-id='adf-cloud-edit-picker-date-range-dueDateRange']`) - ); - - peopleCloudComponent = new PeopleCloudComponentPage(); - groupCloudComponent = new GroupCloudComponentPage(); - - dataTable = new DataTableComponentPage($('adf-cloud-task-list')); - - private expansionPanelExtended = this.rootElement.$(`${materialLocators.Expansion.panel.header.root}${materialLocators.Expanded.class}`); - private content = this.rootElement.$( - `${materialLocators.Expansion.panel.root}${materialLocators.Expansion.panel.expanded} ${materialLocators.Expansion.panel.content.class}` - ); - - async isFilterDisplayed(): Promise { - return BrowserVisibility.waitUntilElementIsVisible(this.filter); - } - - async openFilter(): Promise { - await this.isFilterDisplayed(); - await BrowserActions.click(this.customiseFilter); - await this.checkHeaderIsExpanded(); - } - - async closeFilter(): Promise { - await BrowserActions.click(this.customiseFilter); - await this.checkHeaderIsCollapsed(); - } - - async checkHeaderIsExpanded(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.expansionPanelExtended); - await BrowserVisibility.waitUntilElementIsVisible(this.content); - } - - async checkHeaderIsCollapsed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.expansionPanelExtended, 1000); - await BrowserVisibility.waitUntilElementIsNotVisible(this.content, 1000); - } - - async setStatusFilterDropDown(option: StatusType): Promise { - await this.statusDropdown.selectDropdownOption(option); - await this.dataTable.waitTillContentLoaded(); - } - - async getStatusFilterDropDownValue(): Promise { - return this.statusDropdown.getSelectedOptionText(); - } - - async setSortFilterDropDown(option: string): Promise { - await this.sortDropdown.selectDropdownOption(option); - await this.dataTable.waitTillContentLoaded(); - } - - async getSortFilterDropDownValue(): Promise { - return this.sortDropdown.getSelectedOptionText(); - } - - async setOrderFilterDropDown(option: string): Promise { - await this.orderDropdown.selectDropdownOption(option); - await this.dataTable.waitTillContentLoaded(); - } - - async getOrderFilterDropDownValue(): Promise { - return this.orderDropdown.getSelectedOptionText(); - } - - async setCompleteDateFilterDropDown(option: string): Promise { - await this.completedDateDropdown.selectDropdownOption(option); - await this.dataTable.waitTillContentLoaded(); - } - - async setAssignee(option: string): Promise { - await this.setProperty('assignee', option); - } - - async getAssignee(): Promise { - return BrowserActions.getText(this.assignee); - } - - async setCompletedBy(option: string): Promise { - await this.peopleCloudComponent.searchAssigneeAndSelect(option); - } - - async setPriority(option): Promise { - await this.priorityDropdown.selectDropdownOption(option); - await this.dataTable.waitTillContentLoaded(); - } - - async getPriority(): Promise { - return BrowserActions.getText(this.priority); - } - - async setParentTaskId(option: string): Promise { - await this.setProperty('parentTaskId', option); - } - - async getParentTaskId(): Promise { - return BrowserActions.getText(this.parentTaskId); - } - - async setOwner(option: string): Promise { - await this.setProperty('owner', option); - } - - async getOwner(): Promise { - return BrowserActions.getText(this.owner); - } - - async setLastModifiedFrom(lastModifiedFromDate: string) { - await this.clearField(this.lastModifiedFrom); - await BrowserActions.clearSendKeys(this.lastModifiedFrom, lastModifiedFromDate); - await this.dataTable.waitTillContentLoaded(); - } - - async getLastModifiedFrom(): Promise { - return BrowserActions.getText(this.lastModifiedFrom); - } - - async setLastModifiedTo(lastModifiedToDate: string): Promise { - await this.clearField(this.lastModifiedTo); - await BrowserActions.clearSendKeys(this.lastModifiedTo, lastModifiedToDate); - await this.dataTable.waitTillContentLoaded(); - } - - async getLastModifiedTo(): Promise { - return BrowserActions.getText(this.lastModifiedTo); - } - - async checkSaveButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.saveButton); - } - - async checkSaveAsButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.saveAsButton); - } - - async checkDeleteButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.deleteButton); - } - - async checkSaveButtonIsEnabled(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.saveButton); - return this.saveButton.isEnabled(); - } - - async checkSaveAsButtonIsEnabled(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.saveButton); - return this.saveAsButton.isEnabled(); - } - - async checkDeleteButtonIsEnabled(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.saveButton); - return this.deleteButton.isEnabled(); - } - - async clickSaveAsButton(): Promise { - await BrowserActions.click(this.saveAsButton); - await browser.driver.sleep(1000); - } - - async clickDeleteButton(): Promise { - await BrowserActions.click(this.deleteButton); - await browser.driver.sleep(1000); - } - - async clickSaveButton(): Promise { - await BrowserActions.click(this.saveButton); - } - - async clearAssignee(): Promise { - await BrowserActions.clearWithBackSpace(this.assignee, 250); - await this.dataTable.waitTillContentLoaded(); - } - - async clearField(locator: ElementFinder): Promise { - await BrowserVisibility.waitUntilElementIsVisible(locator); - await BrowserActions.clearWithBackSpace(locator); - } - - async setAppNameDropDown(option: string): Promise { - await this.appNameDropdown.selectDropdownOption(option); - await this.dataTable.waitTillContentLoaded(); - } - - async getAppNameDropDownValue(): Promise { - return this.appNameDropdown.getSelectedOptionText(); - } - - async setCreatedDateRangeDropDown(option: string): Promise { - await this.createdDateRangeDropdown.checkDropdownIsVisible(); - await this.createdDateRangeDropdown.selectDropdownOption(option); - } - - async setCreatedDateRangeWithin(start: Date, end: Date): Promise { - await this.setCreatedDateRangeDropDown('Date within'); - await this.createdDateRangeWithin.setDateRange(start, end); - } - - async setDueDateRangeDropDown(option: string): Promise { - await this.dueDateRangeDropdown.checkDropdownIsVisible(); - await this.dueDateRangeDropdown.selectDropdownOption(option); - } - - async setDueDateRangeWithin(start: Date, end: Date): Promise { - await this.setDueDateRangeDropDown('Date within'); - await this.dueDateRangeWithin.setDateRange(start, end); - } - - async setId(option: string): Promise { - await this.setProperty('taskId', option); - } - - async getId(): Promise { - return BrowserActions.getInputValue(this.id); - } - - async setTaskName(option: string): Promise { - await this.setProperty('taskName', option); - } - - async getTaskName(): Promise { - return BrowserActions.getInputValue(this.taskName); - } - - async setProcessDefinitionId(option: string): Promise { - await this.setProperty('processDefinitionId', option); - } - - async getProcessDefinitionId(): Promise { - return BrowserActions.getInputValue(this.processDefinitionId); - } - - async setProcessInstanceId(option: string): Promise { - await this.setProperty('processInstanceId', option); - } - - async setProcessDefinitionNameDropDown(option: string): Promise { - await browser.waitForAngular(); - await this.processDefinitionNameDropdown.checkDropdownIsVisible(); - await this.processDefinitionNameDropdown.selectDropdownOption(option); - } - - async setProperty(property: string, option: string): Promise { - const locator = $('input[data-automation-id="adf-cloud-edit-task-property-' + property + '"]'); - await BrowserVisibility.waitUntilElementIsVisible(locator); - await locator.clear(); - await locator.sendKeys(option); - await locator.sendKeys(protractor.Key.ENTER); - await this.dataTable.waitTillContentLoaded(); - } - - async getProcessInstanceId(): Promise { - return BrowserActions.getInputValue(this.processInstanceId); - } -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/form/public-api.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/form/public-api.ts deleted file mode 100644 index 0b20864eda0..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/form/public-api.ts +++ /dev/null @@ -1,18 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './widget/public-api'; diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/form/widget/attach-file-widget-cloud.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/form/widget/attach-file-widget-cloud.page.ts deleted file mode 100644 index 4dc1898b6e3..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/form/widget/attach-file-widget-cloud.page.ts +++ /dev/null @@ -1,113 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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, ElementFinder, browser, $ } from 'protractor'; -import { BrowserActions } from '../../../../core/utils/browser-actions'; -import { Logger } from '../../../../core/utils/logger'; -import { BrowserVisibility } from '../../../../core/utils/browser-visibility'; -import { TestElement } from '../../../../core/test-element'; - -export class AttachFileWidgetCloudPage { - - widget: ElementFinder; - filesListLocator: string = 'div[class="adf-file-properties-table-container"]'; - - constructor(fieldId: string) { - this.assignWidget(fieldId); - } - - async isFileTablePropertiesDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.widget.$(this.filesListLocator)); - } - - async getFileAttachedLocatorByContainingText(text: string): Promise { - return this.widget.$(this.filesListLocator).element(by.cssContainingText('span', text)); - } - - assignWidget(fieldId: string): void { - this.widget = $(`adf-form-field div[id='field-${fieldId}-container']`); - } - - async clickAttachContentFile(fileId: string): Promise { - const uploadButton = this.widget.$(`button[id=${fileId}]`); - await BrowserActions.click(uploadButton); - } - - async checkUploadContentButtonIsDisplayed(fileId: string): Promise { - const uploadButton = this.widget.$(`button[id=${fileId}]`); - await BrowserVisibility.waitUntilElementIsVisible(uploadButton); - } - - async checkUploadContentButtonIsNotDisplayed(fileId: string): Promise { - const uploadButton = this.widget.$(`button[id=${fileId}]`); - await BrowserVisibility.waitUntilElementIsNotVisible(uploadButton); - } - - async checkFileIsAttached(name): Promise { - const fileAttached = await this.getFileAttachedLocatorByContainingText(name); - await this.isFileTablePropertiesDisplayed(); - await BrowserVisibility.waitUntilElementIsVisible(fileAttached); - } - - async checkFilesAreAttached(filesName: string[]): Promise { - for (const fileName of filesName) { - await this.checkFileIsAttached(fileName); - } - } - - async checkNoFileIsAttached(): Promise { - const fileItem = new TestElement(this.widget.$(this.filesListLocator).$('table')); - await fileItem.waitNotVisible(); - } - - async checkFileIsNotAttached(name): Promise { - const fileAttached = await this.getFileAttachedLocatorByContainingText(name); - await BrowserVisibility.waitUntilElementIsNotVisible(fileAttached); - } - - async getFileId(name: string): Promise { - const fileAttached = await this.getFileAttachedLocatorByContainingText(name); - return BrowserActions.getAttribute(fileAttached, 'id'); - } - - async clickActionMenu(fileName: string, actionName: string): Promise { - Logger.info('Click action menu'); - await BrowserActions.closeMenuAndDialogs(); - const fileId = await this.getFileId(fileName); - Logger.info(`FileId ${fileId}`); - const optionMenu = this.widget.$(`button[id='${fileId}-option-menu']`); - await BrowserActions.click(optionMenu); - await BrowserActions.waitUntilActionMenuIsVisible(); - await browser.waitForAngular(); - const actionButton = $(`button#${fileId}-${actionName}`); - await BrowserActions.click(actionButton); - await BrowserVisibility.waitUntilElementIsNotVisible(actionButton); - await browser.waitForAngular(); - } - - async removeFile(fileName: string): Promise { - await this.clickActionMenu(fileName, 'remove'); - } - - async downloadFile(fileName: string): Promise { - await this.clickActionMenu(fileName, 'download-file'); - } - - async viewFile(fileName: string): Promise { - await this.clickActionMenu(fileName, 'show-file'); - } -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/form/widget/process-cloud-widget.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/form/widget/process-cloud-widget.page.ts deleted file mode 100644 index ea488f3dc74..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/form/widget/process-cloud-widget.page.ts +++ /dev/null @@ -1,37 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { Widget } from '../../../../core/pages/form/widgets/widget'; -import { PeopleCloudComponentPage } from '../../people-cloud-component.page'; -import { GroupCloudComponentPage } from '../../group-cloud-component.page'; -import { AttachFileWidgetCloudPage } from './attach-file-widget-cloud.page'; - -export class ProcessCloudWidgetPage extends Widget { - - peopleCloudWidget(): PeopleCloudComponentPage { - return new PeopleCloudComponentPage(); - } - - groupCloudWidget(): GroupCloudComponentPage { - return new GroupCloudComponentPage(); - } - - attachFileWidgetCloud(fieldId: string): AttachFileWidgetCloudPage { - return new AttachFileWidgetCloudPage(fieldId); - } - -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/form/widget/public-api.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/form/widget/public-api.ts deleted file mode 100644 index 0b9d6af7f05..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/form/widget/public-api.ts +++ /dev/null @@ -1,18 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './process-cloud-widget.page'; diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/group-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/group-cloud-component.page.ts deleted file mode 100644 index 7a5ba3aba3f..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/group-cloud-component.page.ts +++ /dev/null @@ -1,110 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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, $, ElementFinder, $$ } from 'protractor'; -import { BrowserVisibility } from '../../core/utils/browser-visibility'; -import { BrowserActions } from '../../core/utils/browser-actions'; -import { FormFields } from '../../core/pages/form/form-fields'; -import { TestElement } from '../../core/test-element'; -import { materialLocators } from '../../public-api'; - -export class GroupCloudComponentPage { - groupCloudSearch = $('input[data-automation-id="adf-cloud-group-search-input"]'); - groupField = $('group-cloud-widget .adf-readonly'); - formFields = new FormFields(); - - getGroupRowLocatorByName = async (name: string): Promise => $$(`${materialLocators.Option.root}[data-automation-id="adf-cloud-group-chip-${name}"]`).first(); - - async searchGroups(name: string): Promise { - await BrowserActions.clearSendKeys(this.groupCloudSearch, name, 100); - } - - async searchGroupsToExisting(name: string) { - await BrowserActions.clearSendKeys(this.groupCloudSearch, name, 100); - } - - async getGroupsFieldContent(): Promise { - return BrowserActions.getInputValue(this.groupCloudSearch); - } - - async selectGroupFromList(name: string): Promise { - const groupRow = await this.getGroupRowLocatorByName(name); - - await BrowserActions.click(groupRow); - await BrowserVisibility.waitUntilElementIsNotVisible(groupRow); - } - - async checkGroupIsDisplayed(name: string): Promise { - const groupRow = await this.getGroupRowLocatorByName(name); - await BrowserVisibility.waitUntilElementIsVisible(groupRow); - } - - async checkGroupIsNotDisplayed(name: string): Promise { - const groupRow = await this.getGroupRowLocatorByName(name); - await BrowserVisibility.waitUntilElementIsNotVisible(groupRow); - } - - async checkSelectedGroup(group: string): Promise { - try { - await TestElement.byText(`${materialLocators.Chip.grid.row.root}[data-automation-id*="adf-cloud-group-chip-"]`, group).waitVisible(); - return true; - } catch (e) { - return false; - }; - } - - async checkGroupNotSelected(group: string): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText(`${materialLocators.Chip.grid.row.root}[data-automation-id*="adf-cloud-group-chip-"]`, group))); - } - - async removeSelectedGroup(group: string): Promise { - const locator = $(`${materialLocators.Chip.grid.row.root}[data-automation-id*="adf-cloud-group-chip-${group}"] ${materialLocators.Icon.root}`); - await BrowserActions.click(locator); - } - - async isGroupWidgetVisible(fieldId: string): Promise { - try { - await this.formFields.checkWidgetIsVisible(fieldId); - return true; - } catch { - return false; - } - } - - async checkGroupWidgetIsReadOnly(): Promise { - try { - await BrowserVisibility.waitUntilElementIsVisible(this.groupField); - return true; - } catch { - return false; - } - } - - async checkGroupActiveField(name: string): Promise { - try { - await BrowserActions.clearSendKeys(this.groupField, name); - return true; - } catch { - return false; - } - } - - async checkNoResultsFoundError(): Promise { - const errorLocator = $('[data-automation-id="adf-cloud-group-no-results"]'); - await BrowserVisibility.waitUntilElementIsVisible(errorLocator); - } -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/people-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/people-cloud-component.page.ts deleted file mode 100644 index 218f8758d99..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/people-cloud-component.page.ts +++ /dev/null @@ -1,180 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { Locator, by, element, protractor, $, $$, ElementFinder } from 'protractor'; -import { BrowserVisibility } from '../../core/utils/browser-visibility'; -import { BrowserActions } from '../../core/utils/browser-actions'; -import { FormFields } from '../../core/pages/form/form-fields'; -import { TestElement } from '../../core/test-element'; -import { materialLocators } from '../../public-api'; - -export class PeopleCloudComponentPage { - peopleCloudSearch = $('input[data-automation-id="adf-people-cloud-search-input"]'); - assigneeField = $('input[data-automation-id="adf-people-cloud-search-input"]'); - selectionReady = $('div[data-automation-id="adf-people-cloud-row"]'); - formFields = new FormFields(); - labelLocator: Locator = by.css(`label[class*='adf-label']`); - inputLocator: Locator = by.css('input'); - assigneeChipList = $(`${materialLocators.Chip.grid.root}[data-automation-id="adf-cloud-people-chip-list"]`); - noOfUsersDisplayed = $$(`${materialLocators.Chip.grid.root} span.adf-people-label-name`); - - getAssigneeRowLocatorByContainingName = async (name: string): Promise => element.all(by.cssContainingText(`${materialLocators.Option.root} span.adf-people-label-name`, name)).first(); - - async clearAssignee(): Promise { - await BrowserActions.clearSendKeys(this.peopleCloudSearch, ' '); - await this.peopleCloudSearch.sendKeys(protractor.Key.BACK_SPACE); - } - - async clearAssigneeFromChip(username: string): Promise { - const assigneeChipRemoveIcon = TestElement.byCss(`[data-automation-id="adf-people-cloud-chip-remove-icon-${username}"]`); - await assigneeChipRemoveIcon.click(); - } - - async searchAssigneeAndSelect(name: string): Promise { - await BrowserActions.clearSendKeys(this.peopleCloudSearch, name, 100); - await this.selectAssigneeFromList(name); - } - - async searchAssignee(name: string): Promise { - await BrowserActions.clearSendKeys(this.peopleCloudSearch, name, 100); - } - - async selectAssigneeFromList(name: string): Promise { - const assigneeRow = await this.getAssigneeRowLocatorByContainingName(name); - await BrowserActions.click(assigneeRow); - await BrowserVisibility.waitUntilElementIsNotVisible(assigneeRow); - } - - async getAssignee(): Promise { - return BrowserActions.getInputValue(this.peopleCloudSearch); - } - - async getChipAssignee(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.assigneeChipList); - return this.assigneeChipList.all(by.css(materialLocators.Chip.grid.row.root)).first().getText(); - } - - async getChipAssigneeCount(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.assigneeChipList); - return this.assigneeChipList.all(by.css(materialLocators.Chip.grid.row.root)).count(); - } - - async checkUserIsDisplayed(name: string): Promise { - try { - const assigneeRow = await this.getAssigneeRowLocatorByContainingName(name); - await BrowserVisibility.waitUntilElementIsVisible(assigneeRow); - return true; - } catch { - return false; - } - } - - async checkUserIsNotDisplayed(name: string): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.selectionReady); - const assigneeRow = await this.getAssigneeRowLocatorByContainingName(name); - await BrowserVisibility.waitUntilElementIsNotVisible(assigneeRow); - } - - async getUsersDisplayedCount(): Promise { - return this.noOfUsersDisplayed.count(); - } - - async checkOptionIsDisplayed(): Promise { - const optionList = $('.adf-people-cloud-list'); - await BrowserVisibility.waitUntilElementIsVisible(optionList); - } - - async checkOptionIsNotDisplayed(): Promise { - const optionList = $('.adf-people-cloud-list'); - await BrowserVisibility.waitUntilElementIsNotVisible(optionList); - } - - async checkSelectedPeople(person: string): Promise { - try { - await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText(`${materialLocators.Chip.list.root} ${materialLocators.Chip.root}`, person))); - return true; - } catch (e) { - return false; - } - } - - async getAssigneeFieldContent(): Promise { - return BrowserActions.getInputValue(this.assigneeField); - } - - getFieldLabel(fieldId: string): Promise { - return this.formFields.getFieldLabel(fieldId, this.labelLocator); - } - - getFieldValue(fieldId: string): Promise { - return this.formFields.getFieldValue(fieldId, this.inputLocator); - } - - async isPeopleWidgetVisible(fieldId: string): Promise { - try { - await this.formFields.checkWidgetIsVisible(fieldId); - return true; - } catch { - return false; - } - } - - async checkPeopleWidgetIsHidden(fieldId: string): Promise { - const hiddenElement = $(`adf-form-field div[id='field-${fieldId}-container'][hidden]`); - try { - await BrowserVisibility.waitUntilElementIsNotVisible(hiddenElement); - return true; - } catch { - return false; - } - } - - async clickPeopleInput(fieldId: string): Promise { - const peopleInput = element.all(by.css(`div[id="field-${fieldId}-container"] `)).first(); - await BrowserActions.click(peopleInput); - } - - async checkPeopleWidgetIsReadOnly(): Promise { - const readOnlyAttribute = $('people-cloud-widget .adf-readonly'); - try { - await BrowserVisibility.waitUntilElementIsVisible(readOnlyAttribute); - return true; - } catch { - return false; - } - } - - async checkPeopleActiveField(name: string): Promise { - const activePeopleField = $('people-cloud-widget .adf-readonly'); - try { - await BrowserActions.clearSendKeys(activePeopleField, name); - return true; - } catch { - return false; - } - } - - async checkNoResultsFoundError(): Promise { - try { - await TestElement.byCss('[data-automation-id="adf-people-cloud-no-results"]').waitVisible(); - return true; - } catch (e) { - return false; - } - } - -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/process-filters-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/process-filters-cloud-component.page.ts deleted file mode 100644 index 93ba1e9cb58..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/process-filters-cloud-component.page.ts +++ /dev/null @@ -1,94 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 '../../core/utils/browser-visibility'; -import { BrowserActions } from '../../core/utils/browser-actions'; -import { materialLocators } from '../../public-api'; - -const FILTERS = { - all: 'all-processes', - completed: 'completed-processes', - running: 'running-processes' -}; - -export class ProcessFiltersCloudComponentPage { - - processFilters = $(`${materialLocators.Expansion.panel.root}[data-automation-id='Process Filters']`); - activeFilter = $('.adf-active [data-automation-id="adf-filter-label"]'); - processFiltersList = $('adf-cloud-process-filters'); - - getProcessFilterLocatorByFilterName = (filterName: string): ElementFinder => $(`button[data-automation-id="${filterName}_filter"]`); - - async checkProcessFilterIsDisplayed(filterName: string): Promise { - const filter = this.getProcessFilterLocatorByFilterName(filterName); - await BrowserVisibility.waitUntilElementIsVisible(filter); - } - - async clickProcessFilter(filterName: string): Promise { - const filter = this.getProcessFilterLocatorByFilterName(filterName); - await BrowserActions.click(filter); - } - - async clickAllProcessesFilter(): Promise { - const filter = this.getProcessFilterLocatorByFilterName(FILTERS.all); - await BrowserActions.click(filter); - } - - async clickCompletedProcessesFilter(): Promise { - const filter = this.getProcessFilterLocatorByFilterName(FILTERS.completed); - await BrowserActions.click(filter); - } - - async clickRunningProcessesFilter(): Promise { - const filter = this.getProcessFilterLocatorByFilterName(FILTERS.running); - await BrowserActions.click(filter); - } - - async checkAllProcessesFilterIsDisplayed(): Promise { - const filter = this.getProcessFilterLocatorByFilterName(FILTERS.all); - await BrowserVisibility.waitUntilElementIsVisible(filter); - } - - async checkCompletedProcessesFilterIsDisplayed(): Promise { - const filter = this.getProcessFilterLocatorByFilterName(FILTERS.completed); - await BrowserVisibility.waitUntilElementIsVisible(filter); - } - - async checkRunningProcessesFilterIsDisplayed(): Promise { - const filter = this.getProcessFilterLocatorByFilterName(FILTERS.running); - await BrowserVisibility.waitUntilElementIsVisible(filter); - } - - async checkProcessFilterNotDisplayed(filterName: string): Promise { - const filter = this.getProcessFilterLocatorByFilterName(filterName); - await BrowserVisibility.waitUntilElementIsNotVisible(filter); - } - - async clickOnProcessFilters(): Promise { - await BrowserActions.click(this.processFilters); - } - - async getActiveFilterName(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.activeFilter); - return BrowserActions.getText(this.activeFilter); - } - - async isProcessFiltersListVisible(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.processFiltersList); - } -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/process-header-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/process-header-cloud-component.page.ts deleted file mode 100644 index b2f0ed22932..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/process-header-cloud-component.page.ts +++ /dev/null @@ -1,64 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { $, $$ } from 'protractor'; -import { BrowserActions } from '../../core/utils/browser-actions'; - -export class ProcessHeaderCloudPage { - - idField = $$('[data-automation-id="card-textitem-value-id"]').first(); - nameField = $$('[data-automation-id="card-textitem-value-name"]').first(); - statusField = $('[data-automation-id="card-textitem-value-status"]'); - initiatorField = $('[data-automation-id="card-textitem-value-initiator"]'); - startDateField = $$('span[data-automation-id*="startDate"] span').first(); - lastModifiedField = $$('span[data-automation-id*="lastModified"] span').first(); - parentIdField = $('[data-automation-id="card-textitem-value-parentId"]'); - businessKeyField = $('[data-automation-id="card-textitem-value-businessKey"]'); - - async getId(): Promise { - return BrowserActions.getInputValue(this.idField); - } - - async getName(): Promise { - return BrowserActions.getInputValue(this.nameField); - } - - async getStatus(): Promise { - return BrowserActions.getInputValue(this.statusField); - } - - async getInitiator(): Promise { - return BrowserActions.getInputValue(this.initiatorField); - } - - async getStartDate(): Promise { - return BrowserActions.getText(this.startDateField); - } - - async getLastModified(): Promise { - return BrowserActions.getText(this.lastModifiedField); - } - - async getParentId(): Promise { - return BrowserActions.getInputValue(this.parentIdField); - } - - async getBusinessKey(): Promise { - return BrowserActions.getInputValue(this.businessKeyField); - } - -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/process-list-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/process-list-cloud-component.page.ts deleted file mode 100644 index 2f8865bea86..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/process-list-cloud-component.page.ts +++ /dev/null @@ -1,155 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 '../../core/utils/browser-visibility'; -import { DataTableComponentPage } from '../../core/pages/data-table-component.page'; -import { browser, $, $$ } from 'protractor'; -import { BrowserActions } from '../../core/utils/browser-actions'; -import { DataTableColumnSelector } from '../../core/pages/data-table/columns-selector'; - -export class ProcessListCloudComponentPage { - - columns = { - id: 'Id', - name: 'Process Name', - processDefinitionName: 'Process Definition Name' - }; - - processList = $('adf-cloud-process-list'); - noProcessFound = $$('.adf-empty-content__title').first(); - actionMenu = $('*[role="menu"]'); - optionButton = 'button[data-automation-id*="action_menu_"]'; - - dataTable = new DataTableComponentPage(this.processList); - - getDataTable(): DataTableComponentPage { - return this.dataTable; - } - - selectRow(processName: string): Promise { - return this.dataTable.selectRow(this.columns.name, processName); - } - - selectRowById(processId: string): Promise { - return this.dataTable.selectRow(this.columns.id, processId); - } - - checkRowIsSelectedById(processId: string): Promise { - return this.dataTable.checkRowIsSelected(this.columns.id, processId); - } - - checkRowIsNotSelectedById(processId: string): Promise { - return this.dataTable.checkRowIsNotSelected(this.columns.id, processId); - } - - checkRowIsCheckedById(processId: string): Promise { - return this.dataTable.checkRowIsChecked(this.columns.id, processId); - } - - checkRowIsNotCheckedById(processId: string): Promise { - return this.dataTable.checkRowIsNotChecked(this.columns.id, processId); - } - - checkCheckboxById(processId: string): Promise { - return this.dataTable.clickCheckbox(this.columns.id, processId); - } - - checkContentIsDisplayedByName(processName: string): Promise { - return this.dataTable.checkContentIsDisplayed(this.columns.name, processName); - } - - checkContentIsNotDisplayedByName(processName: string): Promise { - return this.dataTable.checkContentIsNotDisplayed(this.columns.name, processName); - } - - checkContentIsDisplayedByProcessDefinitionName(processDefinition: string): Promise { - return this.dataTable.checkContentIsDisplayed(this.columns.processDefinitionName, processDefinition); - } - - checkContentIsDisplayedById(processId: string): Promise { - return this.dataTable.checkContentIsDisplayed(this.columns.id, processId); - } - - checkContentIsNotDisplayedById(processId: string): Promise { - return this.dataTable.checkContentIsNotDisplayed(this.columns.id, processId); - } - - selectRowWithKeyboard(processId: string): Promise { - return this.dataTable.selectRowWithKeyboard(this.columns.id, processId); - } - - async getAllRowsNameColumn() { - return this.dataTable.getAllRowsColumnValues(this.columns.name); - } - - async checkProcessListIsLoaded(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.processList); - } - - async getNoProcessFoundMessage(): Promise { - return BrowserActions.getText(this.noProcessFound); - } - - getAllRowsByColumn(column: string) { - return this.dataTable.getAllRowsColumnValues(column); - } - - async clickOptionsButton(content: string): Promise { - await BrowserActions.closeMenuAndDialogs(); - const row = this.dataTable.getRow('Id', content); - await browser.sleep(1000); - await BrowserActions.click(row.$(this.optionButton)); - await BrowserVisibility.waitUntilElementIsVisible(this.actionMenu); - } - - async clickOnCustomActionMenu(action: string): Promise { - const actionButton = $(`button[data-automation-id*="${action}"]`); - await BrowserActions.click(actionButton); - } - - async isCustomActionEnabled(action: string): Promise { - const actionButton = $(`button[data-automation-id*="${action}"]`); - return actionButton.isEnabled(); - } - - async rightClickOnRow(processInstance: string): Promise { - await this.dataTable.rightClickOnRow('Id', processInstance); - } - - async clickContextMenuActionNamed(actionName: string): Promise { - await BrowserActions.clickExecuteScript(`button[data-automation-id="context-${actionName}"]`); - } - - async getNumberOfOptions(): Promise { - const options = await this.actionMenu.$$(`button`); - return options.length; - } - - async clickMainMenuButton(): Promise { - await this.dataTable.mainMenuButton.click(); - const columnsSelector = new DataTableColumnSelector(); - await columnsSelector.columnsSelectorComponent.waitVisible(); - return columnsSelector; - } - - async waitTillProcessListContentLoaded(): Promise { - await this.checkProcessListIsLoaded(); - await this.getDataTable().waitForTableBody(); - await this.getDataTable().waitTillContentLoaded(); - } - -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/public-api.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/public-api.ts deleted file mode 100644 index 23a6876ad83..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/public-api.ts +++ /dev/null @@ -1,32 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './start-tasks-cloud-component.page'; -export * from './task-header-cloud-component.page'; -export * from './process-header-cloud-component.page'; -export * from './edit-process-filter-cloud-component.page'; -export * from './edit-task-filter-cloud-component.page'; -export * from './group-cloud-component.page'; -export * from './people-cloud-component.page'; -export * from './process-filters-cloud-component.page'; -export * from './process-list-cloud-component.page'; -export * from './task-filters-cloud-component.page'; -export * from './task-list-cloud-component.page'; -export * from './start-process-cloud-component.page'; -export * from './task-form-cloud-component.page'; -export * from './dialog/public-api'; -export * from './form/public-api'; diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/start-process-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/start-process-cloud-component.page.ts deleted file mode 100644 index c356d653596..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/start-process-cloud-component.page.ts +++ /dev/null @@ -1,137 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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, Key, protractor, browser, ElementFinder, $, $$ } from 'protractor'; -import { BrowserVisibility } from '../../core/utils/browser-visibility'; -import { BrowserActions } from '../../core/utils/browser-actions'; -import { FormFields } from '../../core/pages/form/form-fields'; -import { materialLocators } from '../../public-api'; - -export class StartProcessCloudPage { - - defaultProcessName = $('input[id="processName"]'); - processNameInput = $('[data-automation-id="adf-inplace-input"]'); - selectProcessDropdownArrow = $('button[id="adf-select-process-dropdown"]'); - cancelProcessButton = $('#cancel_process'); - formStartProcessButton = $('button[data-automation-id="adf-form-start process"]'); - startProcessButton = $('button[data-automation-id="btn-start"]'); - startProcessButtonDisabled = $('button[data-automation-id="btn-start"][disabled]'); - noProcess = $('#no-process-message'); - processDefinition = $('input[id="processDefinitionName"]'); - processDefinitionOptionsPanel = $('div[class*="processDefinitionOptions"]'); - - getSelectProcessDropdownLocatorByName = (name: string): ElementFinder => element(by.cssContainingText(materialLocators.Option.text.class, name)); - - async checkNoProcessMessage(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.noProcess); - } - - async pressDownArrowAndEnter(): Promise { - await this.processDefinition.sendKeys(protractor.Key.ARROW_DOWN); - await browser.actions().sendKeys(protractor.Key.ENTER).perform(); - } - - async checkNoProcessDefinitionOptionIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.processDefinitionOptionsPanel); - } - - async enterProcessName(name: string): Promise { - await BrowserActions.clearSendKeys(this.processNameInput, name); - } - - async getProcessName(): Promise { - return BrowserActions.getInputValue(this.processNameInput); - } - - async selectFromProcessDropdown(name: string): Promise { - await this.clickProcessDropdownArrow(); - await this.selectOption(name); - } - - async selectFirstOptionFromProcessDropdown(): Promise { - await this.clickProcessDropdownArrow(); - const selectFirstProcessDropdown = $$('mat-option').first(); - await BrowserActions.click(selectFirstProcessDropdown); - } - - async clickProcessDropdownArrow(): Promise { - await BrowserActions.click(this.selectProcessDropdownArrow); - } - - async checkOptionIsDisplayed(name: string): Promise { - const selectProcessDropdown = this.getSelectProcessDropdownLocatorByName(name); - await BrowserVisibility.waitUntilElementIsVisible(selectProcessDropdown); - await BrowserVisibility.waitUntilElementIsClickable(selectProcessDropdown); - } - - async selectOption(name: string): Promise { - const selectProcessDropdown = this.getSelectProcessDropdownLocatorByName(name); - await BrowserActions.click(selectProcessDropdown); - } - - async clickCancelProcessButton(): Promise { - await BrowserActions.click(this.cancelProcessButton); - } - - async isStartProcessButtonEnabled(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.startProcessButtonDisabled); - await BrowserVisibility.waitUntilElementIsVisible(this.startProcessButton); - await BrowserVisibility.waitUntilElementIsClickable(this.startProcessButton); - - return this.startProcessButton.isEnabled(); - } - - async isStartProcessButtonDisabled(): Promise { - try { - await BrowserVisibility.waitUntilElementIsVisible(this.startProcessButtonDisabled); - return true; - } catch (error) { - return false; - } - } - - async clickStartProcessButton(): Promise { - await BrowserActions.click(this.startProcessButton); - } - - async checkValidationErrorIsDisplayed(error: string, elementRef = 'mat-error'): Promise { - const errorElement = element(by.cssContainingText(elementRef, error)); - await BrowserVisibility.waitUntilElementIsVisible(errorElement); - } - - async blur(locator: ElementFinder): Promise { - await BrowserActions.click(locator); - await locator.sendKeys(Key.TAB); - } - - async clearField(locator: ElementFinder) { - await BrowserVisibility.waitUntilElementIsVisible(locator); - await BrowserActions.clearWithBackSpace(locator); - } - - async startProcessWithProcessDefinition(processName: string, processDefinition: string) { - await this.selectFromProcessDropdown(processDefinition); - await this.enterProcessName(processName); - await BrowserVisibility.waitUntilElementIsNotVisible(this.startProcessButtonDisabled); - await BrowserVisibility.waitUntilElementIsVisible(this.startProcessButton); - await this.clickStartProcessButton(); - } - - formFields(): FormFields { - return new FormFields(); - } -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/start-tasks-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/start-tasks-cloud-component.page.ts deleted file mode 100644 index bf96d5d5479..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/start-tasks-cloud-component.page.ts +++ /dev/null @@ -1,114 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { element, by, Key, ElementFinder, $, $$ } from 'protractor'; -import { BrowserVisibility } from '../../core/utils/browser-visibility'; -import { BrowserActions } from '../../core/utils/browser-actions'; -import { DropdownPage } from '../../core/pages/material/dropdown.page'; -import { materialLocators } from '../../public-api'; - -export class StartTasksCloudPage { - - name = $('input[id="name_id"]'); - dueDate = $('input[id="date_id"]'); - description = $('textarea[id="description_id"]'); - priority = $(`${materialLocators.Select.root}[formcontrolname="priority"]`); - startButton = $('button[id="button-start"]'); - startButtonEnabled = $('button[id="button-start"]:not(disabled)'); - cancelButton = $('button[id="button-cancel"]'); - form = $$('adf-cloud-start-task form').first(); - formDefinitionSelector = $('.adf-form-definition-selector'); - priorityStartTaskField = $('input[formControlName="priority"]'); - - async checkFormIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.form); - } - - async addName(userName: string): Promise { - await BrowserActions.clearSendKeys(this.name, userName); - } - - async addDescription(userDescription: string): Promise { - await BrowserActions.clearSendKeys(this.description, userDescription); - } - - async addPriority(userPriority: string): Promise { - // await BrowserActions.clearSendKeys(this.priority, userPriority); - const priorityDropdown = new DropdownPage(this.priority); - await priorityDropdown.selectDropdownOption(userPriority); - } - - async addDueDate(date: string): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.dueDate); - await BrowserActions.clearSendKeys(this.dueDate, date); - } - - async clickStartButton(): Promise { - await BrowserActions.click(this.startButton); - } - - async checkStartButtonIsEnabled(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.startButtonEnabled); - } - - async checkStartButtonIsDisabled(): Promise { - await BrowserVisibility.waitUntilElementIsVisible($('button[id="button-start"]:disabled')); - } - - async clickCancelButton(): Promise { - await BrowserActions.click(this.cancelButton); - } - - async blur(locator: ElementFinder): Promise { - await BrowserActions.click(locator); - await locator.sendKeys(Key.TAB); - } - - async checkValidationErrorIsDisplayed(error: string, elementRef = materialLocators.Error.root): Promise { - const errorElement = element(by.cssContainingText(elementRef, error)); - await BrowserVisibility.waitUntilElementIsVisible(errorElement); - } - - async validateDate(error: string): Promise { - await this.checkValidationErrorIsDisplayed(error, '.adf-error-text'); - } - - async selectFormDefinition(option: string): Promise { - await BrowserActions.click(this.formDefinitionSelector); - const row = element(by.xpath(`//${materialLocators.Option.root}/child::span [text() = '${option}']`)); - await BrowserActions.click(row); - } - - async checkFormDefinitionIsDisplayed(option: string): Promise { - await BrowserActions.click(this.formDefinitionSelector); - const row = element(by.cssContainingText(`${materialLocators.Option.root} span`, option)); - await BrowserVisibility.waitUntilElementIsVisible(row); - await BrowserActions.closeMenuAndDialogs(); - } - - async checkFormDefinitionIsNotDisplayed(option: string): Promise { - await BrowserActions.click(this.formDefinitionSelector); - const row = element(by.cssContainingText(`${materialLocators.Option.root} span`, option)); - await BrowserVisibility.waitUntilElementIsNotVisible(row); - await BrowserActions.closeMenuAndDialogs(); - } - - async typePriorityOf(priorityValue: string): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.priorityStartTaskField); - await BrowserActions.clearSendKeys(this.priorityStartTaskField, priorityValue); - } -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/task-filters-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/task-filters-cloud-component.page.ts deleted file mode 100644 index b132e3f37ab..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/task-filters-cloud-component.page.ts +++ /dev/null @@ -1,72 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 '../../core/utils/browser-visibility'; -import { BrowserActions } from '../../core/utils/browser-actions'; -import { materialLocators } from '../../public-api'; - -export class TaskFiltersCloudComponentPage { - - filter: ElementFinder; - taskFilters = $(`${materialLocators.Expansion.panel.root}[data-automation-id='Task Filters']`); - activeFilter = $('.adf-active [data-automation-id="adf-filter-label"]'); - - getTaskFilterLocatorByFilterName = async (filterName: string): Promise => $$(`button[data-automation-id="${filterName}_filter"]`).first(); - getFilterCounterLocatorByFilterName = async (filterName: string): Promise => $$(`[data-automation-id="${filterName}_filter-counter"]`).first(); - - async checkTaskFilterIsDisplayed(filterName: string): Promise { - this.filter = await this.getTaskFilterLocatorByFilterName(filterName); - await BrowserVisibility.waitUntilElementIsVisible(this.filter); - } - - async clickTaskFilter(filterName): Promise { - this.filter = await this.getTaskFilterLocatorByFilterName(filterName); - await BrowserVisibility.waitUntilElementIsClickable(this.filter); - await BrowserActions.click(this.filter); - } - - async checkTaskFilterNotDisplayed(filterName: string): Promise { - this.filter = await this.getTaskFilterLocatorByFilterName(filterName); - await BrowserVisibility.waitUntilElementIsNotVisible(this.filter); - } - - async clickOnTaskFilters(): Promise { - await BrowserActions.click(this.taskFilters); - } - - async getActiveFilterName(): Promise { - return BrowserActions.getText(this.activeFilter); - } - - async getTaskFilterCounter(filterName: string): Promise { - const filterCounter = await this.getFilterCounterLocatorByFilterName(filterName); - return BrowserActions.getText(filterCounter); - } - - async checkTaskFilterCounter(filterName: string): Promise { - const filterCounter = await this.getFilterCounterLocatorByFilterName(filterName); - await BrowserVisibility.waitUntilElementHasText(filterCounter, '0'); - } - - async checkNotificationCounterValue(filterName: string, counterValue: string): Promise { - const filterCounter = $(`[data-automation-id="${filterName}_filter-counter"][class*="adf-active"]`); - await BrowserVisibility.waitUntilElementIsVisible(filterCounter); - await BrowserVisibility.waitUntilElementHasText(filterCounter, counterValue); - } - -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/task-form-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/task-form-cloud-component.page.ts deleted file mode 100644 index f6be68e6b12..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/task-form-cloud-component.page.ts +++ /dev/null @@ -1,172 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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, browser, $ } from 'protractor'; -import { BrowserVisibility } from '../../core/utils/browser-visibility'; -import { BrowserActions } from '../../core/utils/browser-actions'; -import { FormFields } from '../../core/pages/form/form-fields'; - -export class TaskFormCloudComponent { - - cancelButton = $('button[id="adf-cloud-cancel-task"]'); - completeButton = $('button[id="adf-form-complete"]'); - releaseButton = $('button[adf-cloud-unclaim-task]'); - saveButton = $('button[id="adf-form-save"]'); - claimButton = $('button[adf-cloud-claim-task]'); - form = $('adf-cloud-form'); - formTitle = $(`span.adf-form-title`); - emptyContentIcon = $(`div.adf-empty-content adf-icon.adf-empty-content__icon`); - emptyContentTitle = $(`div.adf-empty-content div.adf-empty-content__title`); - emptyContentSubtitle = $(`div.adf-empty-content div.adf-empty-content__subtitle`); - readOnlyForm = $('div[class="adf-readonly-form"]'); - - getButtonLocatorByName = (name: string): ElementFinder => $(`button[id="adf-form-${name}"]`); - - async isCompleteButtonEnabled(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.completeButton); - return this.completeButton.isEnabled(); - } - - async checkFormIsReadOnly() { - await BrowserVisibility.waitUntilElementIsVisible(this.readOnlyForm); - } - - async checkFormIsNotReadOnly() { - await BrowserVisibility.waitUntilElementIsNotVisible(this.readOnlyForm); - } - - async checkReleaseButtonIsDisplayed() { - await BrowserVisibility.waitUntilElementIsVisible(this.releaseButton); - } - - async checkReleaseButtonIsNotDisplayed() { - await BrowserVisibility.waitUntilElementIsNotVisible(this.releaseButton); - } - - async checkClaimButtonIsDisplayed() { - await BrowserVisibility.waitUntilElementIsVisible(this.claimButton); - } - - async checkClaimButtonIsNotDisplayed() { - await BrowserVisibility.waitUntilElementIsNotVisible(this.claimButton); - } - - async checkCancelButtonIsDisplayed() { - await BrowserVisibility.waitUntilElementIsVisible(this.cancelButton); - } - - async checkCompleteButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.completeButton); - } - - async checkCompleteButtonIsNotDisplayed() { - await BrowserVisibility.waitUntilElementIsNotVisible(this.completeButton); - } - - async clickCompleteButton(): Promise { - await BrowserActions.click(this.completeButton); - await browser.sleep(500); - } - - async checkAndClickCompleteButton(): Promise { - await this.isCompleteButtonEnabled(); - await this.clickCompleteButton(); - } - - async checkFormOutcomeButtonIsDisplayedByName(name: string): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.getButtonLocatorByName(name)); - } - - async checkFormOutcomeButtonIsNotDisplayedByName(name: string) { - await BrowserVisibility.waitUntilElementIsNotVisible(this.getButtonLocatorByName(name)); - } - - async clickFormOutcomeButtonByName(name: string): Promise { - await BrowserActions.click(this.getButtonLocatorByName(name)); - } - - async clickCancelButton(): Promise { - await BrowserActions.click(this.cancelButton); - } - - async clickClaimButton(): Promise { - await BrowserActions.click(this.claimButton); - } - - async clickReleaseButton(): Promise { - await BrowserActions.click(this.releaseButton); - } - - formFields(): FormFields { - return new FormFields(); - } - - async checkFormIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.form); - } - - async getFormTitle(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.formTitle); - return BrowserActions.getText(this.formTitle); - } - - async checkFormIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.form); - } - - async getReleaseButtonText(): Promise { - return BrowserActions.getText(this.releaseButton); - } - - async checkSaveButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.saveButton); - } - - async clickSaveButton(): Promise { - await BrowserActions.click(this.saveButton); - } - - async checkFormContentIsEmpty(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.emptyContentIcon); - } - - async getEmptyFormContentTitle(): Promise { - return BrowserActions.getText(this.emptyContentTitle); - } - - async getEmptyFormContentSubtitle(): Promise { - return BrowserActions.getText(this.emptyContentSubtitle); - } - - async getCompleteButton(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.completeButton); - return this.completeButton; - } - - async waitTillTaskFormDisplayed(): Promise { - await this.checkFormIsDisplayed(); - await this.formFields().checkFormIsDisplayed(); - } - - async checkFormAndCompleteTask(): Promise { - await this.waitTillTaskFormDisplayed(); - await this.checkCompleteButtonIsDisplayed(); - await this.isCompleteButtonEnabled(); - await this.clickCompleteButton(); - } - -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/task-header-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/task-header-cloud-component.page.ts deleted file mode 100644 index 0c351145978..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/task-header-cloud-component.page.ts +++ /dev/null @@ -1,95 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { $$, $ } from 'protractor'; -import { BrowserActions } from '../../core/utils/browser-actions'; -import { BrowserVisibility } from '../../core/utils/browser-visibility'; -import { CardTextItemPage } from '../../core/pages/card-view/card-view-text-item.page'; -import { CardSelectItemPage } from '../../core/pages/card-view/card-view-select-item.page'; - -export class TaskHeaderCloudPage { - - assigneeCardTextItem = new CardTextItemPage('assignee'); - statusCardTextItem = new CardTextItemPage('status'); - priorityCardSelectItem = new CardSelectItemPage('priority'); - dueDateField = $$('span[data-automation-id*="dueDate"] span').first(); - categoryCardTextItem = new CardTextItemPage('category'); - createdField = $('span[data-automation-id="card-dateitem-created"]'); - parentNameCardTextItem = new CardTextItemPage('parentName'); - parentTaskIdCardTextItem = new CardTextItemPage('parentTaskId'); - endDateField = $$('span[data-automation-id*="endDate"] span').first(); - idCardTextItem = new CardTextItemPage('id'); - descriptionCardTextItem = new CardTextItemPage('description'); - taskPropertyList = $('adf-cloud-task-header adf-card-view .adf-property-list'); - processInstanceIdCardTextItem = new CardTextItemPage('processInstanceId'); - - async getAssignee(): Promise { - return this.assigneeCardTextItem.getFieldValue(); - } - - async getStatus(): Promise { - return this.statusCardTextItem.getFieldValue(); - } - - async getPriority(): Promise { - return this.priorityCardSelectItem.getSelectedOptionText(); - } - - async getReadonlyPriority(): Promise { - return this.priorityCardSelectItem.getReadonlyValue(); - } - - async getCategory(): Promise { - return this.categoryCardTextItem.getFieldValue(); - } - - async getParentName(): Promise { - return this.parentNameCardTextItem.getFieldValue(); - } - - async getParentTaskId(): Promise { - return this.parentTaskIdCardTextItem.getFieldValue(); - } - - async getEndDate(): Promise { - return BrowserActions.getText(this.endDateField); - } - - async getCreated(): Promise { - return BrowserActions.getText(this.createdField); - } - - async getId(): Promise { - return this.idCardTextItem.getFieldValue(); - } - - async getProcessInstanceId(): Promise { - return this.processInstanceIdCardTextItem.getFieldValue(); - } - - async getDescription(): Promise { - return this.descriptionCardTextItem.getFieldValue(); - } - - async getDueDate(): Promise { - return BrowserActions.getText(this.dueDateField); - } - - async checkTaskPropertyListIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.taskPropertyList, 90000); - } -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/task-list-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/task-list-cloud-component.page.ts deleted file mode 100644 index 492274739f7..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/task-list-cloud-component.page.ts +++ /dev/null @@ -1,213 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 '../../core/utils/browser-visibility'; -import { DataTableComponentPage } from '../../core/pages/data-table-component.page'; -import { by, ElementFinder, $$, $ } from 'protractor'; -import { BrowserActions } from '../../core/utils/browser-actions'; -import { DataTableColumnSelector } from '../../core/pages/data-table/columns-selector'; - -const column = { - id: 'Id', - name: 'Task Name', - processInstanceId: 'ProcessInstanceId', - processDefinitionId: 'ProcessDefinitionId', - assignee: 'Assignee', - parentTaskId: 'ParentTaskId', - priority: 'Priority', - standalone: 'Standalone', - owner: 'Owner' -}; - -export class TaskListCloudComponentPage { - - taskList = $('adf-cloud-task-list'); - noTasksFound = $$('.adf-empty-content__title').first(); - actionMenu = $('*[role="menu"]'); - optionButton = 'button[data-automation-id*="action_menu_"]'; - dataTable = new DataTableComponentPage(this.taskList); - - getButtonLocatorByAction = (action: string): ElementFinder => $(`button[data-automation-id*="${action}"]`); - - getDataTable(): DataTableComponentPage { - return this.dataTable; - } - - getStatusByName(taskName: string): Promise { - return this.dataTable.getColumnValueForRow('Name', taskName, 'Status'); - } - - clickCheckbox(taskName: string): Promise { - return this.dataTable.clickCheckbox(column.name, taskName); - } - - checkRowIsNotChecked(taskName: string): Promise { - return this.dataTable.checkRowIsNotChecked(column.name, taskName); - } - - checkRowIsChecked(taskName: string): Promise { - return this.dataTable.checkRowIsChecked(column.name, taskName); - } - - getRowsWithSameName(taskName: string): Promise { - return this.dataTable.getRowsWithSameColumnValues(column.name, taskName); - } - - getRowsWithSameId(taskId: string): Promise { - return this.dataTable.getRowsWithSameColumnValues('Id', taskId); - } - - checkRowIsSelected(taskName: string): Promise { - return this.dataTable.checkRowIsSelected(column.name, taskName); - } - - checkRowIsNotSelected(taskName: string): Promise { - return this.dataTable.checkRowIsNotSelected(column.name, taskName); - } - - selectRowWithKeyboard(taskName: string): Promise { - return this.dataTable.selectRowWithKeyboard(column.name, taskName); - } - - selectRow(taskName: string): Promise { - return this.dataTable.selectRow(column.name, taskName); - } - - selectRowByTaskId(taskId: string): Promise { - return this.dataTable.selectRow(column.id, taskId); - } - - getRow(taskName: string): ElementFinder { - return this.dataTable.getCellElementByValue(column.name, taskName); - } - - async clickMainMenuButton(): Promise { - await this.dataTable.mainMenuButton.click(); - const columnsSelector = new DataTableColumnSelector(); - await columnsSelector.columnsSelectorComponent.waitVisible(); - return columnsSelector; - } - - checkContentIsDisplayedById(taskId: string): Promise { - return this.dataTable.checkContentIsDisplayed(column.id, taskId); - } - - async checkContentIsNotDisplayedById(taskId: string): Promise { - return this.dataTable.checkContentIsNotDisplayed(column.id, taskId); - } - - async checkContentIsDisplayedByProcessInstanceId(taskName: string): Promise { - return this.dataTable.checkContentIsDisplayed(column.processInstanceId, taskName); - } - - async checkContentIsDisplayedByName(taskName: string): Promise { - return this.dataTable.checkContentIsDisplayed(column.name, taskName); - } - - async checkContentIsNotDisplayedByName(taskName: string): Promise { - return this.dataTable.checkContentIsNotDisplayed(column.name, taskName); - } - - async checkTaskListIsLoaded(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.taskList); - } - - async checkTaskListAndContentAreLoaded(): Promise { - await this.checkTaskListIsLoaded(); - await this.getDataTable().waitTillContentLoaded(); - } - - async getNoTasksFoundMessage(): Promise { - return BrowserActions.getText(this.noTasksFound); - } - - async checkNoTasksFoundMessageIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.noTasksFound); - } - - async getAllRowsNameColumn() { - return this.dataTable.getAllRowsColumnValues(column.name); - } - - async getAllRowsByIdColumn() { - return this.dataTable.getAllRowsColumnValues(column.id); - } - - async getAllRowsByProcessDefIdColumn() { - return this.dataTable.getAllRowsColumnValues(column.processDefinitionId); - } - - async getAllRowsByProcessInstanceIdColumn() { - return this.dataTable.getAllRowsColumnValues(column.processInstanceId); - } - - async getAllRowsByAssigneeColumn() { - return this.dataTable.getAllRowsColumnValues(column.assignee); - } - - async getAllRowsByParentTaskIdColumn() { - return this.dataTable.getAllRowsColumnValues(column.parentTaskId); - } - - async getAllRowsByPriorityColumn() { - return this.dataTable.getAllRowsColumnValues(column.priority); - } - - async getAllRowsByStandAloneColumn() { - return this.dataTable.getAllRowsColumnValues(column.standalone); - } - - async getAllRowsByOwnerColumn() { - return this.dataTable.getAllRowsColumnValues(column.owner); - } - - async getIdCellValue(rowName: string): Promise { - const locator = new DataTableComponentPage().getCellByRowContentAndColumn(column.name, rowName, column.id); - return BrowserActions.getText(locator); - } - - async clickOptionsButton(content: string) { - await BrowserActions.closeMenuAndDialogs(); - const row = this.dataTable.getRow('Id', content); - await BrowserActions.click(row.$(this.optionButton)); - await BrowserVisibility.waitUntilElementIsVisible(this.actionMenu); - } - - async clickOnCustomActionMenu(action: string): Promise { - const actionButton = this.getButtonLocatorByAction(action); - await BrowserActions.click(actionButton); - } - - async isCustomActionEnabled(action: string): Promise { - const actionButton = this.getButtonLocatorByAction(action); - return actionButton.isEnabled(); - } - - async rightClickOnRow(taskId: string): Promise { - await this.dataTable.rightClickOnRow('Id', taskId); - } - - async clickContextMenuActionNamed(actionName: string): Promise { - await BrowserActions.clickExecuteScript(`button[data-automation-id="context-${actionName}"]`); - } - - async getNumberOfOptions(): Promise { - const options = await this.actionMenu.all(by.css(`button`)); - return options.length; - } - -} diff --git a/lib/testing/src/lib/protractor/process-services-cloud/public-api.ts b/lib/testing/src/lib/protractor/process-services-cloud/public-api.ts deleted file mode 100644 index dbea8b60dbb..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/public-api.ts +++ /dev/null @@ -1,21 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './pages/public-api'; -export * from './actions/public-api'; -export * from './app/public-api'; -export * from './resources/resources'; diff --git a/lib/testing/src/lib/protractor/process-services-cloud/resources/resources.ts b/lib/testing/src/lib/protractor/process-services-cloud/resources/resources.ts deleted file mode 100644 index c14990ac83c..00000000000 --- a/lib/testing/src/lib/protractor/process-services-cloud/resources/resources.ts +++ /dev/null @@ -1,492 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -/* eslint-disable @cspell/spellchecker */ -/* eslint-disable @typescript-eslint/naming-convention */ - -export const ACTIVITI_CLOUD_APPS = { - CANDIDATE_BASE_APP: { - name: 'candidatebaseapp', - file_location: 'https://github.com/Alfresco/alfresco-ng2-components/blob/develop/e2e/resources/activiti7/candidatebaseapp.zip?raw=true', - processes: { - candidateUserProcess: 'candidateuserprocess', - candidateGroupProcess: 'candidategroupprocess', - anotherCandidateGroupProcess: 'anothercandidategroup', - uploadFileProcess: 'uploadfileprocess', - processwithstarteventform: 'processwithstarteventform', - processwithjsonfilemapping: 'processwithjsonfilemapping', - assigneeProcess: 'assigneeprocess', - candidateusersgroups: 'candidateusersgroups', - paralleltasks: 'paralleltasks', - errorStartEventProcess: { - process_name: 'errorstartevent', - error_id: 'Error_END_EVENT', - error_code: '123' - }, - errorBoundaryEventProcess: { - process_name: 'errorboundaryevent', - error_id: 'Error_END_EVENT', - error_code: '567' - }, - errorExclusiveGateProcess: { - process_name: 'errorexclusivegate', - error_id: 'Error_OK', - error_code: '200' - } - }, - processVariables: { - processWithStartEventForm: { - processJson: { test: 'ciao' } - } - }, - forms: { - starteventform: 'starteventform', - formtotestvalidations: 'formtotestvalidations', - uploadfileform: 'uploadfileform', - inputForm: { - name: 'inputform', - widgets: { - inputJsonId: 'inputjson', - inputFile: 'inputfile' - } - }, - outputForm: { - name: 'outputform', - widgets: { - outputJson: 'outputjson', - outputFile: 'outputfile' - } - } - }, - security: [ - { - role: 'ACTIVITI_ADMIN', - groups: [], - users: ['superadminuser', 'processadminuser'] - }, - { - role: 'ACTIVITI_USER', - groups: ['hr', 'testgroup'], - users: ['hruser', 'salesuser'] - } - ], - tasks: { - uploadFileTask: 'UploadFileTask', - candidateUserTask: 'candidateUserTask', - salesUserTask: 'salesuser task', - hrUserTask: 'hruser task', - firstTaskMapping: 'firsttaskmapping', - secondTaskMapping: 'secondtaskmapping' - } - }, - SIMPLE_APP: { - name: 'simpleapp', - file_location: 'https://github.com/Alfresco/alfresco-ng2-components/blob/develop/e2e/resources/activiti7/simpleapp.zip?raw=true', - processes: { - processwithvariables: 'processwithvariables', - simpleProcess: 'simpleprocess', - dropdownOptionsProcess: 'dropdownoptionsprocess', - multilingualprocess: 'multilingualprocess', - processWithTabVisibility: 'processwithtabvisibility', - startmessageevent: 'start-message-event', - intermediatemessageevent: 'intermediate-message-event', - intboundaryevent: 'int-boundary-event', - nonintboundaryevent: 'nonint-boundary-event', - intboundarysubprocess: 'int-boundary-subprocess', - intstartmessageevent: 'int-start-message-event', - nonintstartmessageevent: 'nonint-start-message-event', - siblingtaskprocess: 'siblingtaskprocess', - startTaskVisibilityForm: 'start-task-visibility-form', - startVisibilityForm: 'start-visibility-form', - processstring: 'processstring', - processinteger: 'processinteger', - processboolean: 'processboolean', - processdate: 'processdate', - multiprocess: 'multiprocess', - terminateexclusive: 'terminate-exclusive', - terminatesubprocess: 'terminate-subprocess', - multiinstancedmnparallel: 'multiinstance-dmnparallel', - multiinstancecallactivity: 'multiinstance-callactivity', - multiinstancecollection: 'multiinstance-collection', - multiinstancecompletion: 'multiinstance-completion', - multiinstancesequential: 'multiinstance-sequential', - multiinstanceservicetask: 'multiinstance-servicetask', - multiinstanceusertask: 'multiinstance-usertask', - multiinstancedmnsequence: 'multiinstance-dmnsequence', - multiinstancemanualtask: 'multiinstance-manualtask', - multiinstancesubprocess: 'multiinstance-subprocess', - 'multiselect-dropdown': 'multiselect-dropdown', - 'dropdown-search': 'dropdown-search', - calledprocess: 'calledprocess', - booleanvisibilityprocess: 'booleanvisibilityprocess', - numbervisibilityprocess: 'numbervisibilityprocess', - processformoutcome: 'outcomebuttons', - uploadSingleMultipleFiles: 'upload-single-multiple-pro', - processDisplayRestJson: 'process-display-rest-json', - poolStartEndMessageThrow: 'pool-start-end-mess-throw', - poolStartEndMessageCatch: 'pool-start-end-mess-catch', - poolProcessCalled: 'pool-process-called', - poolProcessCalling: 'pool-process-calling', - poolNonIntBoundaryThrown: 'pool-nonint-boundary-throw', - poolNonIntBoundaryCatch: 'pool-nonint-boundary-catch', - poolIntermediateMessageThrow: 'pool-interm-message-throw', - poolIntermediateMessageCatch: 'pool-interm-message-catch', - poolInterruptingBoundarySubprocessThrow: 'pool-int-bound-subpr-throw', - poolInterruptingBoundarySubprocessCatch: 'pool-int-bound-subpr-catch', - poolInterruptingBoundaryThrow: 'pool-int-boundary-throw', - poolInterruptingBoundaryCatch: 'pool-int-boundary-catch', - attachFilesProcess: 'attach-files-process', - attachFileVisible: 'attach-file-visible', - attachFileInvisible: 'attach-file-invisible', - attachLocalFile: 'attach-local-file', - attachLocalFileOnTask: 'attach-local-file-on-task', - attachSingleMultiple: 'attach-single-multiple', - attachMultipleSingle: 'attach-multiple-single', - attachMultipleMultiple: 'attach-multiple-multiple', - intermediateDateProcessVarTimer: 'interm-date-provar-timer', - callActivityExpressionSimple: 'call-activity-exp-simple', - callActivityExpressionFromPool: 'call-activity-expression-2', - calledSimple: 'called-simple', - calledInPool: 'called-in-pool', - paralleltasks: 'paralleltasks', - candidateUsersGroup: 'candidateusersgroup', - candidateUserProcess: 'candidateuserprocess', - outputVariablesMapping: 'output-variables-mapping', - outcomeVisibilityProcess: 'outcome-visib-process', - restConnectorProcess: 'rest-connector-process', - withDisplayedVariables: 'with-displayed-variables', - withDisplayedVariables2: 'with-displayed-variables-2' - }, - processesData: { - withDisplayedVariables: { - variablesColumns: [ - { name: 'Column. A', value: 'Value A' }, - { name: 'Column B !@#$%^&*()_', value: '123' }, - { name: 'Column C', value: 'Nov 3, 2033' }, - { name: 'Column D', value: 'Oct 16, 2024' }, - { name: 'Column E', value: 'false' } - ] - }, - withDisplayedVariables2: { - variablesColumns: [ - { name: 'Column. A', value: 'Oct 26, 2023' }, - { name: 'Column B !@#$%^&*()_', value: 'Mar 12, 2037' }, - { name: 'Column C', value: 'true' }, - { name: 'Column D', value: '456' }, - { name: 'Column E', value: 'Value E' } - ] - } - }, - forms: { - tabVisibilityFields: { - name: 'tabvisibilitywithfields' - }, - formWithSingleInput: { - name: 'form-with-single-input' - }, - tabVisibilityVars: { - name: 'tabvisibilitywithvars', - tabs: { - tabWithFields: 'tabWithFields', - tabVarVar: 'tabBasicVarVar', - tabBasicVarField: 'tabBasicVarField' - }, - widgets: { - textOneId: 'TextOne', - textThreeId: 'TextThree', - numberOneId: 'NumberOne' - } - }, - usertaskform: { - name: 'usertaskform' - }, - dropdownform: { - name: 'dropdownform' - }, - formVisibility: { - name: 'form-visibility', - widgets: { - textOneId: 'Text', - textTwoId: 'Multilinetext' - } - }, - multilingualform: { - name: 'multilingualform' - }, - inputform: { - name: 'inputform', - widgets: { - inputText: 'inputText', - inputNumber: 'inputNumber', - inputDate: 'inputDate', - inputCheckbox: 'inputCheckbox', - outputText: 'outputText', - outputNumber: 'outputNumber', - outputDate: 'outputDate', - outputCheckbox: 'outputCheckbox' - } - }, - outputform: { - name: 'outputform' - }, - exclusiveconditionform: { - name: 'exclusive-condition-form', - widgets: { - exclusiveCondition: 'exclusiveCondition' - } - }, - uploadlocalfileform: { - name: 'upload-localfile-form' - }, - booleanvisibility: { - name: 'booleanvisibility' - }, - requirednumbervisibility: { - name: 'requirednumbervisibility' - }, - mealform: { - name: 'mealform', - widgets: { - inputMeal: 'meal' - } - }, - resultcollectionform: { - name: 'resultcollectionform', - widgets: { - resultCollection1: 'result1', - resultCollection2: 'result2', - resultCollection3: 'result3' - } - }, - uploadSingleMultiple: { - name: 'upload-single-multiple', - widgets: { - contentMultipleAttachFileId: 'UploadMultipleFileFromContentId', - contentSingleAttachFileId: 'UploadSingleFileFromContentId' - } - }, - formWithJsonWidget: { - name: 'form-with-json-widget', - widgets: { - displayJsonWidgetId: 'DisplayJsonWidgetId' - } - }, - formWithAllWidgets: { - name: 'form-with-all-widgets' - }, - poolForm: { - name: 'pool-usertaskform', - widgets: { - // eslint-disable-next-line id-blacklist - string: 'Text0rfn8p' - } - }, - attachFilesForm: { - name: 'attach-files', - attachFileWidget1: 'Attachfile09lgsk', - attachFileWidget2: 'Attachfile0wopvy' - }, - attachFileVisible: { - name: 'attach-file-visible', - textField: 'Text0t9anw', - attachFileWidget1: 'Attachfile0tccnd', - attachFileWidget2: 'Attachfile08cfo7' - }, - attachFileInvisible: { - name: 'attach-file-invisible', - textField: 'Text0nmwr7', - attachFileWidget1: 'Attachfile0l72dj', - attachFileWidget2: 'Attachfile0lccsg' - }, - attachLocalFile: { - name: 'attach-local-file', - attachFileWidget1: 'Attachfile0ku0bu', - attachFileWidget2: 'Attachfile04mfeb', - attachFileLocalChildFolder: 'Attachfilelocalchildfolder', - attachFileContentServices: 'Attachfilecontentservices', - attachFileLocalMultiple: 'Attachfilelocalmultiple', - attachFileInvalidPath: 'Attachfileinvalidpath' - }, - attachSingleMultiple: { - name: 'attach-single-multiple', - attachFileWidget1: 'Attachfile0ciulc', - attachFileWidget2: 'Attachfile006uf2' - }, - attachMultipleSingle: { - name: 'attach-multiple-single', - attachFileWidget1: 'Attachfile0whgiz', - attachFileWidget2: 'Attachfile0jpfi9' - }, - attachMultipleMultiple: { - name: 'attach-multiple-multiple', - attachFileWidget1: 'Attachfile07sqao', - attachFileWidget2: 'Attachfile018wvc' - }, - dateTimerForm: { - name: 'date-timer-form' - }, - callActivityUserTaskForm: { - name: 'call-activ-user-task-form' - }, - calledForm: { - name: 'called-form' - }, - outcomeVisibilityForm: { - name: 'outcome-visibility', - textWidget: 'TextForOutcome', - validAnswerOutcome: 'Valid answer', - invalidAnswerOutcome: 'Invalid answer', - answerTheQuestion: 'You should answer the question' - }, - dropdownWithOptions: { - name: 'dropdown-options', - options: [ - { - id: 'empty', - name: 'Choose one...' - }, - { - id: 'option_1', - name: 'option1' - }, - { - id: 'option_2', - name: 'option2' - }, - { - id: 'option_3', - name: 'option3' - } - ] - }, - correlationKey: { - name: 'correlation-key-form', - widgets: { - setCorrelationKey: 'correlationKey' - } - } - }, - tasks: { - processstring: 'inputtask', - uploadSingleMultipleFiles: 'UploadSingleMultipleFiles', - candidateusersandgrouptask: 'candidate users and group', - candidateUserTask: 'candidateUserTask', - salesUserTask: 'salesuser task', - hrUserTask: 'hruser task', - attachLocalFile: 'attach local file', - userTaskToShowRestResult: 'UserTaskToShowRestResult', - conditionTask: 'ConditionTask', - userTask: 'UserTask', - terminateTask: 'TerminateTask', - mainTask: 'MainTask', - followingTask: 'FollowingTask', - catchTask: 'catchtask', - calledTask: 'calledtask', - throwTask: 'throwtask', - interruptingBoundaryTask: 'int-boundary-task', - nonInterruptingBoundaryTask: 'nonint-boundary-task', - subprocessInterruptingTask: 'subprocess-task', - finalTask: 'final-task', - finalTaskUnited: 'finaltask', - withDisplayedVariables: 'with-displayed-variables', - withDisplayedVariables2: 'with-displayed-variables-2' - }, - security: [ - { - role: 'ACTIVITI_ADMIN', - groups: [], - users: ['superadminuser', 'processadminuser'] - }, - { - role: 'ACTIVITI_USER', - groups: ['hr', 'sales', 'testgroup'], - users: ['hruser'] - } - ], - infrastructure: { connectors: { restconnector: {} }, bridges: {} }, - connectors: { - restConnector: { - response: { - userId: 1, - id: 1, - title: 'delectus aut autem', - completed: false - } - } - } - }, - SUB_PROCESS_APP: { - name: 'subprocessapp', - file_location: 'https://github.com/Alfresco/alfresco-ng2-components/blob/develop/e2e/resources/activiti7/subprocessapp.zip?raw=true', - processes: { - processchild: 'processchild', - processparent: 'processparent' - }, - contentModels: { - contentmodelalltypes: { - name: 'contentmodelalltypes', - singleCustomType: { - name: 'singleCustomType', - properties: { - textProperty: 'customtypetext', - longProperty: 'customtypelong', - intProperty: 'customtypeint', - mltextProperty: 'customtypemltext', - booleanProperty: 'customtypeboolean', - floatProperty: 'customtypefloat', - doubleProperty: 'customtypedouble', - dateProperty: 'customtypedate', - datetimeProperty: 'customtypedatetime' - } - }, - singleCustomAspect: { - name: 'singleCustomAspect', - properties: { - textProperty: 'aspecttext', - longProperty: 'aspectlong', - intProperty: 'aspectint', - mltextProperty: 'aspectmltext', - booleanProperty: 'aspectboolean', - floatProperty: 'aspectfloat', - doubleProperty: 'aspectdouble', - dateProperty: 'aspectdate', - datetimeProperty: 'aspectdatetime' - } - } - }, - contentmodelonlytypes: { - name: 'contentmodelonlytypes', - customType1: { - name: 'customType', - properties: { - textProperty: 'text', - dateProperty: 'date', - datetimeProperty: 'datetime' - } - } - } - }, - security: [ - { role: 'ACTIVITI_ADMIN', groups: [], users: ['superadminuser'] }, - { - role: 'ACTIVITI_USER', - groups: ['hr', 'testgroup'], - users: ['hruser'] - } - ] - } -}; diff --git a/lib/testing/src/lib/protractor/process-services/actions/applications.util.ts b/lib/testing/src/lib/protractor/process-services/actions/applications.util.ts deleted file mode 100644 index 6686329a7ce..00000000000 --- a/lib/testing/src/lib/protractor/process-services/actions/applications.util.ts +++ /dev/null @@ -1,114 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { Logger } from '../../core/utils/logger'; -import { browser } from 'protractor'; -import { ApiService } from '../../../shared/api/api.service'; -import { - AppDefinitionRepresentation, - AppDefinitionsApi, - RuntimeAppDefinitionsApi, - AppDefinitionUpdateResultRepresentation -} from '@alfresco/js-api'; -import * as path from 'path'; -import * as fs from 'fs'; - -export class AppPublish { - comment: string = ''; - force: boolean = true; -} - -export class ApplicationsUtil { - - api: ApiService; - appsApi: RuntimeAppDefinitionsApi; - appDefinitionsApi: AppDefinitionsApi; - - constructor(apiService: ApiService) { - this.api = apiService; - this.appsApi = new RuntimeAppDefinitionsApi(apiService.getInstance()); - this.appDefinitionsApi = new AppDefinitionsApi(apiService.getInstance()); - } - - async getAppDefinitionId(appModelId: number): Promise { - const appDefinitions = await this.appsApi.getAppDefinitions(); - let appDefinitionId = -1; - - appDefinitions.data.forEach((appDefinition) => { - if (appDefinition.modelId === appModelId) { - appDefinitionId = appDefinition.id; - } - }); - - return appDefinitionId; - } - - async publishDeployApp(appId: number): Promise { - const publishApp = await this.appDefinitionsApi.publishAppDefinition(appId, new AppPublish()); - - await this.appsApi.deployAppDefinitions({ appDefinitions: [{ id: publishApp.appDefinition.id }] }); - - return publishApp; - } - - async importPublishDeployApp(appFileLocation: string, option = {}): Promise { - try { - const appCreated = await this.importApplication(appFileLocation, option); - const publishApp = await this.publishDeployApp(appCreated.id); - await this.appsApi.deployAppDefinitions({ appDefinitions: [{ id: publishApp.appDefinition.id }] }); - - return appCreated; - } catch (error) { - Logger.error('Import Publish Deploy Application - Service error, Response: ', JSON.stringify(error)); - return {}; - } - } - - async importNewVersionAppDefinitionPublishDeployApp(appFileLocation: string, modelId: number): Promise { - const pathFile = path.join(browser.params.testConfig.main.rootPath + appFileLocation); - const file = fs.createReadStream(pathFile); - - const appCreated = await this.appDefinitionsApi.updateAppDefinition(modelId, file); - - const publishApp = await this.appDefinitionsApi.publishAppDefinition(appCreated.id, new AppPublish()); - - await this.appsApi.deployAppDefinitions({ appDefinitions: [{ id: publishApp.appDefinition.id }] }); - - return appCreated; - } - - async importApplication(appFileLocation: string, options = {}): Promise { - try { - const file = fs.createReadStream(appFileLocation); - return await this.appDefinitionsApi.importAppDefinition(file, options); - } catch (error) { - Logger.error('Import Application - Service error, Response: ', JSON.parse(JSON.stringify(error))?.response?.text); - return {}; - } - } - - async getAppDefinitionByName(appName: string): Promise { - try { - const appDefinitionsList = await this.appsApi.getAppDefinitions(); - return appDefinitionsList.data.find((currentApp) => currentApp.name === appName); - } catch (error) { - Logger.error('Get AppDefinitions - Service error, Response: ', JSON.parse(JSON.stringify(error))?.response?.text); - return {}; - } - } - -} diff --git a/lib/testing/src/lib/protractor/process-services/actions/integration.service.ts b/lib/testing/src/lib/protractor/process-services/actions/integration.service.ts deleted file mode 100644 index 882e3c4ac8c..00000000000 --- a/lib/testing/src/lib/protractor/process-services/actions/integration.service.ts +++ /dev/null @@ -1,52 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { ApiService } from '../../../shared/api/api.service'; -import { E2eRequestApiHelper } from '../../../shared/api/e2e-request-api.helper'; -import { Logger } from '../../core/utils/logger'; - -export class IntegrationService { - api: ApiService; - requestApiHelper: E2eRequestApiHelper; - - constructor(apiService: ApiService) { - this.api = apiService; - this.requestApiHelper = new E2eRequestApiHelper(apiService); - } - - async addCSIntegration({ name, tenantId, host }): Promise { - const repository = { - name, - tenantId, - alfrescoTenantId: '', - repositoryUrl: `${host}/alfresco`, - shareUrl: `${host}/share`, - version: '6.1.1', - authenticationType: 'basic' - }; - - try { - await this.requestApiHelper.post('activiti-app/app/rest/integration/alfresco', { bodyParam: repository }); - } catch (e) { - Logger.error(e); - } - } - - async authenticateRepository(id: number, body: { username: string; password: string }): Promise { - await this.requestApiHelper.post(`activiti-app/app/rest/integration/alfresco/${id}/account`, { bodyParam: body }); - } -} diff --git a/lib/testing/src/lib/protractor/process-services/actions/models.service.ts b/lib/testing/src/lib/protractor/process-services/actions/models.service.ts deleted file mode 100644 index 259d037bdfb..00000000000 --- a/lib/testing/src/lib/protractor/process-services/actions/models.service.ts +++ /dev/null @@ -1,59 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { Logger } from '../../core/utils/logger'; -import { ApiService } from '../../../shared/api/api.service'; -import { ModelsApi } from '@alfresco/js-api'; -import { ResultListDataRepresentationModelRepresentation } from '@alfresco/js-api/typings/src/api/activiti-rest-api/model/resultListDataRepresentationModelRepresentation'; - -export class ModelsActions { - - api: ApiService; - modelsApi: ModelsApi; - - constructor(api: ApiService) { - this.api = api; - this.modelsApi = new ModelsApi(api.getInstance()); - } - - async deleteModel(modelId): Promise { - try { - return await this.modelsApi.deleteModel(modelId, { cascade: false, deleteRuntimeApp: true }); - } catch (error) { - Logger.error('Delete Model Version - Service error, Response: ', JSON.parse(JSON.stringify(error))?.response?.text); - } - } - - async deleteEntireModel(modelId): Promise { - try { - return await this.modelsApi.deleteModel(modelId, { cascade: true, deleteRuntimeApp: true }); - } catch (error) { - Logger.error('Delete Model - Service error, Response: ', JSON.parse(JSON.stringify(error))?.response?.text); - } - } - - async getModels(opts: any): Promise { - const options = opts || {}; - let models; - try { - models = await this.modelsApi.getModels(options); - } catch (error) { - Logger.error('Get Models - Service error, Response: ', JSON.parse(JSON.stringify(error))?.response?.text); - } - return models; - } -} diff --git a/lib/testing/src/lib/protractor/process-services/actions/process.util.ts b/lib/testing/src/lib/protractor/process-services/actions/process.util.ts deleted file mode 100644 index 554e2f19a08..00000000000 --- a/lib/testing/src/lib/protractor/process-services/actions/process.util.ts +++ /dev/null @@ -1,127 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { ApplicationsUtil } from './applications.util'; -import { Logger } from '../../core/utils/logger'; -import { StringUtil } from '../../../shared/utils/string.util'; -import { ApiService } from '../../../shared/api/api.service'; -import { - ProcessDefinitionsApi, ProcessInstanceRepresentation, ProcessInstancesApi, TaskRepresentation, TasksApi, ProcessDefinitionRepresentation, - ResultListDataRepresentationProcessInstanceRepresentation -} from '@alfresco/js-api'; - -export class ProcessUtil { - - api: ApiService; - processInstancesApi: ProcessInstancesApi; - processDefinitionsApi: ProcessDefinitionsApi; - applicationsUtil: ApplicationsUtil; - tasksApi: TasksApi; - - constructor(apiService: ApiService) { - this.api = apiService; - this.processInstancesApi = new ProcessInstancesApi(apiService.getInstance()); - this.processDefinitionsApi = new ProcessDefinitionsApi(apiService.getInstance()); - this.applicationsUtil = new ApplicationsUtil(apiService); - this.tasksApi = new TasksApi(apiService.getInstance()); - } - - async startProcessByDefinitionName(appName: string, processDefinitionName: string, processName?: string): Promise { - try { - const appDefinition = await this.applicationsUtil.getAppDefinitionByName(appName); - const processDefinition = await this.getProcessDefinitionByName(appDefinition.deploymentId, processDefinitionName); - - return this.processInstancesApi.startNewProcessInstance({ - processDefinitionId: processDefinition.id, - name: processName ? processName : processDefinitionName + StringUtil.generateRandomString(5).toLowerCase() - }); - } catch (error) { - Logger.error('Start Process - Service error, Response: ', JSON.parse(JSON.stringify(error))); - return null; - } - } - - async startProcessByDefinitionNameWithFormValues(appName: string, processDefinitionName: string, values: any, processName?: string): Promise { - try { - const appDefinition = await this.applicationsUtil.getAppDefinitionByName(appName); - const processDefinition = await this.getProcessDefinitionByName(appDefinition.deploymentId, processDefinitionName); - - const startProcessOptions = { - processDefinitionId: processDefinition.id, - name: processName ? processName : processDefinitionName + StringUtil.generateRandomString(5).toLowerCase(), - values - }; - - return this.processInstancesApi.startNewProcessInstance(startProcessOptions); - } catch (error) { - Logger.error('Start Process - Service error, Response: ', JSON.parse(JSON.stringify(error))); - return null; - } - } - - async startProcessOfApp(appName: string, processName?: string): Promise { - try { - const appDefinition = await this.applicationsUtil.getAppDefinitionByName(appName); - const processDefinitionList = await this.processDefinitionsApi.getProcessDefinitions({ deploymentId: appDefinition.deploymentId }); - const startProcessOptions = { processDefinitionId: processDefinitionList.data[0].id, name: processName ? processName : StringUtil.generateRandomString(5).toLowerCase() }; - return this.processInstancesApi.startNewProcessInstance(startProcessOptions); - } catch (error) { - Logger.error('Start Process - Service error, Response: ', JSON.parse(JSON.stringify(error))); - return null; - } - } - - async cancelProcessInstance(processInstance: string): Promise { - try { - return this.processInstancesApi.deleteProcessInstance(processInstance); - } catch (error) { - Logger.error('Cancel Process - Service error, Response: ', JSON.parse(JSON.stringify(error))); - } - } - - async getProcessDefinitionByName(deploymentId: string, processName: string): Promise { - try { - const processDefinitionList = await this.processDefinitionsApi.getProcessDefinitions({ deploymentId }); - return processDefinitionList.data.find((processDefinition) => processDefinition.name === processName); - } catch (error) { - Logger.error('Get ProcessDefinitions - Service error, Response: ', JSON.parse(JSON.stringify(error))); - return null; - } - } - - async getProcessInstanceByName(processInstanceName: string, processInstanceStatus?: string, maxNumberOfResults?: number): Promise { - try { - return await this.processInstancesApi.filterProcessInstances({filter: {name: processInstanceName, state: processInstanceStatus}, size: maxNumberOfResults}); - } catch (error) { - Logger.error('List process instances using a filter - Service error, Response: ', JSON.parse(JSON.stringify(error))); - return null; - } - } - - async getProcessTaskId(processId: string): Promise { - const taskList = await this.tasksApi.listTasks({}); - let wantedTask; - - taskList.data.forEach((task) => { - if (task.processInstanceId === processId) { - wantedTask = task; - } - }); - return wantedTask ? wantedTask : 'null'; - } - -} diff --git a/lib/testing/src/lib/protractor/process-services/actions/public-api.ts b/lib/testing/src/lib/protractor/process-services/actions/public-api.ts deleted file mode 100644 index c3bc3e6cf5e..00000000000 --- a/lib/testing/src/lib/protractor/process-services/actions/public-api.ts +++ /dev/null @@ -1,24 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './applications.util'; -export * from './integration.service'; -export * from './models.service'; -export * from './process.util'; -export * from './task-actions.util'; -export * from './task.util'; -export * from './user-filters.util'; diff --git a/lib/testing/src/lib/protractor/process-services/actions/task-actions.util.ts b/lib/testing/src/lib/protractor/process-services/actions/task-actions.util.ts deleted file mode 100644 index 8dddc6d8158..00000000000 --- a/lib/testing/src/lib/protractor/process-services/actions/task-actions.util.ts +++ /dev/null @@ -1,55 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { Logger } from '../../core/utils/logger'; -import { ApiService } from '../../../shared/api/api.service'; -import { TaskActionsApi } from '@alfresco/js-api'; - -export class TaskActionsUtil { - - api: ApiService; - taskActionsApi: TaskActionsApi; - - constructor(apiService: ApiService) { - this.api = apiService; - this.taskActionsApi = new TaskActionsApi(apiService.getInstance()); - } - - async claimTask(taskInstance: string): Promise { - try { - return this.taskActionsApi.claimTask(taskInstance); - } catch (error) { - Logger.error('Claim a Task - Service error, Response: ', JSON.parse(JSON.stringify(error))); - } - } - - async unclaimTask(taskInstance: string): Promise { - try { - return this.taskActionsApi.unclaimTask(taskInstance); - } catch (error) { - Logger.error('Unclaim a Task - Service error, Response: ', JSON.parse(JSON.stringify(error))); - } - } - - async completeTask(taskInstance: string): Promise { - try { - return this.taskActionsApi.completeTask(taskInstance); - } catch (error) { - Logger.error('Complete Task - Service error, Response: ', JSON.parse(JSON.stringify(error))); - } - } -} diff --git a/lib/testing/src/lib/protractor/process-services/actions/task.util.ts b/lib/testing/src/lib/protractor/process-services/actions/task.util.ts deleted file mode 100644 index 2579bd19c11..00000000000 --- a/lib/testing/src/lib/protractor/process-services/actions/task.util.ts +++ /dev/null @@ -1,58 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { Logger } from '../../core/utils/logger'; -import { ApiService } from '../../../shared/api/api.service'; -import { TaskFormsApi, TaskRepresentation, TasksApi } from '@alfresco/js-api'; -import { StringUtil } from '../../../shared/utils/string.util'; - -export class TaskUtil { - - api: ApiService; - tasksApi: TasksApi; - taskFormsApi: TaskFormsApi; - - constructor(apiService: ApiService) { - this.api = apiService; - this.tasksApi = new TasksApi(apiService.getInstance()); - this.taskFormsApi = new TaskFormsApi(apiService.getInstance()); - } - - async createStandaloneTask(taskName: string = StringUtil.generateRandomString()): Promise { - try { - return this.tasksApi.createNewTask(new TaskRepresentation({ name: taskName })); - } catch (error) { - Logger.error('Create Standalone Task - Service error, Response: ', JSON.parse(JSON.stringify(error))); - } - } - - async completeTaskForm(taskInstance: string): Promise { - try { - return this.taskFormsApi.completeTaskForm(taskInstance, { values: { label: null } }); - } catch (error) { - Logger.error('Complete Task Form - Service error, Response: ', JSON.parse(JSON.stringify(error))); - } - } - - async deleteTask(taskInstance: string): Promise { - try { - return this.tasksApi.deleteTask(taskInstance); - } catch (error) { - Logger.error('Delete Task - Service error, Response: ', JSON.parse(JSON.stringify(error))); - } - } -} diff --git a/lib/testing/src/lib/protractor/process-services/actions/user-filters.util.ts b/lib/testing/src/lib/protractor/process-services/actions/user-filters.util.ts deleted file mode 100644 index a644b751d24..00000000000 --- a/lib/testing/src/lib/protractor/process-services/actions/user-filters.util.ts +++ /dev/null @@ -1,127 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { Logger } from '../../core/utils/logger'; -import { ApiService } from '../../../shared/api/api.service'; -import { UserFiltersApi, UserTaskFilterRepresentation, ResultListDataRepresentationUserProcessInstanceFilterRepresentation } from '@alfresco/js-api'; - -export class UserFiltersUtil { - apiService: ApiService; - userFiltersApi: UserFiltersApi; - - constructor(apiService: ApiService) { - this.apiService = apiService; - this.userFiltersApi = new UserFiltersApi(apiService.getInstance()); - } - - async createATaskFilter( - newTaskFilterName: string, - sortType?: string, - stateType?: string, - assignmentType?: string, - iconName?: string, - appId?: number - ): Promise { - try { - return this.userFiltersApi.createUserTaskFilter( - new UserTaskFilterRepresentation({ - appId, - name: newTaskFilterName, - icon: iconName, - filter: { sort: sortType, state: stateType, assignment: assignmentType } - }) - ); - } catch (error) { - Logger.error('Create Task Filter - Service error, Response: ', error); - } - } - - async createUserTaskFilter(userTaskFilterRepresentation: UserTaskFilterRepresentation): Promise { - try { - return this.userFiltersApi.createUserTaskFilter(userTaskFilterRepresentation); - } catch (error) { - Logger.error('Create Task Filter - Service error, Response: ', error); - } - } - - async orderUserTaskFilters(filtersIdOrder: number[], appId?: number): Promise { - try { - return this.userFiltersApi.orderUserTaskFilters({ appId, order: filtersIdOrder }); - } catch (error) { - Logger.error('Re-order the list of user task filters - Service error, Response: ', error); - } - } - - async getUserTaskFilters(appId?: number): Promise { - try { - return this.userFiltersApi.getUserTaskFilters({ appId }); - } catch (error) { - Logger.error('List task filters - Service error, Response: ', error); - } - } - - async getUserProcessFilters(appId?: number): Promise { - try { - return this.userFiltersApi.getUserProcessInstanceFilters({ appId }); - } catch (error) { - Logger.error('List process filters - Service error, Response: ', error); - return null; - } - } - - async getUserTaskFilterByName(taskFilterName: string, appId?: number): Promise { - try { - const taskFiltersList = this.userFiltersApi.getUserTaskFilters({ appId }); - const chosenTaskFilter = (await taskFiltersList).data.find((taskFilter) => taskFilter.name === taskFilterName); - return chosenTaskFilter; - } catch (error) { - Logger.error('Get user task filters by name - Service error, Response: ', error); - } - } - - async deleteUserTaskFilter(filterId: number): Promise { - try { - return this.userFiltersApi.deleteUserTaskFilter(filterId); - } catch (error) { - Logger.error('Delete a task filter - Service error, Response: ', error); - } - } - - async updateUserTaskFilter( - filterId: number, - updatedTaskFilterName?: string, - updatedSortType?: string, - updatedStateType?: string, - updatedAssignmentType?: string, - updatedIconName?: string, - appId?: number - ): Promise { - try { - return this.userFiltersApi.updateUserTaskFilter( - filterId, - new UserTaskFilterRepresentation({ - appId, - name: updatedTaskFilterName, - icon: updatedIconName, - filter: { sort: updatedSortType, state: updatedStateType, assignment: updatedAssignmentType } - }) - ); - } catch (error) { - Logger.error('Update a task filter - Service error, Response: ', error); - } - } -} diff --git a/lib/testing/src/lib/protractor/process-services/pages/filters.page.ts b/lib/testing/src/lib/protractor/process-services/pages/filters.page.ts deleted file mode 100644 index 246d3eb596d..00000000000 --- a/lib/testing/src/lib/protractor/process-services/pages/filters.page.ts +++ /dev/null @@ -1,64 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 '../../core/utils/browser-visibility'; -import { BrowserActions } from '../../core/utils/browser-actions'; -import { ElementFinder, $ } from 'protractor'; - -export class FiltersPage { - - accordionMenu = $('.app-processes-menu'); - buttonWindow = $('div > button[data-automation-id="btn-start-process"] > div'); - processIcon = 'adf-icon[data-automation-id="adf-filter-icon"]'; - - getLocatorForFilterByName = (name: string): ElementFinder => $(`[data-automation-id='${name}_filter']`); - getLocatorForActiveFilterByName = (name: string): ElementFinder => $(`.adf-active [data-automation-id='${name}_filter']`); - - async clickFilterButton(filterElement: ElementFinder): Promise { - await BrowserActions.click(filterElement); - } - - async isFilterHighlighted(filterName: string): Promise { - const filterNameHighlighted = await this.getLocatorForActiveFilterByName(filterName); - try { - await BrowserVisibility.waitUntilElementIsVisible(filterNameHighlighted); - return true; - } catch (error) { - return false; - } - } - - async isFilterNotHighlighted(filterName: string): Promise { - const filterNameHighlighted = await this.getLocatorForActiveFilterByName(filterName); - try { - await BrowserVisibility.waitUntilElementIsNotVisible(filterNameHighlighted); - return true; - } catch (error) { - return false; - } - } - - async isFilterDisplayed(name: string): Promise { - const filterName = this.getLocatorForFilterByName(name); - try { - await BrowserVisibility.waitUntilElementIsVisible(filterName); - return true; - } catch (error) { - return false; - } - } -} diff --git a/lib/testing/src/lib/protractor/process-services/pages/process-instance-header.page.ts b/lib/testing/src/lib/protractor/process-services/pages/process-instance-header.page.ts deleted file mode 100644 index ebad7df13ee..00000000000 --- a/lib/testing/src/lib/protractor/process-services/pages/process-instance-header.page.ts +++ /dev/null @@ -1,146 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { CardTextItemPage } from '../../core/pages/card-view/card-view-text-item.page'; -import { CardDateItemPage } from '../../core/pages/card-view/card-view-date-item.page'; - -export class ProcessInstanceHeaderPage { - - status = new CardTextItemPage('status'); - endDate = new CardDateItemPage('ended'); - category = new CardTextItemPage('category'); - businessKey = new CardTextItemPage('businessKey'); - startedBy = new CardTextItemPage('createdBy'); - startDate = new CardDateItemPage('created'); - id = new CardTextItemPage('id'); - description = new CardTextItemPage('description'); - - async isIdFieldDisplayed(): Promise { - try { - await this.id.checkLabelIsVisible(); - return true; - } catch (e) { - return false; - } - } - - async getIdFieldValue(): Promise { - return this.id.getFieldValue(); - } - - async isStatusFieldDisplayed(): Promise { - try { - await this.status.checkLabelIsVisible(); - return true; - } catch (e) { - return false; - } - } - - async getStatusFieldValue(): Promise { - return this.status.getFieldValue(); - } - - async isEndDateFieldDisplayed(): Promise { - try { - await this.endDate.checkLabelIsVisible(); - return true; - } catch (e) { - return false; - } - } - - async getEndDateFieldValue(): Promise { - return this.endDate.getDateValue(); - } - - async isCategoryFieldDisplayed(): Promise { - try { - await this.category.checkLabelIsVisible(); - return true; - } catch (e) { - return false; - } - } - - async getCategoryFieldValue(): Promise { - return this.category.getFieldValue(); - } - - async isBusinessKeyFieldDisplayed(): Promise { - try { - await this.businessKey.checkLabelIsVisible(); - return true; - } catch (e) { - return false; - } - } - - async getBusinessKeyFieldValue(): Promise { - return this.businessKey.getFieldValue(); - } - - async isStartedByFieldDisplayed(): Promise { - try { - await this.startedBy.checkLabelIsVisible(); - return true; - } catch (e) { - return false; - } - } - - async getStartedByFieldValue(): Promise { - return this.startedBy.getFieldValue(); - } - - async isStartDateFieldDisplayed(): Promise { - try { - await this.startDate.checkLabelIsVisible(); - return true; - } catch (e) { - return false; - } - } - - async getStartDateFieldValue(): Promise { - return this.startDate.getDateValue(); - } - - async isDescriptionFieldDisplayed(): Promise { - try { - await this.description.checkLabelIsVisible(); - return true; - } catch (e) { - return false; - } - } - - async getDescriptionFieldValue(): Promise { - return this.description.getFieldValue(); - } - - async checkDetailsAreDisplayed(): Promise { - await this.status.checkLabelIsVisible(); - await this.endDate.checkLabelIsVisible(); - await this.category.checkLabelIsVisible(); - await this.businessKey.checkLabelIsVisible(); - await this.startedBy.checkLabelIsVisible(); - await this.startDate.checkLabelIsVisible(); - await this.id.checkLabelIsVisible(); - await this.description.checkLabelIsVisible(); - } -} diff --git a/lib/testing/src/lib/protractor/process-services/pages/process-list.page.ts b/lib/testing/src/lib/protractor/process-services/pages/process-list.page.ts deleted file mode 100644 index 8ef0e50bc6b..00000000000 --- a/lib/testing/src/lib/protractor/process-services/pages/process-list.page.ts +++ /dev/null @@ -1,72 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 '../../core/utils/browser-visibility'; -import { DataTableComponentPage } from '../../core/pages/data-table-component.page'; -import { BrowserActions } from '../../core/utils/browser-actions'; -import { element, by, ElementFinder } from 'protractor'; - -export class ProcessListPage { - rootElement: ElementFinder; - dataTable: DataTableComponentPage; - processListEmptyTitle: ElementFinder; - - constructor( - rootElement = element.all(by.css('adf-process-instance-list')).first() - ) { - this.rootElement = rootElement; - this.dataTable = new DataTableComponentPage(this.rootElement); - this.processListEmptyTitle = this.rootElement.element( - by.css('.adf-empty-content__title') - ); - } - - getDataTable() { - return this.dataTable; - } - - getDisplayedProcessListEmptyTitle(): Promise { - return BrowserActions.getText(this.processListEmptyTitle); - } - - titleNotPresent(): Promise { - return BrowserVisibility.waitUntilElementIsNotPresent(this.processListEmptyTitle); - } - - async isProcessListDisplayed(): Promise { - try { - await BrowserVisibility.waitUntilElementIsVisible(this.rootElement); - return true; - } catch (error) { - return false; - } - } - - async checkContentIsDisplayedByColumn(column: string, processName: string): Promise { - await this.dataTable.waitTillContentLoaded(); - return this.dataTable.checkContentIsDisplayed(column, processName); - } - - async checkContentIsNotDisplayedByColumn(column: string, processName: string): Promise { - await this.dataTable.waitTillContentLoaded(); - return this.dataTable.checkContentIsNotDisplayed(column, processName); - } - - async selectRowByName(processName: string): Promise { - await this.dataTable.selectRow('Name', processName); - } -} diff --git a/lib/testing/src/lib/protractor/process-services/pages/public-api.ts b/lib/testing/src/lib/protractor/process-services/pages/public-api.ts deleted file mode 100644 index 5d015346ee7..00000000000 --- a/lib/testing/src/lib/protractor/process-services/pages/public-api.ts +++ /dev/null @@ -1,23 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './filters.page'; -export * from './process-list.page'; -export * from './task-filters.page'; -export * from './process-instance-header.page'; -export * from './start-process.page'; -export * from './task-form.page'; diff --git a/lib/testing/src/lib/protractor/process-services/pages/start-process.page.ts b/lib/testing/src/lib/protractor/process-services/pages/start-process.page.ts deleted file mode 100644 index 13e823fa874..00000000000 --- a/lib/testing/src/lib/protractor/process-services/pages/start-process.page.ts +++ /dev/null @@ -1,157 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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, Key, protractor, browser, $ } from 'protractor'; -import { BrowserVisibility } from '../../core/utils/browser-visibility'; -import { BrowserActions } from '../../core/utils/browser-actions'; -import { DropdownPage } from '../../core/pages/material/dropdown.page'; -import { FormFields } from '../../core/pages/form/form-fields'; -import { Logger } from '../../core/utils/logger'; -import { materialLocators } from '../../public-api'; - -export class StartProcessPage { - defaultProcessName = $('input[id="processName"]'); - processNameInput = $('#processName'); - disabledSelectProcessDropdown = $('input[id="processDefinitionName"][disabled]'); - selectProcessDropdownArrow = $('button[id="adf-select-process-dropdown"]'); - cancelProcessButton = $('#cancel_process'); - formStartProcessButton = $('button[data-automation-id="adf-form-start process"]'); - startProcessButton = $('button[data-automation-id="btn-start"]'); - startProcessButtonDisabled = $('button[data-automation-id="btn-start"][disabled]'); - noProcess = $('.adf-empty-content__title'); - processDefinition = $('input[id="processDefinitionName"]'); - processDefinitionOptionsPanel = $(`div[class*="${materialLocators.Autocomplete.panel.root}"]`); - processDefinitionDropdown = new DropdownPage($('#adf-select-process-dropdown')); - - async checkNoProcessMessage(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.noProcess); - } - - async pressDownArrowAndEnter(): Promise { - await this.processDefinition.sendKeys(protractor.Key.ARROW_DOWN); - await browser.actions().sendKeys(protractor.Key.ENTER).perform(); - } - - async checkNoProcessDefinitionOptionIsDisplayed() { - await BrowserVisibility.waitUntilElementIsNotVisible(this.processDefinitionOptionsPanel); - } - - async getDefaultName(): Promise { - return BrowserActions.getInputValue(this.defaultProcessName); - } - - async deleteDefaultName() { - await BrowserVisibility.waitUntilElementIsVisible(this.processNameInput); - await BrowserActions.clearWithBackSpace(this.processNameInput); - } - - async enterProcessName(name): Promise { - await BrowserActions.clearSendKeys(this.processNameInput, name); - } - - async selectFromProcessDropdown(name: string, retry = 0): Promise { - Logger.log(`select Process Dropdown retry: ${retry}`); - try { - await this.clickProcessDropdownArrow(); - await this.selectProcessOption(name); - } catch (error) { - if (retry < 3) { - retry++; - await this.selectFromProcessDropdown(name, retry); - } - } - try { - await BrowserVisibility.waitUntilElementIsVisible($(materialLocators.Card.content.class), 2000); - } catch (error) { - Logger.log(`No start form on process`); - } - } - - async clickProcessDropdownArrow(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.selectProcessDropdownArrow); - await BrowserActions.click(this.selectProcessDropdownArrow); - } - - async checkProcessOptionIsDisplayed(name): Promise { - await this.processDefinitionDropdown.checkOptionIsDisplayed(name); - } - - async checkProcessOptionIsNotDisplayed(name): Promise { - await this.processDefinitionDropdown.checkOptionIsNotDisplayed(name); - } - - async selectProcessOption(name): Promise { - await this.processDefinitionDropdown.selectOption(name); - } - - async typeProcessDefinition(name): Promise { - await BrowserActions.clearSendKeys(this.processDefinition, name); - } - - async getProcessDefinitionValue(): Promise { - return BrowserActions.getInputValue(this.processDefinition); - } - - async clickCancelProcessButton(): Promise { - await BrowserActions.click(this.cancelProcessButton); - } - - async clickFormStartProcessButton(): Promise { - await BrowserActions.click(this.formStartProcessButton); - } - - async isStartProcessButtonEnabled() { - await BrowserVisibility.waitUntilElementIsNotVisible(this.startProcessButtonDisabled); - return this.startProcessButton.isEnabled(); - } - - async checkStartProcessButtonIsDisabled() { - expect(await this.startProcessButton.isEnabled()).toBe(false); - } - - async clickStartProcessButton(): Promise { - await BrowserActions.click(this.startProcessButton); - } - - async checkSelectProcessPlaceholderIsDisplayed(): Promise { - return BrowserActions.getInputValue(this.processDefinition); - } - - async checkValidationErrorIsDisplayed(error: string, elementRef = materialLocators.Error.root): Promise { - const errorElement = element(by.cssContainingText(elementRef, error)); - await BrowserVisibility.waitUntilElementIsVisible(errorElement); - } - - async blur(locator): Promise { - await BrowserActions.click(locator); - await locator.sendKeys(Key.TAB); - } - - formFields(): FormFields { - return new FormFields(); - } - - async checkProcessDefinitionDropdownIsEnabled(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.disabledSelectProcessDropdown); - } - - async startProcess(name: string, processName: string) { - await this.selectFromProcessDropdown(processName); - await this.enterProcessName(name); - await this.clickStartProcessButton(); - } -} diff --git a/lib/testing/src/lib/protractor/process-services/pages/task-filters.page.ts b/lib/testing/src/lib/protractor/process-services/pages/task-filters.page.ts deleted file mode 100644 index 80fca39b40f..00000000000 --- a/lib/testing/src/lib/protractor/process-services/pages/task-filters.page.ts +++ /dev/null @@ -1,117 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { $ } from 'protractor'; -import { FiltersPage } from './filters.page'; -import { materialLocators } from '../../public-api'; - -export class TaskFiltersPage { - defaultTaskFilters = { - myTasks: 'My Tasks', - queuedTasks: 'Queued Tasks', - involvedTasks: 'Involved Tasks', - completedTasks: 'Completed Tasks' - }; - - filtersPage = new FiltersPage(); - - myTasks = $('[data-automation-id="My Tasks_filter"]'); - queuedTask = $('[data-automation-id="Queued Tasks_filter"]'); - completedTask = $('[data-automation-id="Completed Tasks_filter"]'); - involvedTask = $('[data-automation-id="Involved Tasks_filter"]'); - accordionMenu = $(`.app-processes-menu ${materialLocators.Accordion.root}`); - - async clickMyTasksFilterButton(): Promise { - await this.filtersPage.clickFilterButton(this.myTasks); - } - - async clickQueuedFilterButton(): Promise { - await this.filtersPage.clickFilterButton(this.queuedTask); - } - - async clickCompletedFilterButton(): Promise { - await this.filtersPage.clickFilterButton(this.completedTask); - } - - async clickInvolvedFilterButton(): Promise { - await this.filtersPage.clickFilterButton(this.involvedTask); - } - - async clickCustomFilterButton(customFilterName): Promise { - await this.filtersPage.clickFilterButton($(`[data-automation-id="${customFilterName}_filter"]`)); - } - - async isMyTasksFilterHighlighted(): Promise { - return this.filtersPage.isFilterHighlighted(this.defaultTaskFilters.myTasks); - } - - async isMyTasksFilterNotHighlighted(): Promise { - return this.filtersPage.isFilterNotHighlighted(this.defaultTaskFilters.myTasks); - } - - async isQueuedFilterHighlighted(): Promise { - return this.filtersPage.isFilterHighlighted(this.defaultTaskFilters.queuedTasks); - } - - async isQueuedFilterNotHighlighted(): Promise { - return this.filtersPage.isFilterNotHighlighted(this.defaultTaskFilters.queuedTasks); - } - - async isCompletedFilterHighlighted(): Promise { - return this.filtersPage.isFilterHighlighted(this.defaultTaskFilters.completedTasks); - } - - async isCompletedFilterNotHighlighted(): Promise { - return this.filtersPage.isFilterNotHighlighted(this.defaultTaskFilters.completedTasks); - } - - async isInvolvedFilterHighlighted(): Promise { - return this.filtersPage.isFilterHighlighted(this.defaultTaskFilters.involvedTasks); - } - - async isInvolvedFilterNotHighlighted(): Promise { - return this.filtersPage.isFilterNotHighlighted(this.defaultTaskFilters.involvedTasks); - } - - async isCustomFilterHighlighted(customFilterName): Promise { - return this.filtersPage.isFilterHighlighted(`${customFilterName}`); - } - - async isCustomFilterNotHighlighted(customFilterName): Promise { - return this.filtersPage.isFilterNotHighlighted(`${customFilterName}`); - } - - async isMyTasksFilterDisplayed(): Promise { - return this.filtersPage.isFilterDisplayed(this.defaultTaskFilters.myTasks); - } - - async isQueuedFilterDisplayed(): Promise { - return this.filtersPage.isFilterDisplayed(this.defaultTaskFilters.queuedTasks); - } - - async isCompletedFilterDisplayed(): Promise { - return this.filtersPage.isFilterDisplayed(this.defaultTaskFilters.completedTasks); - } - - async isInvolvedFilterDisplayed(): Promise { - return this.filtersPage.isFilterDisplayed(this.defaultTaskFilters.involvedTasks); - } - - async isCustomFilterDisplayed(customFilterName): Promise { - return this.filtersPage.isFilterDisplayed(customFilterName); - } -} diff --git a/lib/testing/src/lib/protractor/process-services/pages/task-form.page.ts b/lib/testing/src/lib/protractor/process-services/pages/task-form.page.ts deleted file mode 100644 index 9d205afe9db..00000000000 --- a/lib/testing/src/lib/protractor/process-services/pages/task-form.page.ts +++ /dev/null @@ -1,100 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { $ } from 'protractor'; -import { BrowserActions, BrowserVisibility } from '../../core/utils/public-api'; - -export class TaskFormPage { - - saveButton = $('#adf-form-save'); - claimButton = $('button[data-automation-id="adf-task-form-claim-button"]'); - releaseButton = $('button[data-automation-id="adf-task-form-unclaim-button"]'); - - async clickOnClaimButton(): Promise { - await BrowserActions.click(this.claimButton); - } - - async clickOnReleaseButton(): Promise { - await BrowserActions.click(this.releaseButton); - } - - async isSaveButtonDisplayed(timeout?: number): Promise { - try { - await BrowserVisibility.waitUntilElementIsVisible(this.saveButton, timeout); - return true; - } catch (error) { - return false; - } - } - - async isSaveButtonNotDisplayed(timeout?: number): Promise { - try { - await BrowserVisibility.waitUntilElementIsNotVisible(this.saveButton, timeout); - return true; - } catch (error) { - return false; - } - } - - async isClaimButtonDisplayed(timeout?: number): Promise { - try { - await BrowserVisibility.waitUntilElementIsVisible(this.claimButton, timeout); - return true; - } catch (error) { - return false; - } - } - - async isClaimButtonNotDisplayed(timeout?: number): Promise { - try { - await BrowserVisibility.waitUntilElementIsNotVisible(this.claimButton, timeout); - return true; - } catch (error) { - return false; - } - } - - async isReleaseButtonDisplayed(timeout?: number): Promise { - try { - await BrowserVisibility.waitUntilElementIsVisible(this.releaseButton, timeout); - return true; - } catch (error) { - return false; - } - } - - async isReleaseButtonNotDisplayed(timeout?: number): Promise { - try { - await BrowserVisibility.waitUntilElementIsNotVisible(this.releaseButton, timeout); - return true; - } catch (error) { - return false; - } - } - - async isSaveButtonEnabled(): Promise { - return this.saveButton.isEnabled(); - } - - async isClaimButtonEnabled(): Promise { - return this.claimButton.isEnabled(); - } - - async isReleaseButtonEnabled(): Promise { - return this.releaseButton.isEnabled(); - } -} diff --git a/lib/testing/src/lib/protractor/process-services/public-api.ts b/lib/testing/src/lib/protractor/process-services/public-api.ts deleted file mode 100644 index 72c62361a2e..00000000000 --- a/lib/testing/src/lib/protractor/process-services/public-api.ts +++ /dev/null @@ -1,19 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './actions/public-api'; -export * from './pages/public-api'; diff --git a/lib/testing/src/lib/protractor/public-api.ts b/lib/testing/src/lib/protractor/public-api.ts deleted file mode 100644 index a2826a420cb..00000000000 --- a/lib/testing/src/lib/protractor/public-api.ts +++ /dev/null @@ -1,21 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './core/public-api'; -export * from './content-services/public-api'; -export * from './process-services/public-api'; -export * from './process-services-cloud/public-api'; diff --git a/lib/testing/src/lib/public-api.ts b/lib/testing/src/lib/public-api.ts deleted file mode 100644 index cc59abbf9b4..00000000000 --- a/lib/testing/src/lib/public-api.ts +++ /dev/null @@ -1,19 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './protractor/public-api'; -export * from './shared'; diff --git a/lib/testing/src/lib/shared/api/api.service.ts b/lib/testing/src/lib/shared/api/api.service.ts deleted file mode 100644 index 1e3f48e0fcf..00000000000 --- a/lib/testing/src/lib/shared/api/api.service.ts +++ /dev/null @@ -1,131 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { AlfrescoApi, AlfrescoApiConfig } from '@alfresco/js-api'; -import { LoggerLike } from '../utils/logger'; - -export interface ApiServiceConfig { - appConfig: AlfrescoApiConfig; - users: { - [key: string]: { - username: string; - password: string; - }; - }; -} -export class ApiService { - - apiService: AlfrescoApi; - - constructor(private config: ApiServiceConfig, private logger: LoggerLike) { - this.logger.log('Api Service configuration' + JSON.stringify(this.config)); - this.apiService = new AlfrescoApi(this.config.appConfig); - } - - getInstance(): AlfrescoApi { - return this.apiService; - } - - async login(username: string, password: string): Promise { - await this.apiService.login(username, password); - } - - /** - * Login using one of the account profiles from the `browser.params.testConfig`. - * Example: loginWithProfile('admin') - * - * @param profileName profile name - */ - async loginWithProfile(profileName: string): Promise { - const profile = this.config.users[profileName]; - if (profile) { - this.logger.log(`try to login with ${profile.username} on HOST: ${this.apiService.config.hostEcm} AUTHTYPE: ${this.apiService.config.authType} PROVIDER: ${this.apiService.config.provider}`); - try { - await this.apiService.login(profile.username, profile.password); - this.logger.log(`Successfuly logged in as ${profile.username}`); - } catch (error) { - this.logger.error(`Failed to login with ${profile.username}`, error?.message); - throw new Error(`Login failed with ${profile.username}`); - } - } else { - throw new Error(`Login profile "${profileName}" not found on "browser.params.testConfig".`); - } - } - - // @deprecated - async performBpmOperation(path: string, method: string, queryParams: any, postBody: any): Promise { - return new Promise((resolve, reject) => { - const uri = this.config.appConfig.hostBpm + path; - const pathParams = {}; - const formParams = {}; - const contentTypes = ['application/json']; - const accepts = ['application/json']; - - const headerParams = { - // eslint-disable-next-line @typescript-eslint/naming-convention - Authorization: 'bearer ' + this.apiService.oauth2Auth.token - }; - - this.apiService.processClient.callCustomApi(uri, method, pathParams, queryParams, headerParams, formParams, postBody, - contentTypes, accepts, Object) - .then((data) => resolve(data)) - .catch((err) => reject(err)); - }); - } - - // @deprecated - async performIdentityOperation(path: string, method: string, queryParams: any, postBody: any): Promise { - return new Promise((resolve, reject) => { - const uri = this.config.appConfig.oauth2.host.replace('/realms', '/admin/realms') + path; - const pathParams = {}; - const formParams = {}; - const contentTypes = ['application/json']; - const accepts = ['application/json']; - - const headerParams = { - // eslint-disable-next-line @typescript-eslint/naming-convention - Authorization: 'bearer ' + this.apiService.oauth2Auth.token - }; - - return this.apiService.processClient.callCustomApi(uri, method, pathParams, queryParams, headerParams, formParams, postBody, - contentTypes, accepts, Object) - .then((data) => resolve(data)) - .catch((err) => reject(err)); - }); - } - - // @deprecated - async performECMOperation(path: string, method: string, queryParams: any, postBody: any): Promise { - return new Promise((resolve, reject) => { - const uri = this.config.appConfig.hostEcm + path; - const pathParams = {}; - const formParams = {}; - const contentTypes = ['application/json']; - const accepts = ['application/json']; - - const headerParams = { - // eslint-disable-next-line @typescript-eslint/naming-convention - Authorization: 'bearer ' + this.apiService.oauth2Auth.token - }; - - this.apiService.contentClient - .callCustomApi(uri, method, pathParams, queryParams, headerParams, formParams, postBody, contentTypes, accepts, Object) - .then((data) => resolve(data)) - .catch((err) => reject(err)); - }); - } -} diff --git a/lib/testing/src/lib/shared/api/api.util.ts b/lib/testing/src/lib/shared/api/api.util.ts deleted file mode 100644 index efa2a1be993..00000000000 --- a/lib/testing/src/lib/shared/api/api.util.ts +++ /dev/null @@ -1,41 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export type ApiResultPredicate = (result: T) => boolean; -export type ApiCall = () => Promise; - -export class ApiUtil { - static async waitForApi(apiCall: ApiCall, predicate: ApiResultPredicate, retry: number = 30, delay: number = 1000) { - const apiCallWithPredicateChecking = async () => { - const apiCallResult = await apiCall(); - if (predicate(apiCallResult)) { - return Promise.resolve(apiCallResult); - } else { - return Promise.reject(apiCallResult); - } - }; - - return ApiUtil.retryCall(apiCallWithPredicateChecking, retry, delay); - } - - static retryCall(fn: () => Promise, retry: number = 30, delay: number = 1000): Promise { - const pause = duration => new Promise(res => setTimeout(res, duration)); - const run = retries => fn().catch(err => (retries > 1 ? pause(delay).then(() => run(retries - 1)) : Promise.reject(err))); - - return run(retry); - } -} diff --git a/lib/testing/src/lib/shared/api/e2e-request-api.helper.ts b/lib/testing/src/lib/shared/api/e2e-request-api.helper.ts deleted file mode 100644 index d4b238a9014..00000000000 --- a/lib/testing/src/lib/shared/api/e2e-request-api.helper.ts +++ /dev/null @@ -1,112 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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 { ApiService } from './api.service'; -import { AlfrescoApi } from '@alfresco/js-api'; - -export interface E2eRequestApiHelperOptions { - pathParams?: { [key: string]: any }; - queryParams?: { [key: string]: any }; - headerParams?: { [key: string]: any }; - formParams?: { [key: string]: any }; - bodyParam?: { [key: string]: any }; - contentTypes?: string[]; - accepts?: string[]; - returnType?: any; - contextRoot?: string; - responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text'; -} - -const getDefaultOptions = (): E2eRequestApiHelperOptions => ({ - pathParams: {}, - queryParams: {}, - headerParams: {}, - formParams: {}, - bodyParam: {}, - contentTypes: ['application/json'], - accepts: ['application/json'], - returnType: undefined -}); - -export class E2eRequestApiHelper { - - api: AlfrescoApi; - - constructor(backend: ApiService) { - this.api = backend.apiService; - } - - public get(endPoint: string, overriddenOptions?: E2eRequestApiHelperOptions): PromiseLike { - return this.request('GET', endPoint, overriddenOptions); - } - - public post(endPoint: string, overriddenOptions?: E2eRequestApiHelperOptions): PromiseLike { - return this.request('POST', endPoint, overriddenOptions); - } - - public put(endPoint: string, overriddenOptions?: E2eRequestApiHelperOptions): PromiseLike { - return this.request('PUT', endPoint, overriddenOptions); - } - - public delete(endPoint: string, overriddenOptions?: E2eRequestApiHelperOptions): PromiseLike { - return this.request('DELETE', endPoint, overriddenOptions); - } - - private buildUrl(endPoint: string): string { - const trimSlash = (str: string) => str.replace(/^\/|\/$/g, ''); - const host = this.api.config.hostBpm; - const path = '/' + trimSlash(endPoint); - - return `${host}${path}`; - } - - private request(httpMethod: string, endPoint: string, overriddenOptions?: E2eRequestApiHelperOptions): PromiseLike { - const options = { - ...getDefaultOptions(), - ...overriddenOptions - }; - - const { - pathParams, - queryParams, - headerParams, - formParams, - bodyParam, - contentTypes, - accepts, - returnType, - contextRoot, - responseType - } = options; - - return this.api.oauth2Auth.callCustomApi( - this.buildUrl(endPoint), - httpMethod, - pathParams, - queryParams, - headerParams, - formParams, - bodyParam, - contentTypes, - accepts, - returnType, - contextRoot, - responseType - ); - - } -} diff --git a/lib/testing/src/lib/shared/api/public-api.ts b/lib/testing/src/lib/shared/api/public-api.ts deleted file mode 100644 index e8aaf9a6c70..00000000000 --- a/lib/testing/src/lib/shared/api/public-api.ts +++ /dev/null @@ -1,20 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './api.service'; -export * from './api.util'; -export * from './e2e-request-api.helper'; diff --git a/lib/testing/src/lib/shared/index.ts b/lib/testing/src/lib/shared/index.ts deleted file mode 100644 index f3c6d0a94c5..00000000000 --- a/lib/testing/src/lib/shared/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './api/public-api'; -export * from './utils/public-api'; diff --git a/lib/testing/src/lib/shared/package.json b/lib/testing/src/lib/shared/package.json deleted file mode 100644 index 6d69f069a85..00000000000 --- a/lib/testing/src/lib/shared/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "ngPackage": { - "lib": { - "entryFile": "../src/lib/shared/index.ts", - "flatModuleFile": "adf-testing-shared" - } - } -} diff --git a/lib/testing/src/lib/shared/utils/logger.ts b/lib/testing/src/lib/shared/utils/logger.ts deleted file mode 100644 index c70a7afb6e2..00000000000 --- a/lib/testing/src/lib/shared/utils/logger.ts +++ /dev/null @@ -1,81 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -/* eslint-disable @typescript-eslint/naming-convention */ - -export const infoColor = '\x1b[36m%s\x1b[0m'; -export const logColor = '\x1b[35m%s\x1b[0m'; -export const warnColor = '\x1b[33m%s\x1b[0m'; -export const errorColor = '\x1b[31m%s\x1b[0m'; - -export type LOG_LEVEL = 'TRACE' | 'DEBUG' | 'INFO' | 'WARN' | 'ERROR' | 'SILENT'; - -export class LogLevelsEnum extends Number { - static TRACE: number = 5; - static DEBUG: number = 4; - static INFO: number = 3; - static WARN: number = 2; - static ERROR: number = 1; - static SILENT: number = 0; -} - -export const logLevels: { level: number; name: LOG_LEVEL }[] = [ - { level: LogLevelsEnum.TRACE, name: 'TRACE' }, - { level: LogLevelsEnum.DEBUG, name: 'DEBUG' }, - { level: LogLevelsEnum.INFO, name: 'INFO' }, - { level: LogLevelsEnum.WARN, name: 'WARN' }, - { level: LogLevelsEnum.ERROR, name: 'ERROR' }, - { level: LogLevelsEnum.SILENT, name: 'SILENT' } -]; - -export interface LoggerLike { - info(...messages: string[]): void; - log(...messages: string[]): void; - warn(...messages: string[]): void; - error(...messages: string[]): void; -} - -/* eslint-disable no-console */ -export class GenericLogger implements LoggerLike { - private level: number; - - constructor(logLevel: string) { - this.level = logLevels.find(({ name }) => name === logLevel)?.level || LogLevelsEnum.ERROR; - } - - info(...messages: string[]): void { - if (this.level >= LogLevelsEnum.INFO) { - console.log(infoColor, messages.join('')); - } - } - - log(...messages: string[]): void { - if (this.level >= LogLevelsEnum.TRACE) { - console.log(logColor, messages.join('')); - } - } - - warn(...messages: string[]): void { - if (this.level >= LogLevelsEnum.WARN) { - console.log(warnColor, messages.join('')); - } - } - - error(...messages: string[]): void { - console.log(errorColor, messages.join('')); - } -} diff --git a/lib/testing/src/lib/shared/utils/public-api.ts b/lib/testing/src/lib/shared/utils/public-api.ts deleted file mode 100644 index 677769e2be9..00000000000 --- a/lib/testing/src/lib/shared/utils/public-api.ts +++ /dev/null @@ -1,19 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './logger'; -export * from './string.util'; diff --git a/lib/testing/src/lib/shared/utils/string.util.ts b/lib/testing/src/lib/shared/utils/string.util.ts deleted file mode 100644 index 4e1f3c159f8..00000000000 --- a/lib/testing/src/lib/shared/utils/string.util.ts +++ /dev/null @@ -1,136 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export class StringUtil { - - static generatePasswordString(length: number = 8): string { - let text = ''; - const lowerCaseLimit = Math.floor(length / 2); - text += StringUtil.generateRandomCharset(lowerCaseLimit, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'); - text += StringUtil.generateRandomCharset(length - lowerCaseLimit, 'abcdefghijklmnopqrstuvwxyz'); - - return text; - } - - /** - * Generates a random string. - * - * @param length If this parameter is not provided the length is set to 8 by default. - * @returns random string - */ - static generateRandomString(length: number = 8): string { - return StringUtil.generateRandomCharset(length, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'); - } - - /** - * Generates a random lowercase string. - * - * @param length If this parameter is not provided the length is set to 8 by default. - * @returns random string - */ - static generateRandomLowercaseString(length: number = 8): string { - return StringUtil.generateRandomCharset(length, 'abcdefghijklmnopqrstuvwxyz0123456789'); - } - - /** - * Generates a random email address following the format: abcdef@activiti.test.com - * - * @param domain email domain - * @param length email length - * @returns email address - */ - static generateRandomEmail(domain: string, length: number = 5): string { - let email = StringUtil.generateRandomCharset(length, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'); - email += domain; - return email.toLowerCase(); - } - - /** - * Generates a random string - digits only. - * - * @param length If this parameter is not provided the length is set to 8 by default. - * @returns random string - */ - static generateRandomStringDigits(length: number = 8): string { - return StringUtil.generateRandomCharset(length, '0123456789'); - } - - /** - * Generates a random string - non-latin characters only. - * - * @param length If this parameter is not provided the length is set to 3 by default. - * @returns random string - */ - static generateRandomStringNonLatin(length: number = 3): string { - return StringUtil.generateRandomCharset(length, '密码你好𠮷'); - } - - /** - * Generates a random string. - * - * @param length If this parameter is not provided the length is set to 8 by default. - * @param charSet to use - * @returns random string - */ - static generateRandomCharset(length: number = 8, charSet: string): string { - let text = ''; - - for (let i = 0; i < length; i++) { - text += charSet.charAt(Math.floor(Math.random() * charSet.length)); - } - - return text; - } - - /** - * Generates a sequence of files with name: baseName + index + extension (e.g.) baseName1.txt, baseName2.txt, ... - * - * @param startIndex start index - * @param endIndex end index - * @param baseName the base name of all files - * @param extension the extension of the file - * @returns list of file names - */ - static generateFilesNames(startIndex: number, endIndex: number, baseName: string, extension: string): string [] { - const fileNames: string[] = []; - for (let i = startIndex; i <= endIndex; i++) { - fileNames.push(baseName + i + extension); - } - return fileNames; - } - - /** - * Generates a random name for a process - * - * @param length {int} If this parameter is not provided the length is set to 5 by default. - * @returns process name - */ - static generateProcessName(length: number = 5): string { - return 'process_' + StringUtil.generateRandomString(length); - } - - /** - * Generates a random name for a user task - * - * @param length If this parameter is not provided the length is set to 5 by default. - * @returns task name - */ - static generateUserTaskName(length: number = 5): string { - return 'userTask_' + StringUtil.generateRandomString(length); - } - -} diff --git a/lib/testing/src/public-api.ts b/lib/testing/src/public-api.ts deleted file mode 100644 index 9a8f2f261b6..00000000000 --- a/lib/testing/src/public-api.ts +++ /dev/null @@ -1,18 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './lib/public-api'; diff --git a/lib/testing/src/resources.ts b/lib/testing/src/resources.ts deleted file mode 100644 index 4829dd1a29a..00000000000 --- a/lib/testing/src/resources.ts +++ /dev/null @@ -1,18 +0,0 @@ -/*! - * @license - * Copyright © 2005-2024 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. - */ - -export * from './lib/protractor/process-services-cloud/resources/resources'; diff --git a/lib/testing/tsconfig.json b/lib/testing/tsconfig.json deleted file mode 100644 index c311f0310df..00000000000 --- a/lib/testing/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "files": [], - "include": [], - "references": [ - { - "path": "./tsconfig.lib.json" - }, - { - "path": "./tsconfig.lib.prod.json" - } - ], - "compilerOptions": { - "baseUrl": "src", - "target": "es2020" - }, - "angularCompilerOptions": { - "skipTemplateCodegen": true, - "strictMetadataEmit": true, - "enableResourceInlining": true, - "strictTemplates": true - } -} diff --git a/lib/testing/tsconfig.lib.json b/lib/testing/tsconfig.lib.json deleted file mode 100644 index d6772281bc2..00000000000 --- a/lib/testing/tsconfig.lib.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "declaration": true, - "declarationMap": true, - "resolveJsonModule": true, - "paths": { - "@alfresco/js-api": ["../../../dist/libs/js-api"], - "@alfresco/js-api/*": ["../../../dist/libs/js-api/*"] - } - } -} diff --git a/lib/testing/tsconfig.lib.prod.json b/lib/testing/tsconfig.lib.prod.json deleted file mode 100644 index 2a2faa884cf..00000000000 --- a/lib/testing/tsconfig.lib.prod.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig.lib.json", - "compilerOptions": { - "declarationMap": false - }, - "angularCompilerOptions": { - "compilationMode": "partial" - } -} diff --git a/lib/tsconfig.doc.json b/lib/tsconfig.doc.json index ff1afcf3d1c..9898a9860e9 100644 --- a/lib/tsconfig.doc.json +++ b/lib/tsconfig.doc.json @@ -22,7 +22,6 @@ "allowSyntheticDefaultImports": true, "paths": { "@alfresco/adf-process-services-cloud": ["./process-services-cloud/"], - "@alfresco/adf-testing": ["./testing/"], "@alfresco/adf-process-services": ["./process-services/"], "@alfresco/adf-content-services": ["./content-services/"], "@alfresco/adf-extensions": ["./extensions/"], diff --git a/scripts/github/build/npm-check-bundles.sh b/scripts/github/build/npm-check-bundles.sh index c182241a6ec..56415c5316c 100755 --- a/scripts/github/build/npm-check-bundles.sh +++ b/scripts/github/build/npm-check-bundles.sh @@ -7,7 +7,6 @@ eval projects=( "js-api" "adf-insights" "adf-content-services" "adf-extensions" - "adf-testing" "adf-process-services" "adf-process-services-cloud" "eslint-plugin-eslint-angular" ) @@ -45,15 +44,6 @@ do fi fi - if [ $PACKAGE == 'adf-testing' ]; then - if [ ! -f package/'main.js' ]; then - error_out '31;1' "$PACKAGE testing: main.js not found!" >&2 - exit 1 - else - echo "testing: ok" - fi - fi - if [ $PACKAGE == 'adf-core' ]; then if [ ! -f package/lib/prebuilt-themes/'adf-blue-orange.css' ]; then error_out '31;1' "$PACKAGE prebuilt-theme: adf-blue-orange.css not found!" >&2 @@ -63,7 +53,7 @@ do fi fi - if [ $PACKAGE != 'adf-testing' ] && [ $PACKAGE != 'js-api' ] && [ $PACKAGE != 'eslint-plugin-eslint-angular' ]; then + if [ $PACKAGE != 'js-api' ] && [ $PACKAGE != 'eslint-plugin-eslint-angular' ]; then if [ ! -f package/fesm2022/$PACKAGE'.mjs' ]; then error_out '31;1' "fesm2015/$PACKAGE.mjs not found!" >&2 exit 1 @@ -95,8 +85,6 @@ do if [ ! -f package/bundles/assets/$PACKAGE/i18n/en.json ]; then if [ $PACKAGE == 'adf-extensions' ]; then echo "no i18n needed" - elif [ $PACKAGE == 'adf-testing' ]; then - echo "no i18n needed" else error_out '31;1' "$PACKAGE i18n not found!" >&2 exit 1 diff --git a/scripts/github/release/deprecate-develop-build.sh b/scripts/github/release/deprecate-develop-build.sh index 01e71466abc..be4bd5c0d80 100755 --- a/scripts/github/release/deprecate-develop-build.sh +++ b/scripts/github/release/deprecate-develop-build.sh @@ -8,7 +8,6 @@ eval projects=( "adf-core" "adf-insights" "adf-content-services" "adf-extensions" - "adf-testing" "adf-process-services" "adf-process-services-cloud" ) diff --git a/tsconfig.e2e.json b/tsconfig.e2e.json index 004f8b7bd3d..f5b77f5c0b5 100644 --- a/tsconfig.e2e.json +++ b/tsconfig.e2e.json @@ -26,8 +26,6 @@ "@alfresco/adf-core/*": ["../lib/core/*"], "@alfresco/adf-process-services-cloud": ["../lib/process-services-cloud"], "@alfresco/adf-process-services-cloud/*": ["../lib/process-services-cloud/*"], - "@alfresco/adf-testing": ["../lib/testing"], - "@alfresco/adf-testing/*": ["../lib/testing/*"] } }, "include": [ diff --git a/tsconfig.json b/tsconfig.json index d8ecf9dbb38..400ea57e640 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -34,7 +34,6 @@ "@alfresco/adf-insights": ["lib/insights/src/public-api.ts"], "@alfresco/adf-process-services": ["lib/process-services/src/public-api.ts"], "@alfresco/adf-process-services-cloud": ["lib/process-services-cloud/src/public-api.ts"], - "@alfresco/adf-testing": ["lib/testing/src/public-api.ts"], "@alfresco/js-api": ["lib/js-api/src/index.ts"] } },