[ACA-3314] Add cancelButton and noFormTemplate form elements (#5723)

* Add method to click on task
This commit is contained in:
Iulia Burcă 2020-05-22 19:09:37 +03:00 committed by GitHub
parent 7a6a86e27e
commit a8251fa7ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 50 additions and 4 deletions

View File

@ -27,9 +27,11 @@ export class FormFields {
valueLocator: Locator = by.css('input');
labelLocator: Locator = by.css('label');
noFormMessage: ElementFinder = element(by.css('.adf-empty-content__title'));
noFormTemplate: ElementFinder = element(by.css('adf-empty-content'));
completedTaskNoFormMessage: ElementFinder = element(by.css('div[id*="completed-form-message"] p'));
attachFormButton: ElementFinder = element(by.id('adf-attach-form-attach-button'));
completeButton: ElementFinder = element(by.id('adf-form-complete'));
cancelButton: ElementFinder = element(by.css('#adf-no-form-cancel-button'));
errorMessage: Locator = by.css('.adf-error-text-container .adf-error-text');
selectFormDropdown = new DropdownPage(element.all(by.css('adf-attach-form div[class*="mat-select-arrow"]')).first());
@ -104,6 +106,17 @@ export class FormFields {
await BrowserActions.click(this.saveButton);
}
async isNoFormTemplateDisplayed(): Promise<boolean> {
try {
await BrowserVisibility.waitUntilElementIsVisible(
this.noFormTemplate
);
return true;
} catch (error) {
return false;
}
}
async noFormIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.formContent);
}
@ -153,4 +166,28 @@ export class FormFields {
await BrowserVisibility.waitUntilElementIsVisible(this.completeButton);
return this.completeButton.getAttribute('disabled');
}
async isCancelButtonDisplayed(): Promise<boolean> {
try {
await BrowserVisibility.waitUntilElementIsVisible(
this.cancelButton
);
return true;
} catch (error) {
return false;
}
}
async isCancelButtonEnabled(): Promise<boolean> {
try {
await this.cancelButton.isEnabled();
return true;
} catch (error) {
return false;
}
}
async clickCancelButton(): Promise<void> {
await BrowserActions.click(this.cancelButton);
}
}

View File

@ -21,10 +21,19 @@ import { BrowserActions } from '../../core/utils/browser-actions';
import { element, by, ElementFinder } from 'protractor';
export class TaskListPage {
rootElement: ElementFinder;
dataTable: DataTableComponentPage;
noTasksFound: ElementFinder;
noTasksFound: ElementFinder = element(by.css('div[class="adf-empty-content__title"]'));
taskList: ElementFinder = element(by.css('adf-tasklist'));
dataTable: DataTableComponentPage = new DataTableComponentPage(this.taskList);
constructor(
rootElement: ElementFinder = element.all(by.css('adf-tasklist')).first()
) {
this.rootElement = rootElement;
this.dataTable = new DataTableComponentPage(this.rootElement);
this.noTasksFound = this.rootElement.element(
by.css('div[class="adf-empty-content__title"]')
);
}
getDataTable() {
return this.dataTable;
@ -43,7 +52,7 @@ export class TaskListPage {
}
async checkTaskListIsLoaded(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.taskList);
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement);
}
getNoTasksFoundMessage(): Promise<string> {