- Jasmine - Used for BDD
- PhantomJs - A headless browser. Which helps in testing javascript, can access to dom. Jasmine is used on the top of it.
- Karma - A testing framework for Angular js that uses PhantomJs, jasminejs
- Protactor - Protractor is an end to end testing framework for AngularJS applications. It uses webdriver to control browser activities, it runs on the top of Selenium because it is based on webdriver protocols. Protractor uses Jasmine for its test syntax. So its a nice wrapper over selenium and jasmine.
For E2E testing there are two frameworks
- Angular Scenario
- Protractor
- But Angular Scenario is deprecated as i found on angular documentation, and official site recommends protactor.
##Installation
- Install Node Js (We need node and node package manager)
- Install Protactor as a node module
npm install -g protractor
- Update webdriver-manager
sudo webdriver-manager update
- Make a protractor configuration file Example
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
'browserName': 'chrome'
},
specs: ['./test/e2e/**/*.spec.js'],
jasmineNodeOpts: {
showColors: true
}
}
-
Write some test case and put it inside test/e2e/ Read this ref: https://github.com/daniellmb/angular-test-patterns/blob/master/patterns/e2e.md#end-to-end-testing-angularjs
-
Start the webdriver manager
webdriver-manager start
-
Execute through protractor
protractor protractor-conf.js`
-
Chrome version issue http://lostechies.com/gabrielschenker/2014/04/18/angular-jspart-14-end-to-end-tests/
-
Error: Invalid or corrupt jarfile selenium webdriver-manager
sudo rm /usr/lib/node_modules/protractor/selenium/selenium-server-standalone-2.42.2.jar
sudo touch /usr/lib/node_modules/protractor/selenium/selenium-server-standalone-2.42.2.jar
sudo curl http://selenium-release.storage.googleapis.com/2.42/selenium-server-standalone-2.42.2.jar -o /usr/lib/node_modules/protractor/selenium/selenium-server-standalone-2.42.2.jar