Starting the end to end testing project can be very time consuming task even with a such great tool as Protractor. This boilerplate has intention to provide the minimum ecosystem required to successfully run and maintain the e2e test project.
-
Base library and examples in order to create the Page Objects quickly.
-
Flexible configuration using nconf in order to be able to run different configurations on development , production and any custom environment.
-
Integration with SauceLabs - to easily test against variety of browsers.
-
Reports for test results. jasmine-reporters are integrated inside.
-
helpers.js - containing more than 20 useful functions.
-
ConsolePlugin - to identify possible errors by inspecting console during the tests .
-
Winston logger wrapper to quickly troubleshoot errors in your tests.
-
How to examples - to save your time searching over the internet.
Grunt-Cli,Protractor and Bower need to be installed globally.
npm install -g grunt-cli protractor bower
First ensure the application under test is running :
$ cd example
$ npm install
$ bower install
$ grunt server
$ cd your-test-folder
$ git clone https://github.com/dimaxweb/protractor-fullstack
$ npm install
$ protractor protractor.conf.js
Please see the HomePage.js and HomePage.spec.js examples.
We integrated with nice package called - astrolabe . Package has everything
needed to start creating the custom Page Objects .
We provided flexible wrapper over nconf which makes it possible to pass arguments through the command line, and also add your own configuration files following conventions and industry recommendations (using environment variables) for configuring the NODEJS applications.
- config.json,
- 'config.' + 'NODE_ENV' + '.json',
- 'config.' + 'NODE_ENV' + '.' + 'USER' + '.json'
Your can add more logic use or use more environment variables in configuration/appConfig.js to make it even more flexible.
var appConfig = require(path.resolve(__dirname, 'configuration/appConfig.js'));
//get url of the web server url in your tests
var webServerUrl = appConfig.get('webServerUrl');
Project provides the integration with popular jasmine-reporters package.
Each report provider can be configured per environment , disabled or enabled.
Example : configuration/config.development.json
"reports": {
"jasmineReporters": {
"jasmineReporters.JUnitXmlReporter ": {
"isEnabled": true,
"savePath": "reports/junit",
"consolidateAll": true,
"consolidate": true,
"filePrefix": "juintresults",
"useDotNotation": true,
"package": "Jasmine Results"
},
"jasmineReporters.NUnitXmlReporter ": {
"isEnabled": true,
"savePath": "reports/nunit",
"filename": "nunitresults.xml",
"reportName": "Jasmine Results"
},
"jasmineReporters.TapReporter": {
"isEnabled": false
},
"jasmineReporters.TeamCityReporter": {
"isEnabled": false
},
"jasmineReporters.TerminalReporter": {
"isEnabled": false
}
}
},
SauceLabs integration can be done thorough configuration.
Fully functional example (need to provide your user name and password in configuration).
IMPORTANT:
In order to be able to test sites in local intranet , behind the firewall or just the localhost with Sauce Labs - your will to establish tunnel connection to Sauce Labs with
SauceLabs Connect utility.
Running the bellow command will do all the work for you (download the Sauce Labs connector in first run and then will start it with your account credentials from configuration file)
node /lib/saucelabs-connect.js
Please look inside the helpers.spec.js to the the examples of usage.
Many bugs are not visible form first look and sometime not visible at : javascript errors , not found javascript and css resources,
,etc ... The majority of this errors and warnings are available on browser console.With the help of this module it is easy to monitor errors and warnings on browser console during our test and also to specify if fail test or not.
Please look inside the ConsolePlugin.spec.js for examples of usage.
Scripts for Window and Linux to start the protractor process together with setting environment variables are included in /run folder.
First ensure the application under test is running :
$ cd example
$ npm install
$ bower install
$ grunt server
Run tests
protractor tests/protractor.test.conf
$ git clone https://github.com/dimaxweb/protractor-fullstack
$ npm install
How to examples :
protractor howtos/protractor.howtos.conf
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
We believe that mean should be free and easy to integrate within your AngularJS projects so we chose The MIT License