All Projects → axemclion → Protractor Perf

axemclion / Protractor Perf

E2E test framework to check for performance regressions in Angular apps

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Protractor Perf

Guess
🔮 Libraries & tools for enabling Machine Learning driven user-experiences on the web
Stars: ✭ 6,762 (+7017.89%)
Mutual labels:  web-performance
Angular Webpack Starter
A complete Angular 6 and Webpack 4 starter seed with minimal and full featured branches. Full featured branch includes: Material Design 2 (Bootstrap 4 branch available as well), @ngrx, HMR, DLLs and optional use of Universal for server-side rendering - Supports AOT (offline) compilation, sync and lazy loading. Karma/Protractor for e2e/unit tests.
Stars: ✭ 911 (+858.95%)
Mutual labels:  protractor
Time Slicing
Break down long tasks into smaller tasks, avoid blocking the main process.
Stars: ✭ 74 (-22.11%)
Mutual labels:  web-performance
Browser Perf
Performance Metrics for Web Browsers
Stars: ✭ 930 (+878.95%)
Mutual labels:  web-performance
Cucumber Protractor Harness
Simple starter project for incorporating cucumber (2.3.1) with protractor
Stars: ✭ 9 (-90.53%)
Mutual labels:  protractor
Aurelia
Aurelia 2, a standards-based, front-end framework designed for high-performing, ambitious applications.
Stars: ✭ 995 (+947.37%)
Mutual labels:  web-performance
Awesome Pagespeed Metrics
⚡Metrics to help understand page speed and user experience
Stars: ✭ 585 (+515.79%)
Mutual labels:  web-performance
Surf N Perf
Micro-library for gathering web page performance data
Stars: ✭ 89 (-6.32%)
Mutual labels:  web-performance
Protractor Firefox Support
Custom implementation of Actions class functions for e2e testing with Protractor in Firefox
Stars: ✭ 20 (-78.95%)
Mutual labels:  protractor
Protractor Best Practices
Stars: ✭ 65 (-31.58%)
Mutual labels:  protractor
Gulp Angular Protractor
Gulp plugin to run protractor tests
Stars: ✭ 25 (-73.68%)
Mutual labels:  protractor
Protractor Pretty Html Reporter
A jasmine reporter that produces an easy to use html report to analyze protractor test results.
Stars: ✭ 9 (-90.53%)
Mutual labels:  protractor
Awesome Mobile Web Development
All that you need to create a great mobile web experience
Stars: ✭ 1,046 (+1001.05%)
Mutual labels:  web-performance
Pagespeed Score
DEPRECATED - use GoogleChrome/lighthouse-ci instead
Stars: ✭ 18 (-81.05%)
Mutual labels:  web-performance
Protractor
E2E test framework for Angular apps
Stars: ✭ 8,792 (+9154.74%)
Mutual labels:  protractor
Generator M Ionic
Advanced workflows and setup for building rock-solid Ionic apps
Stars: ✭ 677 (+612.63%)
Mutual labels:  protractor
Bxbot Ui Angular
An Angular app for administering BX-bot.
Stars: ✭ 21 (-77.89%)
Mutual labels:  protractor
Docker Protractor Headless
Protractor end to end testing for AngularJS - dockerised and headless with real Chrome.
Stars: ✭ 90 (-5.26%)
Mutual labels:  protractor
Quicklink
⚡️Faster subsequent page-loads by prefetching in-viewport links during idle time
Stars: ✭ 9,176 (+9558.95%)
Mutual labels:  web-performance
Assassin
Assassin is a decentralized database that uses background threads to kill slow JavaScript.
Stars: ✭ 57 (-40%)
Mutual labels:  web-performance

Protractor-Perf

Just like Protractor is the end to end test case runner for AngularJS to check for functional regressions, this project is a way check for performance regressions while reusing the same test cases.

Usage

Install protractor-perf using npm install -g protractor-perf.

Protractor test cases are re-used to run scenarios where performance needs to be measured. Protractor-perf can be used just like protractor, just that the test-cases need to be instrumented to indicated when to start and stop measuring performance.

Protractor is usually invoked using $ protractor conf.js. Use $ protractor-perf conf.js instead to start measuring performance.

The config file is the same configuration file used for protractor tests.

Note: If you run selenium using protractor's webdriver-manager, you would need to specify seleniumPort and selenium keys in the config file, to explicitly specify the port on which the selenium server will run. This port will also be picked up by protractor-perf. See ./test/conf.js as an example.

When the instrumented test cases are run using protractor, the code related to performance is a no-op. This way, adding instrumentation does not break your ability to run protractor to just test for functionality.

Instrumenting the test cases

The test case need to specify when to start and stop measuring performance metrics for a certain scenario. The following code is an example of a test case, with perf code snippets added.

var PerfRunner = require('..');
describe('angularjs homepage todo list', function() {
	var perfRunner = new PerfRunner(protractor, browser);

	it('should add a todo', function() {
		browser.get('http://www.angularjs.org');
		perfRunner.start();

		element(by.model('todoList.todoText')).sendKeys('write a protractor test');
		element(by.css('[value="add"]')).click();

		perfRunner.stop();

		if (perfRunner.isEnabled) {
			expect(perfRunner.getStats('meanFrameTime')).toBeLessThan(60);
		};

		var todoList = element.all(by.repeater('todo in todoList.todos'));
		expect(todoList.count()).toEqual(3);
		expect(todoList.get(2).getText()).toEqual('write a protractor test');

	});
});

The four statements to note are

  1. Initialize the Perf monitor using new ProtractorPerf(protractor, browser)
  2. To start measuring the perf, use perf.start()
  3. Once the scenario that you would like to perf test completes, use perf.stop()
  4. Finally, use perf.getStats('statName') in expect statements to ensure that all the performance metrics are within the acceptable range.

The perf.isEnabled is needed to ensure that perf metrics are not tested when the test case is run using protractor directly.

Metrics measured

protractor-perf is based on browser-perf. browser-perf measures the metrics that can be tested for regressions. Look at browser-perf's wiki page for more information about the project.

Grunt Integration

Invoke protractor-perf from a GruntFile as below

module.exports = function(grunt) {
  var protractorperf = require('protractor-perf');
  grunt.registerTask('protractorperf', function() {
    var donerun = this.async();
    // Optional config Object that overwrites properties of conf.js.
    // Useful to set property values from grunt.option()
    var argv = {
      selenium: 'http://localhost:54321/wd/hub',
      seleniumPort: 54321
    };
    protractorperf.run('./merci-perf-conf.js', donerun, argv); // config file
  });
  grunt.registerTask('run', ['protractorperf']);
};
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].