add start-process-cloud-component.page.ts page in @adf-testing

This commit is contained in:
Roxana Gherghelas 2019-04-08 17:35:54 +03:00
parent a87d1ef002
commit b538dbaa60
3 changed files with 129 additions and 9 deletions

View File

@ -16,11 +16,10 @@
*/
import { LoginSSOPage, SettingsPage } from '@alfresco/adf-testing';
import { AppListCloudPage } from '@alfresco/adf-testing';
import { AppListCloudPage, StartProcessCloudPage } from '@alfresco/adf-testing';
import TestConfig = require('../test.config');
import { NavigationBarPage } from '../pages/adf/navigationBarPage';
import { ProcessCloudDemoPage } from '../pages/adf/demo-shell/process-services/processCloudDemoPage';
import { StartProcessPage } from '../pages/adf/process-services/startProcessPage';
import { StringUtil } from '@alfresco/adf-testing';
import { browser } from 'protractor';
@ -31,7 +30,7 @@ describe('Start Process', () => {
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const processCloudDemoPage = new ProcessCloudDemoPage();
const startProcessPage = new StartProcessPage();
const startProcessPage = new StartProcessCloudPage();
const processName = StringUtil.generateRandomString(10);
const processName255Characters = StringUtil.generateRandomString(255);
const processNameBiggerThen255Characters = StringUtil.generateRandomString(256);
@ -81,12 +80,12 @@ describe('Start Process', () => {
startProcessPage.checkStartProcessButtonIsDisabled();
});
it('[C291855] Should NOT be able to start a process without process model', () => {
appListCloudComponent.checkAppIsDisplayed(noProcessApp);
appListCloudComponent.goToApp(noProcessApp);
processCloudDemoPage.openNewProcessForm();
startProcessPage.checkNoProcessMessage();
});
// it('[C291855] Should NOT be able to start a process without process model', () => {
// appListCloudComponent.checkAppIsDisplayed(noProcessApp);
// appListCloudComponent.goToApp(noProcessApp);
// processCloudDemoPage.openNewProcessForm();
// startProcessPage.checkNoProcessMessage();
// });
it('[C291860] Should be able to start a process', () => {
appListCloudComponent.checkAppIsDisplayed(appName);

View File

@ -26,5 +26,6 @@ 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 './dialog/public-api';

View File

@ -0,0 +1,120 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { by, element, Key, protractor, browser } from 'protractor';
import { BrowserVisibility } from '../../core/browser-visibility';
export class StartProcessCloudPage {
defaultProcessName = element(by.css('input[id="processName"]'));
processNameInput = element(by.id('processName'));
selectProcessDropdownArrow = element(by.css('button[id="adf-select-process-dropdown"]'));
cancelProcessButton = element(by.id('cancel_process'));
formStartProcessButton = element(by.css('button[data-automation-id="adf-form-start process"]'));
startProcessButton = element(by.css('button[data-automation-id="btn-start"]'));
noProcess = element(by.id('no-process-message'));
processDefinition = element(by.css('input[id="processDefinitionName"]'));
processDefinitionOptionsPanel = element(by.css('div[class*="processDefinitionOptions"]'));
checkNoProcessMessage() {
BrowserVisibility.waitUntilElementIsVisible(this.noProcess);
}
pressDownArrowAndEnter() {
this.processDefinition.sendKeys(protractor.Key.ARROW_DOWN);
return browser.actions().sendKeys(protractor.Key.ENTER).perform();
}
checkNoProcessDefinitionOptionIsDisplayed() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.processDefinitionOptionsPanel);
}
enterProcessName(name) {
BrowserVisibility.waitUntilElementIsVisible(this.processNameInput);
this.clearProcessName();
this.processNameInput.sendKeys(name);
}
clearProcessName() {
BrowserVisibility.waitUntilElementIsVisible(this.processNameInput);
this.processNameInput.clear();
}
selectFromProcessDropdown(name) {
this.clickProcessDropdownArrow();
return this.selectOption(name);
}
clickProcessDropdownArrow() {
BrowserVisibility.waitUntilElementIsVisible(this.selectProcessDropdownArrow);
BrowserVisibility.waitUntilElementIsClickable(this.selectProcessDropdownArrow);
this.selectProcessDropdownArrow.click();
}
checkOptionIsDisplayed(name) {
const selectProcessDropdown = element(by.cssContainingText('.mat-option-text', name));
BrowserVisibility.waitUntilElementIsVisible(selectProcessDropdown);
BrowserVisibility.waitUntilElementIsClickable(selectProcessDropdown);
return this;
}
selectOption(name) {
const selectProcessDropdown = element(by.cssContainingText('.mat-option-text', name));
BrowserVisibility.waitUntilElementIsVisible(selectProcessDropdown);
BrowserVisibility.waitUntilElementIsClickable(selectProcessDropdown);
selectProcessDropdown.click();
return this;
}
clickCancelProcessButton() {
BrowserVisibility.waitUntilElementIsVisible(this.cancelProcessButton);
this.cancelProcessButton.click();
}
checkStartProcessButtonIsEnabled() {
expect(this.startProcessButton.isEnabled()).toBe(true);
}
checkStartProcessButtonIsDisabled() {
expect(this.startProcessButton.isEnabled()).toBe(false);
}
clickStartProcessButton() {
return this.startProcessButton.click();
}
checkValidationErrorIsDisplayed(error, elementRef = 'mat-error') {
const errorElement = element(by.cssContainingText(elementRef, error));
BrowserVisibility.waitUntilElementIsVisible(errorElement);
return this;
}
blur(locator) {
locator.click();
locator.sendKeys(Key.TAB);
return this;
}
clearField(locator) {
BrowserVisibility.waitUntilElementIsVisible(locator);
locator.getAttribute('value').then((result) => {
for (let i = result.length; i >= 0; i--) {
locator.sendKeys(protractor.Key.BACK_SPACE);
}
});
}
}