All Projects → axemclion → karma-telemetry

axemclion / karma-telemetry

Licence: other
Karma Framework for running performance tasks using Telemetry

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to karma-telemetry

alef-component
Alef Component for Modern Web Apps.
Stars: ✭ 46 (+27.78%)
Mutual labels:  web-performance
rollup-plugin-istanbul
Seamless integration between Rollup and Istanbul
Stars: ✭ 39 (+8.33%)
Mutual labels:  karma
performance-budgets
performance-budgets gives you a simple way to check and stay on top of performance
Stars: ✭ 56 (+55.56%)
Mutual labels:  web-performance
generator-speedseed
Oriented to components, allow create/choice template, multiple configuration with easy maintenance
Stars: ✭ 13 (-63.89%)
Mutual labels:  karma
angular-material-boilerplate
A straightforward and well structured boilerplate based on Google's Angular Material project.
Stars: ✭ 28 (-22.22%)
Mutual labels:  karma
metadatamanagement
Metadatamanagement (MDM) - Data Search for Higher Education Research and Science Studies
Stars: ✭ 21 (-41.67%)
Mutual labels:  karma
karma-reporter
A plugin for running clojurescript tests with Karma.
Stars: ✭ 23 (-36.11%)
Mutual labels:  karma
Website-Audit
It's an open-source report template that guides web professionals thought steps to audit any website in terms of the page speed and technical SEO optimisation.
Stars: ✭ 18 (-50%)
Mutual labels:  web-performance
angular-unit-testing-examples
Showroom for different Angular unit testing concepts
Stars: ✭ 19 (-47.22%)
Mutual labels:  karma
perflint
PerfLint is a tool to identify unexpected performance levels of a Website
Stars: ✭ 69 (+91.67%)
Mutual labels:  web-performance
angular2-typescript-recipe
A webapp structure template, containing what I find to be good practices for starting a web project
Stars: ✭ 15 (-58.33%)
Mutual labels:  karma
react-ssr-spa
Server side rendered single page app using reactjs official libraries.
Stars: ✭ 30 (-16.67%)
Mutual labels:  karma
angular-karma test-explorer
vscode extension for easy angular testing and debugging
Stars: ✭ 67 (+86.11%)
Mutual labels:  karma
karma-expect
Expect.js adapter for Karma test runner
Stars: ✭ 12 (-66.67%)
Mutual labels:  karma
blazingly-ssr
A blazing fast server side rendering & project optimiser cli tool using Parcel (POC/Experiment)
Stars: ✭ 41 (+13.89%)
Mutual labels:  web-performance
plugin-lighthouse
A simple sitespeed.io lighthouse plugin to collect few performance metrics
Stars: ✭ 14 (-61.11%)
Mutual labels:  web-performance
ngx-zombie-compiler
Fast JiT compiler for Angular testing
Stars: ✭ 15 (-58.33%)
Mutual labels:  karma
qoopido.demand
Promise like module loader with automatic resolution of nested dependencies using XHR requests and localStorage caching to dynamically load modules, legacy JavaScript, CSS, text and bundles. Supports custom handler and plugins as well.
Stars: ✭ 36 (+0%)
Mutual labels:  web-performance
tropic
🍍 Test Runner Library
Stars: ✭ 29 (-19.44%)
Mutual labels:  karma
Karma-mocha-example
Karma to drive mocha
Stars: ✭ 19 (-47.22%)
Mutual labels:  karma

#karma-telemetry

Adapter for running the Chromium Telemetry performance benchmarks for Karma.

About

This plugin runs with Karma and is ideal for testing the rendering performance of components in frameworks. It reports various rendering metrics like first paint time, mean frame time, load time, etc. It can be integrated with continuous integration systems to ensure that the performance of components do not degrade over time.

Usage Example

It can be used for Topcoat components to generate graphs like these. When expensive styles with blur or gradients are added, the performance of components may suffer and this plugin could be used to catch them.

Try it out now !

  1. Clone this project
  2. Run npm install
  3. Run grunt test (or karma start, if you have karma installed).
  4. You should see browsers open and a gradient-circle scroll.
  5. Once the browsers close, open test-results.xml (or the test-results folder) to see the various rendering performance metrics that were recorded.

Installation

The easiest way is to keep karma-telemetry as a devDependency in your package.json.

{
  "devDependencies": {
    "karma": "~0.10",
    "karma-telemetry": "*"
  }
}

You can simple do it by:

npm install karma-telemetry --save-dev

Since this is a Karma framework, you would need to use the Karma testing framework.

Configuration

Following code shows the default configuration.

// karma.conf.js
module.exports = function(config) {
  config.set({
    // This is the name of the framework for running telemetry
    frameworks: ['telemetry'],

    // We need to open the test cases in a new window instead of an iFrame
    // To be able to record the paint times accurately 
    client: {
      useIframe: false
    },

    // Each test case represents a rendering metric.
    // The Junit reporter can be used to see times of individual metrics
    reporters: ['junit', 'progress'],
    junitReporter: {
      outputFile: 'test-results/test-results.xml',
      suite: ''
    },

    // To enable more accurate rendering benchmarking, firefox and chrome have to be started with special flags. 
    // Other browsers can be started normally
    browsers: [
      'firefox_perf',
      'chrome_perf'
    ],
    customLaunchers: {
      chrome_perf: {
        base: 'Chrome',
        flags: ['--disable-popup-blocking', '--enable-gpu-benchmarking', '--enable-threaded-compositing']
      },
      firefox_perf: {
        base: 'Firefox',
        prefs: {
          'dom.send_after_paint_to_content': true,
          'dom.disable_open_during_load': false
        }
      },

      // Browsers on Saucelabs also need the following configuration
      sauce_chrome: {
        base: 'SauceLabs',
        browserName: 'chrome',
        chromeOptions: {
          args: ['--enable-gpu-benchmarking', '--disable-popup-blocking', '--enable-thread-composting']
        },
        'disable-popup-handler': true
      },

      // In case of firefox, remember to install the firefox profile creator. 
      // This is a modified version of the firefox-profile-js with a Synchronous method and can be installed using
      // $ npm install axemclion/firefox-profile-js
      sauce_firefox: {
        base: 'SauceLabs',
        browserName: 'firefox',
        firefox_profile: (function() {
          // Note that the firefox-profile module is 
          var FirefoxProfile = require('firefox-profile');
          var fp = new FirefoxProfile();
          fp.setPreference('dom.send_after_paint_to_content', true);
          fp.setPreference('dom.disable_open_during_load', false);
          fp.updatePreferences();
          return fp.encodedSync();
        }()),
        'disable-popup-handler': true
      }
    },
  });
};

In case of using Firefox on saucelabs, remember to install the firefox profile generator using npm install axemclion/firefox-profile-js. You can look at the project's karma.conf.js for a full configuration

Writing tests

Note that Karma adds all the Javascript test files into a single HTML file for testing. It is ideal to test one component at a time and hence it may be better to dynamically generate a karma configuration for each test case. In case of grunt, look at the defination of the test task in Gruntfile.js. The test case should append the component to the document body sufficient number of times to allow the page to scroll. Look at test/test.js for an example.

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].