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 🙏

© 2025 – Pkg Stats / Ryan Hefner

nightwatch-testrail-updater

v1.0.5

Published

NightwatchJS custom command to update your TestRail test run with the results of your automated tests using the TestRail API.

Downloads

1,409

Readme

nightwatch-testrail-updater

NightwatchJS custom command to update your TestRail test run with the results of your automated tests using the TestRail API.

Automatically updating your TestRail run with the results of your Nightwatch test automation

This package is meant to simplify updating the results of test runs inside Gurock TestRail when using Nightwatch automated tests. This library is a client for the TestRail API and posts to the add_result_for_case endpoint after each test case completes within a test class.

Installation instructions

In your Nightwatch test project

npm install nightwatch-testrail-updater --save

In your NightwatchJS nightwatch.json configuration file add or append this entry

"custom_commands_path": ["./node_modules/nightwatch-testrail-updater/commands"]

The nightwatch-testrail-updater package looks in the nightwatch.json file for the values it needs to connect to the TestRail API such as the host and run id. Below is an excerpt of the important parts.

The host would be the host of where you have your TestRail instance deployed to and the run id is the "R" number shown in the upper left of the test run in TestRail when you are viewing the test run details.

"test_settings": {
    "default": {
        "globals": {
            "testRail": {
                "host": "testrail.mycorp.com",
                "runId": "12345"
            }
        }
    }
  }

In addition, you must have environment variables set on the system named TESTRAIL_USERNAME and TESTRAIL_API_KEY that contain the TestRail username and API key information in order to authenticate with the TestRail API.

Sending Nightwatch test result to TestRail

First, to associate a test case with a test run ensure you have the run id for the TestRail run specified in the browser.globals.testRail.runId value. This can come out of the test_settings in the Nightwatch config file as shown in the example from the previous section or set during runtime.

Next, the test case in Nightwatch needs to be linked to the test case id in TestRail. This is the number prefixed by "C" when viewing the list of test cases in the TestRail Test Cases tab. Once you have that id, add it inside the test case without the C

'descriptive test case name': function (browser) {
        // For test case id C112233
        browser.testId = 112233;

        // Test code here
    }

Last, when the test is completed in the afterEach test hook call the browser.updateTestRail(browser) command.

module.exports = {
...
    afterEach: function (browser, done) {
        browser.updateTestRail(browser);
        browser.end();
    }
...
}

This will update the TestRail test run with the results of the tests in your suite after the test runs.