bahmutov / cypress-movie

Generate movies from your Cypress end-to-end tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

add installation instructions to README

CypressCecelia opened this issue · comments

I confirmed that cypress-movie was a package in npm so I used npm install cypress-movie --save-dev, which added the dependencies and the files in node_modules.

However, when I run npx cypress-movie --spec <spec> I get a command not found: cypress-movie error so I believe I am missing a step.

I also added this to my support/index.ts file, not sure if this needs to explicitly stated in the installation instructions or if there is a better way to make this work.

/**
 * Overwrites some common Cypress commands like "cy.click", "cy.type"
 * by adding a pause after the command.
 * @param {number} pauseMs - pause to add after the command, default 1000ms
 */
const slowDownCommands = (pauseMs = 1000) => {
  // could be all commands
  // const commandsToSlowDown = Object.keys(Cypress.Commands._commands)
  const commandsToSlowDown = ["click"];
  commandsToSlowDown.forEach((commandName) => {
    Cypress.Commands.overwrite(commandName, (commandFn, ...args) => {
      return commandFn(...args).then((subject: any) => {
        return Cypress.Promise.resolve(subject).delay(pauseMs);
      });
    });
  });
};

slowDownCommands();

before(() => {
  if (Cypress.browser.isHeadless) {
    cy.clearViewport();
  }
});