Angularjs unit/e2e test using protractor, karma and mocks

Posted: August 8, 2014 in web

Promo Angular Prototype

Versions

node: v0.10.30
npm: 1.4.21
yo: 1.2.1
bower: 1.3.8
grunt: grunt-cli v0.1.13, grunt v0.4.5
angular gen: 0.9.2
karma gen: 0.8.3
protractor gen: 0.2.0

To start I followed this tutorial to scaffold a web using yeoman.
http://yeoman.io/codelab.html

References
AngularJS E2e Testing Using NgMockE2E
http://blog.xebia.com/2014/03/08/angularjs-e2e-testing-using-ngmocke2e/

processHtml – needed for above
https://github.com/dciccale/grunt-processhtml

Running the app
grunt serve

Running the unit test
grunt test

Running mock app for e2e test
grunt e2e

Running e2e test (webdriver)
node_modules/.bin/webdriver-manager start

Running e2e test (protractor)
node_modules/.bin/protractor protractor.conf.js

Deploying/Packaging the app
grunt
Look for the folder ‘dist’

Configure files.
main module -> app/scripts/app.js
mock data -> app/e2e/mock/promo-mocks.js
mocked main module -> app/e2e/e2e-mocks.js
processHtml file -> app/e2e/e2e.html
grunt config -> Gruntfile.js
protractor config -> protractor.conf.js
karma config -> test/karma.conf.js

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s