angular4-testing/project-manager/e2e/task/edit-task.e2e-spec.ts

54 lines
2.0 KiB
TypeScript
Raw Normal View History

2017-04-14 03:57:42 +02:00
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: ""
}
};
const newTitle = 'Ersten Prototyp mit Angular 4.0 entwickelt';
2017-04-14 03:57:42 +02:00
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'])
2017-04-14 03:57:42 +02:00
});
it('should have updated title in overview after edit, but same task id as before', () => {
browser.get('/tasks/edit/' + dbTask.id);
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);
});
it('should have return to Overview after cancel button click', () => {
browser.get('/tasks/edit/' + dbTask.id);
const taskEditPage = new TaskEditPage(false);
const taskOverviewPage = taskEditPage.cancelSubmitTask();
taskOverviewPage.verifyNewTask(newTitle);
});
2017-04-14 03:57:42 +02:00
});