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

testish

v1.1.1

Published

Minimalistic E2E framework powered by Node.js and selenium-webdriver

Downloads

2

Readme

Testish

Testish is a minimalistic E2E testing framework powered by Node.js among with selenium-webdriver, chromedriver, Mocha and Chai.

It provides you basic abstractions, utils, and a tests runner. The only thing left, is to write your tests and run them with Testish!

Installation

npm i -S testish

The Idea

The main idea behind this framework is to provide the ability to setup your E2E tests as fast as possible with Node.js stack. Using Node.js as your main stack for E2E tests has some great advantages. First of all, it's easy to support. Frontend developers can easily cover their own features with UI tests, and there is no need to learn Java or Python for writing tests. Secondly, you can run your tests both in usual and headless mode (if your browser supports it).

How It Works

As mentioned above, Testish is a tests runner, which handles routine of tests setup, and running of them in Node. The only thing you should care is to provide your tests and per environment configurations.

Let's review the basic example, which you can find in ./examples folder of this repo.

|____screenshots
| |____google_home_page1512115392165.png
|____config
| |____index.js
| |____production.js
|____tests
| |____google.spec.js
|____index.js
|____authorizationSchemes.js
|____README.md

Tests Folder

To make Testish run your tests, you need to create tests folder and keep your tests inside it.

How Are Tests Executed?

Every time you start framework, Testish will add to Mocha global hooks first, which handle gracefully starting & failing of your tests. E.g. for every failed test will be created a screenshot.

Then framework will go to tests folder and will find all .js files recursively in it. Now it will run all found tests.

Config Folder

Everything is based on environments. Currently supported environments are: 'local', 'development', 'staging', 'production'. Every time you start Testish, you should provide the environment.

Obviously, you should export configuration for every environment you run against.

Let's look at the configuration of the example project.

// index.js
'use strict';

const production = require('./production');

module.exports = {
  production,
};
// production.js
'use strict';

const path = require('path');

const browsers = {
  chrome: {
    args: ['--window-size=1400,800' /*'--headless', '--disable-gpu'*/],
    binary: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
  },
};

const environment = {
  baseURL: 'https://google.com',
  // loginURL: 'https://google.com'
};

module.exports = {
  browsers,
  environment,
  screenshotsDir: path.join(__dirname, '../screenshots'),
};

That's basically all configuration parameters which are supported for now.

Authorization Schemes

authorizationSchemes.js file keeps scenarios of how to log in into your application (if you have closed app).

So every time you start your tests, Testish will check if there is an authorization scheme for this environment. If yes, it will run it first to log in, and then it will start tests execution.

Here is a very basic example:

/**
 * An example of authorization schemes per environment
 */

module.exports = (driver, config) => ({
  *production() {
    // implement your log in scenario here
  }
});

CLI

The framework provides to you testish executable.

Execution example: TEST_ENV=production testish --reporter=spec.

Mocha is executed programmatically, so you can pass any of the supported parameters, as reporter above. See all available options here.