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 am observing '[11:32:38] E/launcher - Error: Error: Cannot find module './index.js'' when I try to execute the configuration file. I tried placing index file in different location and still observed the same error
This is my file structure. Not sure what is wrong with it. Please help me