Code Monkey home page Code Monkey logo

nightwatch-record's Introduction

Nightwatch.js video screen recording via ffmpeg

Record videos of Nightwatch.js test sessions, support multiple Operative Systems like MacOs, Windows(cooming soon), Linux.

Uses ffmpeg to capture a (remote) webdriver desktop screen.

Install

  npm i nightwatch-record --save

Usage

Add the following beforeEach/afterEach or before/after hooks:

module.exports = {
  beforeEach: function (browser, done) {
    require('nightwatch-record').start(browser, done);
  },
  afterEach: function (browser, done) {
    require('nightwatch-record').stop(browser, done);
  }
}

If you are using Mocha test runner, you can use;

  beforeEach(function(browser, done) {
    require('nightwatch-record').start(browser);
    done();
  });

  afterEach(function (browser, done) {
    const testPassed = this.currentTest.state !== 'failed'; // Fix videoSettings.deleteOnSuccess: true issue with other test runners
    require('nightwatch-record').stop(browser, done, testPassed);
  });

Enable the video screen recording in your test settings:

{
  "test_settings": {
    "default": {
      "videos": {
        "fileName": "example", // Required field
        "nameAfterTest": true,
        "format": "mp4",
        "enabled": true,
        "deleteOnSuccess": false,
        "path": "",
        "resolution": "1440x900",
        "fps": 15,
        "input": "",
        "videoCodec": "libx264"
      }
    }
  }
}

If your configuration is sending browser.currentTest.results as undefined, videoSettings.deleteOnSuccess: true` will not work properly. This object is currently only supported in Nightwatch test runner (nightwatchjs/nightwatch#1104).

Please note that testPassed argument has to be boolean. True in case test passed, false if test failed.

You can send same argument with other test runners as well, if you can gain this variable in the afterEach hook.

License

Released under the MIT license.

Author

Ignacio Marenco

nightwatch-record's People

Contributors

imarenco avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.