diff --git a/project-manager/e2e/task/create-new-task.e2e-spec.ts b/project-manager/e2e/task/create-new-task.e2e-spec.ts index 2c792e5..74eeb3b 100644 --- a/project-manager/e2e/task/create-new-task.e2e-spec.ts +++ b/project-manager/e2e/task/create-new-task.e2e-spec.ts @@ -24,6 +24,7 @@ describe('Create New Task Form', function () { const taskEditPage = new TaskEditPage(true); taskEditPage.clearEnterTitle(testTitle); taskEditPage.clearEnterDescription(''); + browser.pause(); taskEditPage.validateError('title'); }); diff --git a/project-manager/karma.conf.js b/project-manager/karma.conf.js index b51d050..0f94c51 100644 --- a/project-manager/karma.conf.js +++ b/project-manager/karma.conf.js @@ -49,7 +49,6 @@ module.exports = function(config) { // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor preprocessors: { './src/test.ts': ['@angular/cli'] - }, diff --git a/project-manager/projects-server/db.json b/project-manager/projects-server/db.json index ed5badd..20f8b7a 100644 --- a/project-manager/projects-server/db.json +++ b/project-manager/projects-server/db.json @@ -2,9 +2,13 @@ "tasks": [ { "id": 3, - "title": "Ersten Prototyp mit Angular 2.0 entwickeln", + "title": "Ersten Prototyp mit Angular 4.0 entwickeln", "description": "Der Prototyp soll zeigen, wie Routing und HTTP-Anbindung umgesetzt werden können.", - "tags": [], + "tags": [ + { + "label": "news" + } + ], "state": "BACKLOG", "assignee": { "name": "Christoph Höllers", @@ -54,4 +58,4 @@ "change_settings": false } ] -} \ No newline at end of file +} diff --git a/project-manager/projects-server/test.json b/project-manager/projects-server/test.json index 568c627..7506597 100644 --- a/project-manager/projects-server/test.json +++ b/project-manager/projects-server/test.json @@ -2,7 +2,7 @@ "tasks": [ { "id": 3, - "title": "Ersten Prototyp mit Angular 4.0 entwickelt", + "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", @@ -57,15 +57,6 @@ "state": "IN_PROGRESS", "title": "New Task", "id": 9 - }, - { - "assignee": { - "email": "testuser@test.com" - }, - "tags": [], - "state": "BACKLOG", - "title": "valid title", - "id": 10 } ] } \ No newline at end of file diff --git a/project-manager/src/app/blog/blog.component.spec.ts b/project-manager/src/app/blog/blog.component.spec.ts index cb5481f..85617ed 100644 --- a/project-manager/src/app/blog/blog.component.spec.ts +++ b/project-manager/src/app/blog/blog.component.spec.ts @@ -2,6 +2,8 @@ import {BlogComponent} from './blog.component' import {TestBed} from "@angular/core/testing"; import {RouterTestingModule} from "@angular/router/testing"; import {CUSTOM_ELEMENTS_SCHEMA} from "@angular/core"; +import {By} from "@angular/platform-browser"; +import {FormsModule} from "@angular/forms"; describe('Blog Component', () => { @@ -50,12 +52,16 @@ describe('Blog Component', () => { }); }); - describe('Template Driven Form Integration Test', () => { + describe('Basic DOM Form Test ', () => { let fixture; let instance; let element; + const testTitle = 'testTitle'; + const testImage = 'imageUrl'; + const testText = 'testText'; + beforeEach(() => { TestBed.configureTestingModule({ imports: [RouterTestingModule.withRoutes([])], @@ -65,25 +71,34 @@ describe('Blog Component', () => { }); fixture = TestBed.createComponent(BlogComponent); instance = fixture.componentInstance; - element = fixture.nativeElement; }); - it('should call create method with provided field input', () => { + it('should call create method with provided field input - using nativeElement', () => { + element = fixture.nativeElement; const spy = spyOn(instance, 'createBlogEntry'); - - const testTitle = 'testTitle'; - const testImage = 'imageUrl'; - const testText = 'testText'; - // beachten : value würde immer funktionieren um Werte als Variable - // übertragbar einzutragen, textContent hingegen nur bei textarea - element.querySelector('div /deep/ div > #title').value = testTitle; - element.querySelector('div /deep/ div > #image').value = testImage; - element.querySelector('div /deep/ div > #text').textContent = testText; - element.querySelector('div /deep/ div > button').click(); + // übertragbar einzutragen/ auszulesen, textContent hingegen nur bei textarea + element.querySelector('div > #title').value = testTitle; + element.querySelector('.form :nth-child(2) > input').value = testImage; + element.querySelector('#text').textContent = testText; + element.querySelector('div > button').click(); expect(spy).toHaveBeenCalledWith(testTitle, testImage, testText); - }) + }); + + + it('should call create method with provided field input - using debugElement', () => { + element = fixture.debugElement; + const spy = spyOn(instance, 'createBlogEntry'); + // beachten : value würde immer funktionieren um Werte als Variable + // übertragbar einzutragen/ auszulesen, textContent hingegen nur bei textarea + element.query(By.css('#title')).nativeElement.value = testTitle; + element.query(By.css('.form :nth-child(2) > input')).nativeElement.value = testImage; + element.query(By.css('#text')).nativeElement.textContent = testText; + element.query(By.css('button')).nativeElement.click(); + + expect(spy).toHaveBeenCalledWith(testTitle, testImage, testText); + }); }); diff --git a/project-manager/src/app/login/login.component.spec.ts b/project-manager/src/app/login/login.component.spec.ts index da24aa1..b170260 100644 --- a/project-manager/src/app/login/login.component.spec.ts +++ b/project-manager/src/app/login/login.component.spec.ts @@ -7,7 +7,7 @@ import {MockEmptyClass} from "../mocks/mock-empty-class"; import Spy = jasmine.Spy; -describe('Login Component Template Driven Form Test with Spy', () => { +describe('Login Component UI Driven Form Test with Spy', () => { beforeEach(() => { TestBed.configureTestingModule({