npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@comeon-stockholm/agent-js-cypress

v1.4.1

Published

This agent helps Cypress to communicate with Report Portal

Downloads

32

Readme

agent-js-cypress

Cypress js agent is runtime reporter for EPAM report portal which provides information about collection run.

Install

npm install @comeon-stockholm/agent-js-cypress --save-dev

Usage

Cypress.json

Add the following options to cypress.json


{
    "reporter": "agent-js-cypress",
    "reporterOptions": {
        "endpoint": "http://your-instance.com:8080/api/v1",
        "token": "00000000-0000-0000-0000-000000000000",
        "launch": "LAUNCH_NAME",
        "project": "PROJECT_NAME",
        "description": "PROJECT_DESCRIPTION",
        "isLaunchMergeRequired": false
    }
}

To run example tests also add the following settings to cypress.json, replace "reporter": "agent-js-cypress" by "reporter": "index.js" and use command npm test.


{
  ...
  "integrationFolder": "example/integration",
  "screenshotsFolder": "example/screenshots"
}

Add file to run Cypress with custom behavior

Create folder "scripts" on project folder. Copy the following script into "cypress.js" file and put it to "scripts" folder.


const cypress = require('cypress'),
    RPClient = require('@comeonautomation/reportportal-client')
    fs = require('fs'),
    glob = require("glob");

const cypressConfigFile = "cypress.json";


const getLaunchTempFiles = () => {
    return glob.sync("rplaunch-*.tmp");
}

const deleteTempFile = (filename) => {
    fs.unlinkSync(filename);
}

cypress.run().then(
    () => {
      fs.readFile(cypressConfigFile, 'utf8', function (err, data) {
        if (err) {
            throw err;
        }

        const config = JSON.parse(data);

        if (config.reporterOptions.isLaunchMergeRequired) {
            const client = new RPClient(config.reporterOptions);
            client.mergeLaunches();
            const files = getLaunchTempFiles();
            files.map(deleteTempFile);
        }
      });
    },
    error => {
      console.error(error)

      const files = getLaunchTempFiles();
      files.map(deleteTempFile);
      process.exit(1)
    }
);

Update package.json "scripts" section


"scripts": {
    ...
    "cypress": "node scripts/cypress.js",
    ...
},

Options

Runs support following options:

| Parameter | Description | | --------------------- | ----------------------------------------------------------------------------------------------------------------- | | token | User's Report Portal token from which you want to send requests. It can be found on the profile page of this user. | | endpoint | URL of your server. For example 'https://server:8080/api/v1'. | | launch | Name of launch at creation. | | project | The name of the project in which the launches will be created. | | isLaunchMergeRequired | Determines merge Cypress run's in to one launch or not | | rerun | Enable rerun | | rerunOf | UUID of launch you want to rerun. If not specified, report portal will update the latest launch with the same name|

Screenshot support

Curently supported only default usage of Cypress screenshot function. Using custom filename is not supported.


cy.screenshot()
cy.get('.post').screenshot()

Copyright Notice

Licensed under the Apache License v2.0

Contribution