Protractor is the end to end test case runner for AngularJS. These end to end test cases can be repurposed to record performance metrics when the scenario is being run. This is a sample repository with an example of how this can be done.
Install all dependencies using npm install
Protractor currently supports only synchronous configurations. Here is the issue asking for support of asynchronous configurations. Till this feature is added, you would need to generate a temporary configuration that would have the browser parameters required for performance analysis. Run to following command to generate conf.js.tmp
.
node index.js --config conf.js
Once the configration file is generated, run protractor against this using
node_modules/.bin/protractor conf.js.tmp
This will run the example spec and also record the performance metrics. Note the calls to perfRunner in lines 4 8 and 16 that initialize, start and stop the performance metrics.
To start using it in your projects,
- Add browser-perf to your project
- Copy index.js and use it in your test case to mark the start and stop of the scenario.
- Ensure that in your build, you generate the configuration, live done in Step 1 above.
Hi,
I've just tested this setup in one of my company project and it seems to work well !
Good job, can't wait to test it more !
One thing I had to do is copy/paste the code from onPrepare protractor config to the generated conf file, because it was not copied during the config generation