Skip to content

Commit

Permalink
[ACA-3314] Add cancelButton and noFormTemplate form elements (#5723)
Browse files Browse the repository at this point in the history
* Add method to click on task
  • Loading branch information
Iulia Burcă committed May 22, 2020
1 parent 7a6a86e commit a8251fa
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 4 deletions.
37 changes: 37 additions & 0 deletions lib/testing/src/lib/core/pages/form/form-fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
}
17 changes: 13 additions & 4 deletions lib/testing/src/lib/process-services/pages/task-list.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -43,7 +52,7 @@ export class TaskListPage {
}

async checkTaskListIsLoaded(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.taskList);
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement);
}

getNoTasksFoundMessage(): Promise<string> {
Expand Down

0 comments on commit a8251fa

Please sign in to comment.