angular4-testing/project-manager/e2e/access/access.e2e-spec.ts

54 lines
2.0 KiB
TypeScript
Raw Normal View History

2017-04-14 03:57:42 +02:00
import {browser, element, by} from 'protractor';
import {AbstractHeaderPage} from "../page-object/abstract-header.po";
import {TaskOverviewPage} from "../page-object/task/task-overview.po";
describe('Access Projectmanager Homepage', function () {
beforeEach(() => {
browser.get('/')
});
it('should start at Dashboard page and brand link should redirect there again', () => {
const startingPage = 'Dashboard';
function validatePage() {
const dashboardNavEntryCssClass = element(by.linkText(startingPage)).element(by.xpath('..')).getAttribute('class');
expect(dashboardNavEntryCssClass).toContain('active');
const heading = element(by.css('h1'));
const headingText = heading.getText();
expect(headingText).toBe(startingPage);
}
validatePage();
const navBarBrand = element(by.className('navbar-brand'));
expect(navBarBrand.getAttribute('href')).toBe(browser.baseUrl + '/#');
navBarBrand.click();
validatePage();
});
it('should provide navigation to "Backlog" via Schnellzugriff button - PageObject', () => {
let headerPage = new AbstractHeaderPage;
headerPage.clickSchnellzugriffFollowedBy('Backlog');
headerPage.validateCurrentUrl('tasks?query=BACKLOG');
headerPage.validatePageHeadline('Aufgaben durchsuchen');
});
it('should provide navigation to "Backlog" via Schnellzugriff button - one PageObject per page', () => {
let headerPage = new AbstractHeaderPage;
headerPage.clickSchnellzugriffFollowedBy('Backlog');
const taskOverviewPage = new TaskOverviewPage;
taskOverviewPage.validateCurrentUrl('tasks?query=BACKLOG');
taskOverviewPage.validateSearchFieldValue('BACKLOG');
});
it('should provide navigation to "In Bearbeitung" via Schnellzugriff button', () => {
let headerPage = new AbstractHeaderPage;
headerPage.clickSchnellzugriffFollowedBy('In Bearbeitung');
const taskOverviewPage = new TaskOverviewPage;
taskOverviewPage.validateCurrentUrl('tasks?query=IN_PROGRESS');
taskOverviewPage.validateSearchFieldValue('IN_PROGRESS');
});
});