Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
May 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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