[ACA-3188] Add methods for ADW+APS1 e2e (#6816)

* Add isRemoveFileOptionDisplayed method

* Add checkStartProcessFormIsDisplayed method

* delete unused class

* add setUserTaskName to e2e-displayValue-process

* delete unused class

* update isRemoveFileOptionDisplayed method

* Create separate PO for start-form component

* Export new PO

* tslint fix

* convert selectors to TestElement

* improve test-element isDisplayed method

* rename method

* Remove methods
This commit is contained in:
Iulia Burcă
2021-04-09 13:41:29 +03:00
committed by GitHub
parent 8ee091ac54
commit 318ce0e346
5 changed files with 34 additions and 5 deletions

View File

@@ -19,3 +19,4 @@ export * from './widgets/public-api';
export * from './form-fields'; export * from './form-fields';
export * from './form.page'; export * from './form.page';
export * from './start-form.page';

View File

@@ -0,0 +1,22 @@
/*!
* @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 { TestElement } from '../../test-element';
export class StartFormPage {
startProcessForm = TestElement.byCss('.adf-start-form-container');
}

View File

@@ -18,6 +18,7 @@
import { FormFields } from '../form-fields'; import { FormFields } from '../form-fields';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api'; import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
import { Locator, element, by, browser } from 'protractor'; import { Locator, element, by, browser } from 'protractor';
import { TestElement } from '../../../test-element';
export class AttachFileWidgetPage { export class AttachFileWidgetPage {
@@ -30,7 +31,7 @@ export class AttachFileWidgetPage {
attachedFileOptions = element(by.css('.mat-menu-panel .mat-menu-content')); attachedFileOptions = element(by.css('.mat-menu-panel .mat-menu-content'));
viewFileOptionButton = element(by.css(`.mat-menu-panel .mat-menu-content button[id$="show-file"]`)); viewFileOptionButton = element(by.css(`.mat-menu-panel .mat-menu-content button[id$="show-file"]`));
downloadFileOptionButton = element(by.css(`.mat-menu-panel .mat-menu-content button[id$="download-file"]`)); downloadFileOptionButton = element(by.css(`.mat-menu-panel .mat-menu-content button[id$="download-file"]`));
removeFileOptionButton = element(by.css(`.mat-menu-panel .mat-menu-content button[id$="remove"]`)); removeFileOptionButton = TestElement.byCss(`.mat-menu-panel .mat-menu-content button[id$="remove"]`);
async attachFile(fieldId, fileLocation): Promise<void> { async attachFile(fieldId, fileLocation): Promise<void> {
const widget = await this.formFields.getWidget(fieldId); const widget = await this.formFields.getWidget(fieldId);
@@ -88,14 +89,14 @@ export class AttachFileWidgetPage {
await BrowserVisibility.waitUntilElementIsVisible(this.attachedFileOptions); await BrowserVisibility.waitUntilElementIsVisible(this.attachedFileOptions);
await BrowserVisibility.waitUntilElementIsVisible(this.viewFileOptionButton); await BrowserVisibility.waitUntilElementIsVisible(this.viewFileOptionButton);
await BrowserVisibility.waitUntilElementIsVisible(this.downloadFileOptionButton); await BrowserVisibility.waitUntilElementIsVisible(this.downloadFileOptionButton);
await BrowserVisibility.waitUntilElementIsVisible(this.removeFileOptionButton); await this.removeFileOptionButton.waitVisible();
} }
async checkAttachFileOptionsCompletedForm(): Promise <void> { async checkAttachFileOptionsCompletedForm(): Promise <void> {
await BrowserVisibility.waitUntilElementIsVisible(this.attachedFileOptions); await BrowserVisibility.waitUntilElementIsVisible(this.attachedFileOptions);
await BrowserVisibility.waitUntilElementIsVisible(this.viewFileOptionButton); await BrowserVisibility.waitUntilElementIsVisible(this.viewFileOptionButton);
await BrowserVisibility.waitUntilElementIsVisible(this.downloadFileOptionButton); await BrowserVisibility.waitUntilElementIsVisible(this.downloadFileOptionButton);
await BrowserVisibility.waitUntilElementIsNotVisible(this.removeFileOptionButton); await this.removeFileOptionButton.waitNotVisible();
} }
async viewAttachedFile(): Promise<void> { async viewAttachedFile(): Promise<void> {
@@ -107,7 +108,7 @@ export class AttachFileWidgetPage {
} }
async removeAttachedFile(): Promise<void> { async removeAttachedFile(): Promise<void> {
await BrowserActions.click(this.removeFileOptionButton); await this.removeFileOptionButton.click();
} }
async viewFileEnabled(): Promise<boolean> { async viewFileEnabled(): Promise<boolean> {

View File

@@ -143,7 +143,12 @@ export class TestElement {
* Test whether this element is currently displayed. * Test whether this element is currently displayed.
*/ */
async isDisplayed(): Promise<boolean> { async isDisplayed(): Promise<boolean> {
return this.elementFinder.isDisplayed(); try {
await this.elementFinder.isDisplayed();
return true;
} catch {
return false;
}
} }
/** /**