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'); }); });