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

@dollarshaveclub/e2e

v3.2.0

Published

Make End-to-End Testing Great for Once

Downloads

117

Readme

@dollarshaveclub/e2e

CircleCI codecov Greenkeeper badge

A end-to-end test runner currently built for:

  • Official Selenium Webdriver JS SDK - http://seleniumhq.github.io/selenium/docs/api/javascript/
  • Google Chrome's Puppeteer - https://github.com/GoogleChrome/puppeteer
  • Sauce Labs

This test runner mitigates test flakiness and maximizes test speed:

  • Retry support - retry a test as many times as you'd like
  • Retry local tests on Sauce Labs - if a local Selenium test keeps failing, retry it on Sauce Labs the logs, video, and screenshots
  • Parallelism and concurrency - run local and remote tests with separate, configurable concurrencies
  • Per-step timeouts - helps debug your E2E tests when your awaits hang, which is the correct way to write Selenium tests

It also has features to make writing and running tests easier:

  • Automatically setup and destroy your selenium or puppeteer driver so you don't have to
  • Filter tests by browsers
  • Filter tests by local or remote (Sauce Labs) tests
  • Unwinding - easily run your tests multiple times with different parameters and clients

See our example tests.

Installation

Install Selenium:

brew tap homebrew/cask
brew cask install chromedriver
brew install selenium-server-standalone geckodriver

Start the Selenium server:

brew services start selenium-server-standalone

Install node@8+:

nvm install 8

API

Running Tests

Install this package:

npm install @dollarshaveclub/e2e

Run the executable:

./node_modules/.bin/dsc-e2e -h

Tests

You can define multiple clients and multiple parameters per test. If you have 5 clients and 5 parameters, your tests will run 5x5 = 25 times. Keep this in mind as you add clients and parameters.

exports.options<Object>

Options for running the test.

Options are:

  • stepTimeout='30s' - the default timeout for each step
  • stepSlowThreshold='5s' - after this threshold is met for each step, the color of the step is yellow
  • retries=1 - number of times to retry a test
  • retryWithSauceLabs=true - whether to retry failing tests on Sauce Labs when ran with Sauce Labs enabled
  • clients=[] - an array of clients to test with.
    • browser='chrome'
    • width=1280
    • height=960
    • platform={} - the platform to run on, specifically on Sauce Labs
      • width=1280
      • height=960
  • driver='selenium' - which driver to use.
    • Valid values: selenium, puppeteer

exports.parameters<Object|Array>

Various parameters to run your test. Passed to your .test function and is intended to be used within it. If your parameters is an array, your test will run for each value in the array.

exports.test<Function>({ step, parameters, ... })

Define your actual test in this function.

  • step - define your tests in steps
  • parameters - the parameters defined for your test via exports.parameters
Selenium Options
  • driver - the Selenium SDK driver instance
Puppeteer Options
  • browser - Puppeteer browser instance
  • page - a Puppeteer page instance

step(name<String>, fn<AsyncFunction>, options<Object>)

A step in your test. Think of this as a test() or it() from mocha or jest. As this runner is designed for end-to-end tests, calling each code block steps makes more sense than calling it test() or it(). Unlike other frameworks, there is no nesting of step()s.

For example, if are testing the end-to-end flow of a conversion funnel, each action a user takes would be a step. Practically, however, you should write each await within its own step. The reason is many awaits wait for a condition to occur, and the only way to test that it does not occur is to timeout.

Thus, the options for each step are:

  • timeout - the timeout for this step
  • slowThreshold - when this step is considered slow

step.skip()

Same as step(), but is not actually ran.

exports.description<Function|String>

Description of your test.