Igor Turcanu
Igor Turcanu

Reputation: 65

e2e testing with protractor in angular 2

on back-end i use Spring Boot, on front-end i use Angular 2. i write simple tests for my front-end, but i want to mock my back-end. i search in google but i do not found answer for my question. how to mock back-end on testing with protractor? sorry for my english! thanks!

i tried this: https://www.npmjs.com/package/protractor-mock-backend# but then i found this: https://github.com/angular/protractor/blob/582411b7ad6c0f9176b231dc51dc328b98affbdf/lib/protractor.js#L717

Upvotes: 2

Views: 1368

Answers (2)

Ovidiu Dolha
Ovidiu Dolha

Reputation: 5413

If your backend is via REST, then you could use a simple json-server - this is very basic and can be started prior to e2e (e.g. in protractor's beforeLaunch callback)

(added from comment since it seemed to be a useful answer)

Upvotes: 3

wswebcreation
wswebcreation

Reputation: 2375

The best way to mock you API's with an Angular 2 app is with ng-Apimock. As far as I know the only plugin on the market now that can support local development as well as E2E-testing.

I'm using it in a Angular 2 app for a customer and it works like a charm. There are enough doccs / plugins to get it working with for example grunt, gulp, Anguler-CLI, Angular-seed and so on.

Hope it helps you

Upvotes: 0

Related Questions