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

testcafe-reporter-slack-image-fork

v0.0.9

Published

TestCafe slack reporter plugin.

Downloads

2

Readme

TestCafe Reporter Slack

testcafe-reporter-slack

This is a reporter for TestCafe. It sends the output of the test to slack.

Purpose

Once configured the repoter sends test results to Slack depending on a .env file from the folder the tests are run from.

This fork also uploads any screenshot taken by testcafe on failure to AWS S3 (by default - can be configured to upload to any online service) and posts the screenshots to Slack alongside the error message.

Setup instructions

Follow the instructions bellow to configure this plugin.

npm i -D testcafe-reporter-slack-image-fork

Testing

Running TestCafe with testcafe-reporter-slack.

In order to use this TestCafe reporter plugin it is necessary to define .env variables in your test project, hence the folder from where your call TestCafe.

  • cd into your test project.
  • Edit or create the .env file by adding the following ki-reporter required variables:
TESTCAFE_SLACK_WEBHOOK=https://hooks.slack.com/services/*****
TESTCAFE_SLACK_CHANNEL='#testcafe'
TESTCAFE_SLACK_BOT=testcafebot

Quiet mode

Outputs to slack only on errors.

TESTCAFE_SLACK_QUIET=true

If you are using the default AWS S3 uploader

TESTCAFE_SLACK_UPLOADER_AWS_PROFILE='profile'   # [default: 'default']
TESTCAFE_SLACK_UPLOADER_S3_BUCKET='bucket name' # [default: 'bucket']
TESTCAFE_SLACK_UPLOADER_S3_KEY='key prefix'     # [default: ''] (a generated id will be appended along with the .png extension)

To use a custom uploader file

Create a .js file which export a method with the following signature.

type Attachment = { color: String, text: String, image_url: String }

// The attachments that the function receive as an argument contain a image_url property.
// It is the absolute path to the local file where testcafe stores the screenshot taken when a test fails.

// Replace the image_url with the real url of the image stored by whatever online service you choose.
// And then return the modified attachments in the promise.

(attachments: Attachment[]) => Promise<Attachment[]>

Then set an environment variable set with the path to your file.

TESTCAFE_SLACK_UPLOADER_PATH='/path/to/your/custom/js/uploader/file.js'

Now run your tests from the commmand line with the ki-reporter specified, e.g.:

$ testcafe chrome 'path/to/test/file.js' --reporter slack-image-fork

When you use TestCafe API, you can pass the reporter name to the reporter() method:

testCafe
    .createRunner()
    .src('path/to/test/file.js')
    .browsers('chrome')
    .reporter('slack') // <-
    .run();

Further Documentation

TestCafe Reporter Plugins