import {browser} from 'protractor'; import {TaskOverviewPage} from "../page-object/task/task-overview.po"; import {TaskEditPage} from "../page-object/task/task-edit.po"; describe('Edit Task Form', function () { const dbTask = { id: 3, title: "Ersten Prototyp mit Angular 2.0 entwickeln", description: "Der Prototyp soll zeigen, wie Routing und HTTP-Anbindung umgesetzt werden können.", tags: [], state: "IN_PROGRESS", assignee: { name: "Christoph Höller", email: "" } }; it('should load task with its values in edit form', () => { browser.get('/tasks'); const taskOverviewPage = new TaskOverviewPage; taskOverviewPage.validateSearchFieldValue(''); const taskEditPage = taskOverviewPage.clickTask(dbTask.title); // check for correct url - test input field values taskEditPage.validateCurrentUrl('tasks/edit/' + dbTask.id); taskEditPage.validateInput('title', dbTask.title); taskEditPage.validateInput('description', dbTask.description); taskEditPage.validateInput('state', dbTask.state); taskEditPage.validateInput('assignee_name', dbTask.assignee['name']) taskEditPage.validateInput('assignee_email', dbTask.assignee['email']) }); it('should have updated title in overview after edit, but same task id as before', () => { browser.get('/tasks/edit/' + dbTask.id); const newTitle = 'Ersten Prototyp mit Angular 4.0 entwickelt'; const taskEditPage = new TaskEditPage(false); taskEditPage.clearEnterTitle(newTitle); let taskOverviewPage = taskEditPage.submitTaskForm(); // validate that ID is kept after change taskOverviewPage.verifyNewTask(newTitle); taskOverviewPage.clickTask(newTitle).validateCurrentUrl('tasks/edit/' + dbTask.id); }); });