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

jest-environment-nightwatch

v0.2.2

Published

Nightwatch.js environment for Jest

Downloads

26

Readme

jest-environment-nightwatch

Nightwatch 2 environment for Jest. Nightwatch.js is an integrated test framework for performing automated end-to-end testing on web applications and websites, across all major browsers.

Build Status version Discord MIT License

npm install jest-environment-nightwatch

Usage:

Update your Jest configuration:

{
  testEnvironment: 'jest-environment-nightwatch',
  testEnvironmentOptions: {
    // Nightwatch related options
    headless: true,
    browserName: 'chrome',
    baseUrl: '',
    verbose: false,  
    output: true,
    env: null, 
    parallel: false,
    devtools: false,
    debug: false,
    autoStartSession: true,
    persistGlobals: true,
    configFile: './nightwatch.conf.js',
    globals: {}, 
    webdriver: {},
    timeout: null,
    enableGlobalApis: false,
    alwaysAsync: true,
    desiredCapabilities: {},
    async setup(browser) {},
    async teardown(browser) {},
  }
}

Nightwatch options

| Name| Type | Description | Default | |:--- | :--- | :--- | :---: | | headless| Boolean | Run Nightwatch in headless mode (available in Firefox, Chrome, Edge) | true | | browserName | String | Browser name to use; available options are: chrome, firefox, edge, safari | none | | baseUrl | String | The base url to use for the when using .navigateTo() with relative urls. When doing component testing it needs to be set to the url running the Vite dev server. | http://localhost:3000 | | verbose | Boolean | Enable complete Nightwatch http logs. | false | | output | Boolean | Show Nightwatch output. | true | | env | String | Nightwatch test environment to use, from nightwatch.conf.js. Learn more about test environments in the Nightwatch docs. | none | | parallel | Boolean | Set this to true when running tests in parallel | false | | devtools | Boolean | Chrome only: automatically open the chrome devtools | false | | debug | Boolean | Component testing only: pause the test execution after rendering the component | false | | autoStartSession | Boolean | Start the Nightwatch session automatically. If this is disabled, you'll need to call jestNightwatch.launchBrowser() in your tests. | true | | persistGlobals | Boolean | Persist the same globals object between runs or have a (deep) copy of it per each test. Learn more about test globals in the Nightwatch docs.| true | | configFile | String | The Nightwatch config file to use. A config file will be auto-generated by default, but this allows you to change that. Learn more about the Nightwatch config in the Nightwatch docs. | ./nightwatch.conf.js | | globals | Object | A list of globals to be used in Nightwatch. Globals are available on browser.globals. Learn more about the Nightwatch test globals in the Nightwatch docs. | none | | webdriver | Object | A list of Webdriver related settings to configure the Nightwatch Webdriver service. Learn more about the Nightwatch webdriver settings in the Nightwatch docs. | none | | timeout | Number | Set the global timeout for assertion retries before an assertion fails. | 5000 | | enableGlobalApis | Boolean | The Nightwatch global APIs (element(), expect()) are disable by default. | false | | desiredCapabilities | Object | Define custom Selenium capabilities for the current session. Learn more about the specific browser driver that it is being used on the Nightwatch docs. | none | | setup() | Function | Additional setup hook to be executed after Nightwatch has been started. | none | | teardown() | Function | Additional teardown hook to be executed with the Nightwatch api object. | none |

API

global.browser

The Nightwatch browser API object. Unavailable when autoStartSession is off.

global.jestNightwatch

The Jest environment used the Nightwatch programmatic API to create the Nightwatch instance and export the browser API.

Available properties/methods:

  • .element(<locator>) - use the Nightwatch .element() API to locate elements in the page;
  • .updateCapabilities({ capabilities }) - used when autoStartSession is off in order to update the capabilities at run-time;
  • .launchBrowser() - used when autoStartSession is off in order to start the session and open the browser;
  • .settings - the Nightwatch settings object;
  • .nightwatch_client - the Nightwatch (internal) instance.

License

MIT