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

@boozt/webtest-runner

v0.2.1

Published

Use the webtest-runner to run your test synchronously. This is a simple module that you can easily use with Selenium.

Downloads

2,305

Readme

Test runner

When it comes to working on complex or sensitive UI you probably want to cover it with some tests. The webtest-runner allows you to invoke your tests synchronously and get some information about the process. Therefore, you can create awesome, simple and convenient tests.

Usage

Add node ./node_modules/@boozt/webtest-runner {path} to the script section in your package.json. Where the {path} is a path to the file which imports all of your tests.

You can also specify which of your tests should be performed by adding the filter option with the names of your test. For instance: node webtest-runner ./web/tests/list.js filter testCheckout testCart

In this example, of all existing tests specified in list.js, only testCheckout and testCart will be executed.

{path}

This file can look like:

const testChekout = require('./tests/testChekout');
const testCart = require('./tests/testCart')

/**
 * Here you can add your tests
 */
module.exports = {
    testChekout,
    testCart
};

Tests and cases

// ./tests/testCart.js


const { Builder, By } = require('selenium-webdriver');
const assert = require('assert');
const { getUrl } = require('../config');

// URL
const url = getUrl('/cart');

// Selectors
const modalClass = 'cart-modal';

/**
 * Test modal exists
 *
 * The test object must contain ONLY test cases
 */
module.exports = {

    /**
     * Case 1
     *
     * Open popup
     */
    testOpenPopup: async function() {
        let driver = await new Builder().forBrowser('chrome').build();
        try {
            await driver.get(url);
            
            const $modal = await driver.findElement(By.className(modalClass));
            const _class = await $form.getAttribute('class');
            assert.strictEqual(modalClass, _class, 'The modal is not shown');

        } finally {
            await driver.quit();
        }
    }
}

beforeTest and afterTest

If you need to perform some actions before or/and after your test you can use these functions in your test object.

Wherever you place these functions in your test object it ensures that beforeTest will be invoked first and afterTest last.