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

@currys-co-uk/agent-js-codecept

v1.0.0

Published

Reportportal plugin for Codecept JS tests

Downloads

571

Readme

ReportPortal Agent for CodeceptJS

📋Beautiful enterprise-grade test reports integrated with CodeceptJS testing framework. This helpes you integrate the test results of CodeceptJS with ReportPortal

Based on CodeceptJS RPHelper by PeterNgTr.

ReportPortal Test

@reportportal/agent-js-codecept is a CodeceptJS plugin which can publish tests results on ReportPortal after execution.

When enabled this plugin sends information on test runs to ReportPortal server:

  • ✅status for failed and passed tests
  • 🔍step by step log
  • 🖼screenshots on failure are attached

Installation

npm i @reportportal/agent-js-codecept --save

Configuration

This plugin should be added in codecept.conf.js

Example:

{
  //...
   plugins: {
    reportportal: {
      enabled: true,
      require: '@reportportal/agent-js-codecept',
      token: 'YOUR_TOKEN',
      endpoint: 'http://localhost:8080/api/v1',
      launchName: 'local launch',
    }
  //...
}

To use this plugin you need to provide the following info:

  • token: which can be found by navigating to the user profile page, clicking the username drop-down in the right header and selecting the "Profile" > "UUID" – is a unique user identifier. UUID is used in automated test configuration files for a user authentication instead of a password. It will allow you to post data, without logging it in the UI.
  • endpoint: your reportportal host + api/v1 for instance: http://localhost:8080/api/v1
  • launchName: the launch name you want, if not provided, the suite title will be used
  • projectName: the project that you created in the reportportal UI
  • launchDescription: (optional) the description of your launch, if not provided, the description will be empty
  • launchAttributes: (optional) the attributes of your launch, if not provided, the attributes will be empty
  • debug: (optional) to turn on the debug for reportportal
  • rerun: (optional) to enable rerun
  • rerunOf: (optional) UUID of launch you want to rerun. If not specified, report portal will update the latest launch with the same name.

Public API

Add Log Message

You can send logs to ReportPortal to current step / test by accessing this plugin from your code:

const reportPortal = codeceptjs.container.plugins('reportportal');
reportPortal.addLog({
  level: 'debug',
  message: 'your message'
});

To send attachment, use second parameter:

const reportPortal = codeceptjs.container.plugins('reportportal');
reportPortal.addLog({
  level: 'debug',
  message: 'your message'
}, {
  name: 'screenshot.png',
  type: 'image/png',
  content: fs.readFileSync('output/screenshot.png')
});

See sendLog method of ReportPortal JavaScript Client for more oprtions.

Get Report URL

Once report is posted a special reportportal.result event is created.

You can use it to pass URL of a report into other plugins. For instance, you can use it to send Slack or Email notifications including a link to a report.

// inside your custom plugin:
event.dispatcher.on('reportportal.result', (result) => {
  // use result.link as URL to report
  console.log('Report was published at', result.link);
})

Support for retried Test Scenarios

Added support for retried Test Scenarios used in accordance with https://codecept.io/basics/#retry-scenario

Scenario('Really complex', ({ I }) => {
  // test goes here
}).retry(2);

// alternative
Scenario('Really complex', { retries: 2 },({ I }) => {});

Todo

  • [ ] Support run-workers command to aggregate all tests under one launch.

Debugging Plugin

To debug this plugin run script enabling DEBUG env variable:

DEBUG="codeceptjs:reportportal"  npx codeceptjs run