Skip to content
HAR generator for framework
TypeScript JavaScript HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
src refactor(utils): prevent leaking internal implementation details (#29) Dec 24, 2019
.npmignore feat(network): implement the har generator on base chrome devtools pr… Dec 2, 2019
.prettierignore chore: init repo Nov 28, 2019
LICENSE chore: init repo Nov 28, 2019
package-lock.json feat(plugin): generate a separate har file per test (#26) Dec 23, 2019


Generate HTTP Archive (HAR) while running tests


Run npm i --save-dev @neuralegion/cypress-har-generator to install the plugin.

✴ For details about changes between versions, and information about updates on previous releases, see the Releases tab on GitHub:

Quick Start

First, install cypress-har-generator as development dependency:

npm i --save-dev @neuralegion/cypress-har-generator

Next, go to the cypress's directory and put this code is in your cypress/plugins/index.js file:

const { install, ensureRequiredBrowserFlags } = require('@neuralegion/cypress-har-generator');

module.exports = (on, config) => {
  install(on, config);
  on('before:browser:launch', (browser = {}, args) =>
    ensureRequiredBrowserFlags(browser, args)

After then, you should register commands that perform the manipulation with the HAR file. For that add this module to your support file cypress/support/index.js:


Once the configuration is completed, add the following code into each test:

// cypress/integration/users.spec.js

describe('my tests', () => {
  before(() => {
    // start recording

  after(() => {
    // HAR will be saved as users.spec.har 
    // at the root of the project 

After then, you can start the tests with:

cypress run --browser chrome

✴ Now only Chrome family browsers are supported.

When the cypress finished executing tests, the plugin will save a new archive at the root of the project. By default, a HAR is saved to a file with a name including the current spec’s name: {specName}.har



Starts recording network logs. The plugin records all network requests so long as the browser session is open.



Stops recording and save all requests that have occurred since you run recording to the HAR file.


Pass a filename to change the default naming behavior.


If you want to change the path to the files, you can specify it by setting the hars_folder environment variable.

cypress run --browser chrome --env hars_folders=cypress/hars


Copyright © 2019 NeuraLegion.

This project is licensed under the MIT License - see the LICENSE file for details.

You can’t perform that action at this time.