@orangebeard-io/cypress-listener

1.0.13 • Public • Published

Orangebeard.io Cypress.io Listener
Orangebeard.io Cypress Listener

Orangebeard listener (a service and reporter) for Cypress.io

NPM Version Build Status License

Installation

Install the npm package

npm install @orangebeard-io/cypress-listener

Configuration

In your cypress.config.js file, provide the necessary configuration for the listener and the plugin:

const { defineConfig } = require('cypress');
const registerOrangebeardPlugin = require('@orangebeard-io/cypress-listener/lib/plugin');
const glob = require('glob');
const delay = async (ms) => new Promise((res) => setTimeout(res, ms));

module.exports = defineConfig({
  "reporter": "@orangebeard-io/cypress-listener",
  "reporterOptions": {
    "endpoint": "http://tenant.orangebeard.app",
    "token": "00000000-0000-0000-0000-00000000",
    "testset": "Cypress.io test run",
    "project": "project_name",
    "description": "A description of the test run"
  },
  e2e: {
    setupNodeEvents(on, config) {
      // !Important: Keep Cypress running until the listener is finished, preventing unfinished runs in Orangebeard
      on('after:run', async () => {
        console.log('Wait for Orangebeard listener to finish reporting...');
        while (glob.sync('orangebeard-*.lock').length > 0) {
          console.log(glob.sync('orangebeard-*.lock'))
          await delay(1000);
        }
        console.log('Orangebeard listener finished');
      });
      registerOrangebeardPlugin(on, config);
      return config;
    },
  },
});

Running

Now run your tests normally using cypress run and get results in Orangebeard!

Note that when running a subset from the commandline, you will have to use the --config flag, as the --spec flag will not be passed to the reporter, resulting in the reporter to expect all specs in the project and thus not finishing up correctly.

Example:

cypress run --browser chrome --config "specPattern=cypress/e2e/somespec/*.cy.js"

or:

cypress run --browser chrome --config '{"specPattern":["cypress/e2e/somespec/*.cy.js"]}'

Using the --reporter-options or -o flag, it is also possible to provide reporter options from the command line.

Readme

Keywords

none

Package Sidebar

Install

npm i @orangebeard-io/cypress-listener

Weekly Downloads

54

Version

1.0.13

License

AGPL-3.0

Unpacked Size

72.9 kB

Total Files

14

Last publish

Collaborators

  • orangebeard