How to use the cypress.run function in cypress

To help you get started, we’ve selected a few cypress examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Bkucera / cypress-plugin-retries / test / helpers.js View on Github external
spec: '',
    expectedResults: {},
  })

  const expectedResults = _.defaults({}, parsedExpectedResults, opts.expectedResults, {
    totalFailed: 0,
  })

  console.log(chalk.cyanBright(`starting test run: ${opts.spec}`))

  const stdio = captureStdio(process.stdout)

  stdio.passThrough((v) => chalk.magenta(stripAnsi(v.toString())))
  // const stdio2 = captureStdio(process.stdout)

  return cypress.run({
    spec: opts.spec,
  }).then((res) => {
    expect(res).includes(expectedResults)
  })
  .finally(() => {
    stdio.restore()
    // console.log(chalk.magenta(stdio.toString()))
  })
  .then(() => {
    console.log(`${chalk.bold('run matched these results:')} ${JSON.stringify(expectedResults, null, 2)}`)
  })
}
github BrowserSync / browser-sync / test / utils.js View on Github external
bs.init(setup, function(err, bs) {
        return cypress.run({
            spec: specs,
        })
            .then((results) => {
                // stop your server when it's complete
                bs.cleanup();
                if (results.failures > 0) {
                    return process.exit(1);
                }
                process.exit(0);
            })
    });
}
github cypress-io / cypress-test-tiny / run.js View on Github external
console.log('\nRunning %d spec:', k, spec)
  k += 1

  const opts = {
    // headed: true,
    spec,
  }

  process.env.DEBUG = process.env.DEBUG || 'cypress:*'

  if (process.env.CI) {
    opts.record = false
    opts.key = process.env.CYPRESS_DASHBOARD_KEY
  }

  return cypress.run(opts).then(results => {
    if (results.failures) {
      numFailed += results.failures

      return results
    }
    return runSpec(spec)
  })
}
github victor0210 / slim / example / cypress.ci.js View on Github external
const server = require("./server");
const cypress = require("cypress");

// start your server
cypress
  .run({
    browser: "chrome"
  })
  .then(() => {
    // stop your server when it's complete
    console.log(`cypress test completed!`);
    process.exit(0);
  });
github intershop / intershop-pwa / e2e / cypress-ci-e2e.js View on Github external
const run = (num, spec, retryGroup) => {
  num += 1;
  let config = _.cloneDeep(DEFAULT_CONFIG);
  config = { ...config, env: { ...config.env, numRuns: num } };

  if (spec) config.spec = spec;
  if (retryGroup) config.group = retryGroup;

  console.log(config);

  return cypress
    .run(config)
    .then(results => {
      if (results.totalFailed) {
        totalFailuresIncludingRetries += results.totalFailed;

        // rerun again with only the failed tests
        const specs = _(results.runs)
          .filter('stats.failures')
          .map('spec.relative')
          .value();

        console.log(`Run #${num} failed.`);
        console.log(
          _(results.runs)
            .filter('stats.failures')
            .map('tests')
github tastejs / todomvc / tests / cya.js View on Github external
const testApp = app => {
  console.log(
    figlet.textSync(app, {
      font: 'Varsity'
    })
  )

  const colorFailures = n => (n ? chalk.red(n) : chalk.green(n))
  const addColors = R.over(R.lensProp('failures'), colorFailures)

  return cypress
    .run({
      browser: args.browser,
      record: true,
      key: '6f32e649-6348-4d6e-8ec0-4b57774965d1',
      env: {
        framework: app,
        times: args.times
      }
    })
    .then(R.omit(['screenshots', 'video', 'version']))
    .then(R.set(R.lensProp('app'), app))
    .then(addColors)
}
github victronenergy / venus-html5-app / test / run-cypress.js View on Github external
const cypress = require("cypress")
const httpServer = require("http-server")

const server = httpServer.createServer({
  root: "dist/"
})

server.listen(8000)

cypress
  .run()
  .then(res => {
    server.close()
    mqtt.server.close()
    process.exit(res.totalFailed)
  })
  .catch(err => {
    console.error(err)
    process.exit(1)
  })
github geops / openlayers-editor / .neutrinorc.js View on Github external
      compiler => cypress.run().then(() => resolve()).catch(() => reject())
    )

cypress

Cypress is a next generation front end testing tool built for the modern web

MIT
Latest version published 4 days ago

Package Health Score

98 / 100
Full package analysis