Skip to content

Commit

Permalink
[ACA-3188] Add methods for ADW+APS1 e2e (#6816)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Iulia Burcă authored and Thomas Hunter committed Apr 9, 2021
1 parent 719b51e commit 723ccaf
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 5 deletions.
Binary file modified lib/cli/resources/e2e-Application.zip
Binary file not shown.
1 change: 1 addition & 0 deletions lib/testing/src/lib/core/pages/form/public-api.ts
Expand Up @@ -19,3 +19,4 @@ export * from './widgets/public-api';

export * from './form-fields';
export * from './form.page';
export * from './start-form.page';
22 changes: 22 additions & 0 deletions lib/testing/src/lib/core/pages/form/start-form.page.ts
@@ -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');
}
Expand Up @@ -18,6 +18,7 @@
import { FormFields } from '../form-fields';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
import { Locator, element, by, browser } from 'protractor';
import { TestElement } from '../../../test-element';

export class AttachFileWidgetPage {

Expand All @@ -30,7 +31,7 @@ export class AttachFileWidgetPage {
attachedFileOptions = element(by.css('.mat-menu-panel .mat-menu-content'));
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"]`));
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> {
const widget = await this.formFields.getWidget(fieldId);
Expand Down Expand Up @@ -88,14 +89,14 @@ export class AttachFileWidgetPage {
await BrowserVisibility.waitUntilElementIsVisible(this.attachedFileOptions);
await BrowserVisibility.waitUntilElementIsVisible(this.viewFileOptionButton);
await BrowserVisibility.waitUntilElementIsVisible(this.downloadFileOptionButton);
await BrowserVisibility.waitUntilElementIsVisible(this.removeFileOptionButton);
await this.removeFileOptionButton.waitVisible();
}

async checkAttachFileOptionsCompletedForm(): Promise <void> {
await BrowserVisibility.waitUntilElementIsVisible(this.attachedFileOptions);
await BrowserVisibility.waitUntilElementIsVisible(this.viewFileOptionButton);
await BrowserVisibility.waitUntilElementIsVisible(this.downloadFileOptionButton);
await BrowserVisibility.waitUntilElementIsNotVisible(this.removeFileOptionButton);
await this.removeFileOptionButton.waitNotVisible();
}

async viewAttachedFile(): Promise<void> {
Expand All @@ -107,7 +108,7 @@ export class AttachFileWidgetPage {
}

async removeAttachedFile(): Promise<void> {
await BrowserActions.click(this.removeFileOptionButton);
await this.removeFileOptionButton.click();
}

async viewFileEnabled(): Promise<boolean> {
Expand Down
7 changes: 6 additions & 1 deletion lib/testing/src/lib/core/test-element.ts
Expand Up @@ -143,7 +143,12 @@ export class TestElement {
* Test whether this element is currently displayed.
*/
async isDisplayed(): Promise<boolean> {
return this.elementFinder.isDisplayed();
try {
await this.elementFinder.isDisplayed();
return true;
} catch {
return false;
}
}

/**
Expand Down

0 comments on commit 723ccaf

Please sign in to comment.