Exploring how one can generate product demo videos from Cypress tests
Last updated 2 months ago by bahmutov .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install cypress-movie 
SYNC missed versions from official npm registry.

cypress-movie ci status renovate-app badge Trees planted this month

Exploring how one can generate product demo videos from Cypress tests

Example capturing high resolution video of the test run with additional message pop ups (using tiny-toast library injected on cy.visit)

Video at 1920x1080

The movies are generated at 1920x1080, the headless browser is set to the same size. The command log is hidden, thus the app takes the entire video. Here is a still from a movie generated on CI with its dimensions shown.

Related video: WeAreDevs presentation - start watching at minute 32. Presentation slides at


Requires Node v10+

# using NPM
$ npm i -D cypress-movie
# using Yarn
$ yarn add -D cypress-movie

Now you should be able to use cypress-movie command, see Movies

This project requires native extensions to perform image resizing, thus in your project's cypress.json file should include

  "nodeVersion": "system"


When using cypress run the headless browser is set to use 1920x1080 resolution from the cypress/plugins/index.js file. The viewport width and height are also set to the same values using the config object. During the test run, the Command Log is hidden before the test, see cypress/support/index.js file.

Thus, if you have Chrome browser installed, generate full movies in cypress/videos

npm run chrome


You can control the plugin via environment variables or env object inside cypress.json file.

  "env": {
    "cypress-movie": {
      "enabled": true,
      "cursorTracking": {
        "enabled": false,
        "shape": "dot" // Valid values: "dot", "arrow"
      "width": 1920,
      "height": 640

Note: these options change the movie output, they do not disable individual commands.


You can include these commands from the Cypress support file

// cypress/support/index.js
import 'cypress-movie/commands'


// all parameters are optional
cy.toast('Filters: Active / Completed / All', {
  duration: 3000,
  blocking: true,

Toast image


You can place a text at the bottom of the page

// all parameters are optional
cy.text('This is some text', {
  duration: 2000, // how long the text should be there
  blocking: true, // wait for the text to hide
  textSize: '20pt', // CSS text height

Text command

See cypress/integration/text-spec.js


You can draw arrows to point at DOM elements using the child cy.arrow() command

// all options are optional
  duration: 3000,
  blocking: true,
  pointAt: 'bottomLeft', // or "bottomRight"
  offsetX: 0, // move the tip by X pixels
  offsetY: 0, // move the tip by Y pixels
  strokeWidth: 5 // SVG line width, pixels
  color: 'orange', // color name or hex string like "#ff00ff"

You can add a text label to the arrow

  text: 'Completed todos only',
  textSize: '5vh',

Arrow gif

See cypress/integration/arrow-spec.js for examples


This module overwrites cy.screenshot command. If you are using cy.screenshot(..., {capture: 'viewport'}) with headless Chrome, then Chrome Debugger Protocol will be used to take the full resolution screenshot. You can resize the output image while preserving the aspect ratio by adding an optional maxWidth parameter.

cy.screenshot('finish', { capture: 'viewport', maxWidth: 800 })

See cypress/integration/screenshot-spec.js for example.

Continuous Integration

I could reliably generate 1920x1080 movies on CI only by using headless Chrome browser. For example see GitHub Actions ci.yml file.


If you have ideas in what directions this could go - please open an issue in this repo. I would love to hear them.


Run project with DEBUG=cypress-movie environment variable to see verbose debug logs


You can record an individual test into a Gif or an MP4 file. Run all tests or a single spec using cypress-movie command; it will run all tests, but will extract every test if its title contains the ???? emoji.

npx cypress-movie
# or use --spec name or wildcard pattern
npx cypress-movie --spec cypress/integration/my-spec.js
npx cypress-movie --spec 'cypress/integration/movies*-spec.js'

The individual movies will be saved in "cypress/movies" folder.

Example gif from cypress/integration/arrow-spec.js

Example movie

Only the test itself is captured, without any hooks.


You can pass a few arguments to control the output GIF

npx cypress-movie --width 640 --fps 30 --format gif
# --width is the output gif resolution, pixels
#     height will be set automatically to preserve the aspect ratio
#     default 960
# --fps is frames per second in the output gif
#     default 10
# --format is gif or mp4
#     default gif
# --browser is browser binary path or name like "chrome", "firefox", "electron"
#     default chrome

Small print

Author: Gleb Bahmutov <> © 2017

License: MIT - do anything with the code, but don't blame me if it does not work.

Current Tags

  • 3.0.5                                ...           latest (2 months ago)

24 Versions

  • 3.0.5                                ...           2 months ago
  • 3.0.4                                ...           2 months ago
  • 3.0.3                                ...           2 months ago
  • 3.0.2                                ...           2 months ago
  • 3.0.1                                ...           3 months ago
  • 3.0.0                                ...           6 months ago
  • 2.5.3                                ...           6 months ago
  • 2.5.2                                ...           6 months ago
  • 2.5.1                                ...           6 months ago
  • 2.5.0                                ...           6 months ago
  • 2.4.0                                ...           6 months ago
  • 2.3.3                                ...           6 months ago
  • 2.3.2                                ...           6 months ago
  • 2.3.1                                ...           6 months ago
  • 2.3.0                                ...           7 months ago
  • 2.2.0                                ...           7 months ago
  • 2.1.0                                ...           7 months ago
  • 2.0.0                                ...           7 months ago
  • 1.4.1                                ...           7 months ago
  • 1.4.0                                ...           7 months ago
  • 1.3.0                                ...           7 months ago
  • 1.2.0                                ...           7 months ago
  • 1.1.0                                ...           7 months ago
  • 1.0.0                                ...           7 months ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (9)
Dev Dependencies (3)
Dependents (0)

Copyright 2014 - 2016 © |