angular4-testing/project-manager/e2e/page-object/task/task-overview.po.ts

38 lines
1.1 KiB
TypeScript

import {AbstractHeaderPage} from "../abstract-header.po";
import {browser, by, element, ElementArrayFinder, ElementFinder, ExpectedConditions} from "protractor";
import {TaskEditPage} from "./task-edit.po";
export class TaskOverviewPage extends AbstractHeaderPage {
neueAufgabeBtn: ElementFinder;
taskEntries: ElementArrayFinder;
constructor() {
super();
super.validatePageHeadline('Aufgaben durchsuchen');
this.neueAufgabeBtn = element(by.linkText('Neue Aufgabe anlegen'));
this.taskEntries = element.all(by.className('task-list-entry'));
}
validateSearchFieldValue(value: string) {
const inputField = element(by.id('search-tasks'));
expect(inputField.getAttribute('value')).toEqual(value);
}
clickNeueAufgabe(): TaskEditPage {
this.neueAufgabeBtn.click();
return new TaskEditPage(true);
}
verifyNewTask(title: string) {
const newEntry = element(by.linkText(title));
browser.wait(ExpectedConditions.presenceOf(newEntry));
}
clickTask(title: string) {
const entry = element(by.linkText(title));
entry.click();
return new TaskEditPage(false);
}
}