mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
adf-testing package (#4152)
* add new lib adf-testing * fix the prefix * Improve package * Add testing project * remove useless stuff * Remove useless code
This commit is contained in:
parent
81ec4ed441
commit
08231bbf33
35
angular.json
35
angular.json
@ -777,6 +777,41 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"testing": {
|
||||
"root": "lib/testing",
|
||||
"sourceRoot": "lib/testing/src",
|
||||
"projectType": "library",
|
||||
"prefix": "adf",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-ng-packagr:build",
|
||||
"options": {
|
||||
"tsConfig": "lib/testing/tsconfig.lib.json",
|
||||
"project": "lib/testing/ng-package.json"
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular-devkit/build-angular:karma",
|
||||
"options": {
|
||||
"main": "lib/testing/src/test.ts",
|
||||
"tsConfig": "lib/testing/tsconfig.spec.json",
|
||||
"karmaConfig": "lib/testing/karma.conf.js"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"options": {
|
||||
"tsConfig": [
|
||||
"lib/testing/tsconfig.lib.json",
|
||||
"lib/testing/tsconfig.spec.json"
|
||||
],
|
||||
"exclude": [
|
||||
"**/node_modules/**"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultProject": "dist"
|
||||
|
@ -15,6 +15,9 @@
|
||||
"@alfresco/adf-process-services-cloud": [
|
||||
"../../lib/process-services-cloud"
|
||||
],
|
||||
"@alfresco/adf-testing": [
|
||||
"../../lib/testing"
|
||||
],
|
||||
"@alfresco/adf-content-services": [
|
||||
"../../lib/content-services"
|
||||
],
|
||||
|
@ -34,6 +34,9 @@
|
||||
],
|
||||
"@alfresco/adf-process-services-cloud": [
|
||||
"../../lib/process-services-cloud"
|
||||
],
|
||||
"@alfresco/adf-testing": [
|
||||
"../../lib/testing"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
import AlfrescoApi = require('alfresco-js-api-node');
|
||||
import TestConfig = require('../../test.config');
|
||||
|
||||
export class ApiService {
|
||||
|
||||
HOST_SSO = TestConfig.adf.hostSso;
|
||||
|
@ -17,7 +17,7 @@
|
||||
import { LoginPage } from '../pages/adf/loginPage';
|
||||
import { NavigationBarPage } from '../pages/adf/navigationBarPage';
|
||||
|
||||
import { HeaderPage } from '../pages/adf/core/headerPage';
|
||||
import { HeaderPage } from '@alfresco/adf-testing';
|
||||
import { SettingsPage } from '../pages/adf/settingsPage';
|
||||
import TestConfig = require('../test.config');
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
import { Util } from '../../util/util';
|
||||
import { element, by, browser, protractor } from 'protractor';
|
||||
|
||||
export class LoginSSOPage {
|
||||
|
||||
ssoButton = element(by.css(`[data-automation-id="login-button-sso"]`));
|
||||
|
31
lib/testing/karma.conf.js
Normal file
31
lib/testing/karma.conf.js
Normal file
@ -0,0 +1,31 @@
|
||||
// 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-istanbul-reporter'),
|
||||
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: ['Chrome'],
|
||||
singleRun: false
|
||||
});
|
||||
};
|
7
lib/testing/ng-package.json
Normal file
7
lib/testing/ng-package.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
|
||||
"dest": "../dist/testing",
|
||||
"lib": {
|
||||
"entryFile": "src/public-api.ts"
|
||||
}
|
||||
}
|
9
lib/testing/package.json
Normal file
9
lib/testing/package.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "@alfresco/adf-testing",
|
||||
"version": "0.0.1",
|
||||
"peerDependencies": {
|
||||
"@angular/common": "^7.1.0",
|
||||
"@angular/core": "^7.1.0",
|
||||
"@alfresco/js-api": "3.0.0-delta18"
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export class ExampleAction {
|
||||
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
/*
|
||||
* Public API Surface of testing
|
||||
*/
|
||||
|
||||
export * from './example.action';
|
20
lib/testing/src/lib/content-services/pages/example.page.ts
Normal file
20
lib/testing/src/lib/content-services/pages/example.page.ts
Normal file
@ -0,0 +1,20 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export class ExamplePage {
|
||||
|
||||
}
|
5
lib/testing/src/lib/content-services/pages/public-api.ts
Normal file
5
lib/testing/src/lib/content-services/pages/public-api.ts
Normal file
@ -0,0 +1,5 @@
|
||||
/*
|
||||
* Public API Surface of testing
|
||||
*/
|
||||
|
||||
export * from './example.page';
|
6
lib/testing/src/lib/content-services/public-api.ts
Normal file
6
lib/testing/src/lib/content-services/public-api.ts
Normal file
@ -0,0 +1,6 @@
|
||||
/*
|
||||
* Public API Surface of testing
|
||||
*/
|
||||
|
||||
export * from './pages/public-api';
|
||||
export * from './actions/public-api';
|
3
lib/testing/src/lib/core/actions/public-api.ts
Normal file
3
lib/testing/src/lib/core/actions/public-api.ts
Normal file
@ -0,0 +1,3 @@
|
||||
/*
|
||||
* Public API Surface of testing
|
||||
*/
|
83
lib/testing/src/lib/core/browser-visibility.ts
Normal file
83
lib/testing/src/lib/core/browser-visibility.ts
Normal file
@ -0,0 +1,83 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { browser, protractor } from 'protractor';
|
||||
let until = protractor.ExpectedConditions;
|
||||
|
||||
const DEFAULT_TIMEOUT = 40000;
|
||||
|
||||
export class BrowserVisibility {
|
||||
|
||||
constructor() {}
|
||||
|
||||
/*
|
||||
* Wait for element is visible
|
||||
*/
|
||||
static waitUntilElementIsVisible(elementToCheck, waitTimeout: number = DEFAULT_TIMEOUT) {
|
||||
let isDisplayed = false;
|
||||
return browser.wait(() => {
|
||||
browser.waitForAngularEnabled();
|
||||
|
||||
elementToCheck.isDisplayed().then(
|
||||
() => {
|
||||
isDisplayed = true;
|
||||
},
|
||||
(err) => {
|
||||
isDisplayed = false;
|
||||
}
|
||||
);
|
||||
return isDisplayed;
|
||||
}, waitTimeout, 'Element is not visible ' + elementToCheck.locator());
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait for element to be clickable
|
||||
*/
|
||||
static waitUntilElementIsClickable(elementToCheck, waitTimeout: number = DEFAULT_TIMEOUT) {
|
||||
let isDisplayed = false;
|
||||
return browser.wait(() => {
|
||||
browser.waitForAngularEnabled();
|
||||
|
||||
elementToCheck.isDisplayed().then(
|
||||
() => {
|
||||
isDisplayed = true;
|
||||
},
|
||||
(err) => {
|
||||
isDisplayed = false;
|
||||
}
|
||||
);
|
||||
return isDisplayed;
|
||||
}, waitTimeout, 'Element is not visible ' + elementToCheck.locator());
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait for element to have value
|
||||
*/
|
||||
static waitUntilElementHasValue(elementToCheck, elementValue, waitTimeout: number = DEFAULT_TIMEOUT) {
|
||||
browser.waitForAngularEnabled();
|
||||
|
||||
browser.wait(until.textToBePresentInElementValue(elementToCheck, elementValue), waitTimeout, 'Element doesn\'t have a value ' + elementToCheck.locator());
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait for element to not be visible
|
||||
*/
|
||||
static waitUntilElementIsNotOnPage(elementToCheck, waitTimeout: number = DEFAULT_TIMEOUT) {
|
||||
return browser.wait(until.not(until.visibilityOf(elementToCheck)), waitTimeout, 'Element is not in the page ' + elementToCheck.locator());
|
||||
}
|
||||
|
||||
}
|
138
lib/testing/src/lib/core/pages/header.page.ts
Normal file
138
lib/testing/src/lib/core/pages/header.page.ts
Normal file
@ -0,0 +1,138 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { element, by, protractor } from 'protractor';
|
||||
import { BrowserVisibility } from '../browser-visibility';
|
||||
|
||||
export class HeaderPage {
|
||||
|
||||
checkBox = element(by.cssContainingText('.mat-checkbox-label', 'Show menu button'));
|
||||
headerColor = element(by.css('option[value="primary"]'));
|
||||
titleInput = element(by.css('input[name="title"]'));
|
||||
iconInput = element(by.css('input[placeholder="URL path"]'));
|
||||
hexColorInput = element(by.css('input[placeholder="hex color code"]'));
|
||||
logoHyperlinkInput = element(by.css('input[placeholder="Redirect URL"]'));
|
||||
logoTooltipInput = element(by.css('input[placeholder="Tooltip text"]'));
|
||||
positionStart = element.all(by.css('mat-radio-button[value="start"]')).first();
|
||||
positionEnd = element.all(by.css('mat-radio-button[value="end"]')).first();
|
||||
sideBarPositionRight = element(by.css('mat-sidenav.mat-drawer.mat-sidenav.mat-drawer-end'));
|
||||
sideBarPositionLeft = element(by.css('mat-sidenav.mat-drawer.mat-sidenav'));
|
||||
|
||||
checkShowMenuCheckBoxIsDisplayed() {
|
||||
return BrowserVisibility.waitUntilElementIsVisible(this.checkBox);
|
||||
}
|
||||
|
||||
checkChooseHeaderColourIsDisplayed() {
|
||||
return BrowserVisibility.waitUntilElementIsVisible(this.headerColor);
|
||||
}
|
||||
|
||||
checkChangeTitleIsDisplayed() {
|
||||
return BrowserVisibility.waitUntilElementIsVisible(this.titleInput);
|
||||
}
|
||||
|
||||
checkChangeUrlPathIsDisplayed() {
|
||||
return BrowserVisibility.waitUntilElementIsVisible(this.iconInput);
|
||||
}
|
||||
|
||||
clickShowMenuButton() {
|
||||
let checkBox = element.all(by.css('mat-checkbox'));
|
||||
BrowserVisibility.waitUntilElementIsVisible(checkBox);
|
||||
return checkBox.get(0).click();
|
||||
}
|
||||
|
||||
changeHeaderColor(color) {
|
||||
let headerColor = element(by.css('option[value="' + color + '"]'));
|
||||
return headerColor.click();
|
||||
}
|
||||
|
||||
checkAppTitle(name) {
|
||||
let title = element(by.cssContainingText('.adf-app-title', name));
|
||||
return BrowserVisibility.waitUntilElementIsVisible(title);
|
||||
}
|
||||
|
||||
addTitle(title) {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.titleInput);
|
||||
this.titleInput.click();
|
||||
this.titleInput.sendKeys(title);
|
||||
this.titleInput.sendKeys(protractor.Key.ENTER);
|
||||
}
|
||||
|
||||
checkIconIsDisplayed(url) {
|
||||
let icon = element(by.css('img[src="' + url + '"]'));
|
||||
BrowserVisibility.waitUntilElementIsVisible(icon);
|
||||
}
|
||||
|
||||
addIcon(url) {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.iconInput);
|
||||
this.iconInput.click();
|
||||
this.iconInput.sendKeys(url);
|
||||
this.iconInput.sendKeys(protractor.Key.ENTER);
|
||||
}
|
||||
|
||||
checkHexColorInputIsDisplayed() {
|
||||
return BrowserVisibility.waitUntilElementIsVisible(this.hexColorInput);
|
||||
}
|
||||
|
||||
checkLogoHyperlinkInputIsDisplayed() {
|
||||
return BrowserVisibility.waitUntilElementIsVisible(this.logoHyperlinkInput);
|
||||
}
|
||||
|
||||
checkLogoTooltipInputIsDisplayed() {
|
||||
return BrowserVisibility.waitUntilElementIsVisible(this.logoTooltipInput);
|
||||
}
|
||||
|
||||
addHexCodeColor(hexCode) {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.hexColorInput);
|
||||
this.hexColorInput.click();
|
||||
this.hexColorInput.sendKeys(hexCode);
|
||||
return this.hexColorInput.sendKeys(protractor.Key.ENTER);
|
||||
}
|
||||
|
||||
addLogoHyperlink(hyperlink) {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.logoHyperlinkInput);
|
||||
BrowserVisibility.waitUntilElementIsClickable(this.logoHyperlinkInput);
|
||||
this.logoHyperlinkInput.click();
|
||||
this.logoHyperlinkInput.sendKeys(hyperlink);
|
||||
return this.logoHyperlinkInput.sendKeys(protractor.Key.ENTER);
|
||||
}
|
||||
|
||||
addLogoTooltip(tooltip) {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.logoTooltipInput);
|
||||
this.logoTooltipInput.click();
|
||||
this.logoTooltipInput.sendKeys(tooltip);
|
||||
return this.logoTooltipInput.sendKeys(protractor.Key.ENTER);
|
||||
}
|
||||
|
||||
sideBarPositionStart() {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.positionStart);
|
||||
return this.positionStart.click();
|
||||
}
|
||||
|
||||
sideBarPositionEnd() {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.positionEnd);
|
||||
return this.positionEnd.click();
|
||||
}
|
||||
|
||||
checkSidebarPositionStart() {
|
||||
return BrowserVisibility.waitUntilElementIsVisible(this.sideBarPositionLeft);
|
||||
}
|
||||
|
||||
checkSidebarPositionEnd() {
|
||||
return BrowserVisibility.waitUntilElementIsVisible(this.sideBarPositionRight);
|
||||
}
|
||||
|
||||
}
|
5
lib/testing/src/lib/core/pages/public-api.ts
Normal file
5
lib/testing/src/lib/core/pages/public-api.ts
Normal file
@ -0,0 +1,5 @@
|
||||
/*
|
||||
* Public API Surface of testing
|
||||
*/
|
||||
|
||||
export * from './header.page';
|
6
lib/testing/src/lib/core/public-api.ts
Normal file
6
lib/testing/src/lib/core/public-api.ts
Normal file
@ -0,0 +1,6 @@
|
||||
/*
|
||||
* Public API Surface of testing
|
||||
*/
|
||||
|
||||
export * from './browser-visibility';
|
||||
export * from './pages/public-api';
|
169
lib/testing/src/lib/process-services/pages/form-fields.page.ts
Normal file
169
lib/testing/src/lib/process-services/pages/form-fields.page.ts
Normal file
@ -0,0 +1,169 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { BrowserVisibility } from '../../core/browser-visibility';
|
||||
import { by, element } from 'protractor';
|
||||
|
||||
export class FormFieldsPage {
|
||||
|
||||
formContent = element(by.css('adf-form'));
|
||||
refreshButton = element(by.css('div[class*="form-reload-button"] mat-icon'));
|
||||
saveButton = element(by.cssContainingText('mat-card-actions[class*="adf-for"] span', 'SAVE'));
|
||||
valueLocator = by.css('input');
|
||||
labelLocator = by.css('label');
|
||||
noFormMessage = element(by.css('span[id*="no-form-message"]'));
|
||||
completedTaskNoFormMessage = element(by.css('div[id*="completed-form-message"] p'));
|
||||
attachFormButton = element(by.id('adf-no-form-attach-form-button'));
|
||||
selectFormDropDownArrow = element.all(by.css('adf-attach-form div[class*="mat-select-arrow"]')).first();
|
||||
selectFormContent = element(by.css('div[class*="mat-select-panel"]'));
|
||||
completeButton = element(by.id('adf-form-complete'));
|
||||
errorMessage = by.css('.adf-error-text-container .adf-error-text');
|
||||
|
||||
setFieldValue(locator, field, value) {
|
||||
let fieldElement: any = element(locator(field));
|
||||
BrowserVisibility.waitUntilElementIsVisible(fieldElement);
|
||||
fieldElement.clear().sendKeys(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
checkWidgetIsVisible(fieldId) {
|
||||
let fieldElement = element.all(by.css(`adf-form-field div[id='field-${fieldId}-container']`)).first();
|
||||
BrowserVisibility.waitUntilElementIsVisible(fieldElement);
|
||||
}
|
||||
|
||||
checkWidgetIsHidden(fieldId) {
|
||||
let hiddenElement = element(by.css(`adf-form-field div[id='field-${fieldId}-container'][hidden]`));
|
||||
BrowserVisibility.waitUntilElementIsVisible(hiddenElement);
|
||||
}
|
||||
|
||||
getWidget(fieldId) {
|
||||
let widget = element(by.css(`adf-form-field div[id='field-${fieldId}-container']`));
|
||||
BrowserVisibility.waitUntilElementIsVisible(widget);
|
||||
return widget;
|
||||
}
|
||||
|
||||
getFieldValue(fieldId, valueLocatorParam) {
|
||||
let value = this.getWidget(fieldId).element(valueLocatorParam || this.valueLocator);
|
||||
BrowserVisibility.waitUntilElementIsVisible(value);
|
||||
return value.getAttribute('value');
|
||||
}
|
||||
|
||||
getFieldLabel(fieldId, labelLocatorParam) {
|
||||
let label = this.getWidget(fieldId).all(labelLocatorParam || this.labelLocator).first();
|
||||
BrowserVisibility.waitUntilElementIsVisible(label);
|
||||
return label.getText();
|
||||
}
|
||||
|
||||
getFieldErrorMessage(fieldId) {
|
||||
let error = this.getWidget(fieldId).element(this.errorMessage);
|
||||
return error.getText();
|
||||
}
|
||||
|
||||
getFieldText(fieldId, labelLocatorParam) {
|
||||
let label = this.getWidget(fieldId).element(labelLocatorParam || this.labelLocator);
|
||||
BrowserVisibility.waitUntilElementIsVisible(label);
|
||||
return label.getText();
|
||||
}
|
||||
|
||||
getFieldPlaceHolder(fieldId, locator = 'input') {
|
||||
let placeHolderLocator = element(by.css(`${locator}#${fieldId}`)).getAttribute('placeholder');
|
||||
BrowserVisibility.waitUntilElementIsVisible(placeHolderLocator);
|
||||
return placeHolderLocator;
|
||||
}
|
||||
|
||||
checkFieldValue(locator, field, val) {
|
||||
BrowserVisibility.waitUntilElementHasValue(element(locator(field)), val);
|
||||
return this;
|
||||
}
|
||||
|
||||
refreshForm() {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.refreshButton);
|
||||
this.refreshButton.click();
|
||||
return this;
|
||||
}
|
||||
|
||||
saveForm() {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
|
||||
BrowserVisibility.waitUntilElementIsClickable(this.saveButton);
|
||||
this.saveButton.click();
|
||||
return this;
|
||||
}
|
||||
|
||||
noFormIsDisplayed() {
|
||||
BrowserVisibility.waitUntilElementIsNotOnPage(this.formContent);
|
||||
return this;
|
||||
}
|
||||
|
||||
checkFormIsDisplayed() {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.formContent);
|
||||
return this;
|
||||
}
|
||||
|
||||
getNoFormMessage() {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.noFormMessage);
|
||||
return this.noFormMessage.getText();
|
||||
}
|
||||
|
||||
getCompletedTaskNoFormMessage() {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.completedTaskNoFormMessage);
|
||||
return this.completedTaskNoFormMessage.getText();
|
||||
}
|
||||
|
||||
clickOnAttachFormButton() {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.attachFormButton);
|
||||
this.attachFormButton.click();
|
||||
return this;
|
||||
}
|
||||
|
||||
selectForm(formName) {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.selectFormDropDownArrow);
|
||||
this.selectFormDropDownArrow.click();
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.selectFormContent);
|
||||
this.selectFormFromDropDown(formName);
|
||||
return this;
|
||||
}
|
||||
|
||||
selectFormFromDropDown(formName) {
|
||||
let formNameElement = element(by.cssContainingText('span', formName));
|
||||
BrowserVisibility.waitUntilElementIsVisible(formNameElement);
|
||||
formNameElement.click();
|
||||
}
|
||||
|
||||
checkWidgetIsReadOnlyMode(fieldId) {
|
||||
let widget = element(by.css(`adf-form-field div[id='field-${fieldId}-container']`));
|
||||
let widgetReadOnly = widget.element(by.css('div[class*="adf-readonly"]'));
|
||||
BrowserVisibility.waitUntilElementIsVisible(widgetReadOnly);
|
||||
return widgetReadOnly;
|
||||
}
|
||||
|
||||
completeForm() {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.completeButton);
|
||||
return this.completeButton.click();
|
||||
}
|
||||
|
||||
setValueInInputById(fieldId, value) {
|
||||
let input: any = element(by.id(fieldId));
|
||||
BrowserVisibility.waitUntilElementIsVisible(input);
|
||||
input.clear().sendKeys(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
isCompleteFormButtonDisabled() {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.completeButton);
|
||||
return this.completeButton.getAttribute('disabled');
|
||||
}
|
||||
}
|
5
lib/testing/src/lib/process-services/pages/public-api.ts
Normal file
5
lib/testing/src/lib/process-services/pages/public-api.ts
Normal file
@ -0,0 +1,5 @@
|
||||
/*
|
||||
* Public API Surface of testing
|
||||
*/
|
||||
|
||||
export * from './form-fields.page';
|
5
lib/testing/src/lib/process-services/public-api.ts
Normal file
5
lib/testing/src/lib/process-services/public-api.ts
Normal file
@ -0,0 +1,5 @@
|
||||
/*
|
||||
* Public API Surface of testing
|
||||
*/
|
||||
|
||||
export * from './pages/public-api';
|
9
lib/testing/src/lib/testing.module.ts
Normal file
9
lib/testing/src/lib/testing.module.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
|
||||
@NgModule({
|
||||
declarations: [],
|
||||
imports: [
|
||||
],
|
||||
exports: []
|
||||
})
|
||||
export class TestingModule { }
|
12
lib/testing/src/lib/testing.service.spec.ts
Normal file
12
lib/testing/src/lib/testing.service.spec.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { TestingService } from './testing.service';
|
||||
|
||||
describe('TestingService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: TestingService = TestBed.get(TestingService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
10
lib/testing/src/lib/testing.service.ts
Normal file
10
lib/testing/src/lib/testing.service.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class TestingService {
|
||||
|
||||
constructor() { }
|
||||
|
||||
}
|
8
lib/testing/src/public-api.ts
Normal file
8
lib/testing/src/public-api.ts
Normal file
@ -0,0 +1,8 @@
|
||||
/*
|
||||
* Public API Surface of testing
|
||||
*/
|
||||
|
||||
export * from './lib/core/public-api';
|
||||
export * from './lib/content-services/public-api';
|
||||
export * from './lib/process-services/public-api';
|
||||
export * from './lib/testing.module';
|
22
lib/testing/src/test.ts
Normal file
22
lib/testing/src/test.ts
Normal file
@ -0,0 +1,22 @@
|
||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||
|
||||
import 'core-js/es7/reflect';
|
||||
import 'zone.js/dist/zone';
|
||||
import 'zone.js/dist/zone-testing';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
|
||||
declare const require: any;
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
getTestBed().initTestEnvironment(
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting()
|
||||
);
|
||||
// Then we find all the tests.
|
||||
const context = require.context('./', true, /\.spec\.ts$/);
|
||||
// And load the modules.
|
||||
context.keys().map(context);
|
32
lib/testing/tsconfig.lib.json
Normal file
32
lib/testing/tsconfig.lib.json
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../out-tsc/lib",
|
||||
"target": "es2015",
|
||||
"module": "es2015",
|
||||
"moduleResolution": "node",
|
||||
"declaration": true,
|
||||
"sourceMap": true,
|
||||
"inlineSources": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"importHelpers": true,
|
||||
"types": [],
|
||||
"lib": [
|
||||
"dom",
|
||||
"es2018"
|
||||
]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"annotateForClosureCompiler": true,
|
||||
"skipTemplateCodegen": true,
|
||||
"strictMetadataEmit": true,
|
||||
"fullTemplateTypeCheck": true,
|
||||
"strictInjectionParameters": true,
|
||||
"enableResourceInlining": true
|
||||
},
|
||||
"exclude": [
|
||||
"src/test.ts",
|
||||
"**/*.spec.ts"
|
||||
]
|
||||
}
|
17
lib/testing/tsconfig.spec.json
Normal file
17
lib/testing/tsconfig.spec.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../out-tsc/spec",
|
||||
"types": [
|
||||
"jasmine",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"src/test.ts"
|
||||
],
|
||||
"include": [
|
||||
"**/*.spec.ts",
|
||||
"**/*.d.ts"
|
||||
]
|
||||
}
|
17
lib/testing/tslint.json
Normal file
17
lib/testing/tslint.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"extends": "../../tslint.json",
|
||||
"rules": {
|
||||
"directive-selector": [
|
||||
true,
|
||||
"attribute",
|
||||
"lib",
|
||||
"camelCase"
|
||||
],
|
||||
"component-selector": [
|
||||
true,
|
||||
"element",
|
||||
"lib",
|
||||
"kebab-case"
|
||||
]
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@
|
||||
"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/"],
|
||||
|
14
scripts/build-testing.sh
Executable file
14
scripts/build-testing.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
cd $DIR/..
|
||||
|
||||
echo "====== Testing ======"
|
||||
echo "====== Build ======"
|
||||
npm run ng-packagr -- -p ./lib/testing/ || exit 1
|
||||
|
||||
echo "====== Move to node_modules ======"
|
||||
rm -rf ./node_modules/@alfresco/adf-testing/ && \
|
||||
mkdir -p ./node_modules/@alfresco/adf-testing/ && \
|
||||
cp -R ./lib/dist/testing/* ./node_modules/@alfresco/adf-testing/
|
@ -7,6 +7,7 @@ eval projects=( "@alfresco/adf-core"
|
||||
"@alfresco/adf-insights"
|
||||
"@alfresco/adf-process-services"
|
||||
"@alfresco/adf-process-services-cloud"
|
||||
"@alfresco/adf-testing"
|
||||
"@alfresco/adf-extensions" )
|
||||
|
||||
show_help() {
|
||||
|
@ -43,6 +43,7 @@ mkdir -p $DIR/../node_modules/@alfresco/adf-core
|
||||
mkdir -p $DIR/../node_modules/@alfresco/adf-content-services
|
||||
mkdir -p $DIR/../node_modules/@alfresco/adf-process-services
|
||||
mkdir -p $DIR/../node_modules/@alfresco/adf-process-services-cloud
|
||||
mkdir -p $DIR/../node_modules/@alfresco/adf-testing
|
||||
mkdir -p $DIR/../node_modules/@alfresco/adf-insights
|
||||
mkdir -p $DIR/../node_modules/@alfresco/adf-extensions
|
||||
|
||||
@ -50,6 +51,7 @@ cp -R $DIR/../lib/dist/core/* $DIR/../node_modules/@alfresco/adf-core
|
||||
cp -R $DIR/../lib/dist/content-services/* $DIR/../node_modules/@alfresco/adf-content-services
|
||||
cp -R $DIR/../lib/dist/process-services/* $DIR/../node_modules/@alfresco/adf-process-services
|
||||
cp -R $DIR/../lib/dist/process-services-cloud/* $DIR/../node_modules/@alfresco/adf-process-services-cloud
|
||||
cp -R $DIR/../lib/dist/process-services-cloud/* $DIR/../node_modules/@alfresco/adf-testing
|
||||
cp -R $DIR/../lib/dist/insights/* $DIR/../node_modules/@alfresco/adf-insights
|
||||
cp -R $DIR/../lib/dist/extensions/* $DIR/../node_modules/@alfresco/adf-extensions
|
||||
|
||||
|
@ -18,7 +18,15 @@
|
||||
"lib": [
|
||||
"es2018",
|
||||
"dom"
|
||||
]
|
||||
],
|
||||
"paths": {
|
||||
"testing": [
|
||||
"dist/testing"
|
||||
],
|
||||
"testing/*": [
|
||||
"dist/testing/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"exclude": [
|
||||
"lib/config",
|
||||
@ -28,4 +36,4 @@
|
||||
"tools",
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user