- 
                Notifications
    
You must be signed in to change notification settings  - Fork 11
 
[Install] JavaScript Client and Config
To make communication with the timings API a bit easier, we have created a number of "timings clients". This page shows you how to install and use the JavaScript client.
- 
To use timings-client-js, add it as a 'devDependency' to your project:
npm install --save-dev timings-client-js - 
Create a config file
Instead of sending a list of parameters to the API on every call to the various endpoints, a config file is used to set default values. Some of the parameters can be overwritten with the client's.getApiParams()function.Copy the sample config from the example below (or from here) to a location on your system - for example:
/etc/timings/perftimings.js. You can now edit your file as needed. - 
Import and initiate the client
const timings = require('timings-client-js'); const perf = new timings.PUtils('/etc/timings/perftimings.js'); 
You can now use this client in your test scenarios. Some example use cases:
- Asserting page load time
 - Asserting API timings
 
Example config file:
module.exports = {
    "PERF_API_URL": "http://<API host>/v2/api/cicd/",
    "api_timeout": 2000,
    "api_params": {
        "sla": {
            "pageLoadTime": 2000
        },
        "baseline": {
            "days": 7,
            "perc": 75,
            "padding": 1.2,
            "incl": {
                "env_target": "_log_"
            }
        },
        "flags": {
            "assertBaseline": true,
            "debug": false,
            "esTrace": false,
            "esCreate": false,
            "passOnFailedAssert": false
        },
        "log": {
            "test_info": "Sample test_info",
            "env_tester": "Sample tester",
            "browser": "Sample browser",
            "env_target": "Sample target",
            "team": "SAMPLE TEAM"
        }
    }
};
more detailed information: https://github.com/godaddy/timings-client-js/blob/master/README.md
- Installation
 - General info
 - Use cases