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

webdriver-client-test-runner

v0.0.2

Published

Test runner for visual regression testing and not only.

Downloads

3

Readme

webdriver-client-test-runner

Test runner for visual regression testing and not only.

##Installation Ensure that a selenium/browser WebDriver is started. Install the NPM package:

npm install webdriver-client-test-runner@https://github.com/DenisKudelin/webdriver-client-test-runner.git

An example repository using webdriver-client-test-runner can be found here.

##Configuration The configuration file contains all necessary information to run your test suite. Here is an example configuration with all supported properties:

// All patterns or paths are relative to the directory where the config file resides.
module.exports = {

    // Jasmine configuration.
    jasmine: {
        defaultTimeoutInterval: 30000
    },

	// [REQUIRED] Patterns of test files to run.
    specs: [
        "./lib/tests/**/*Tests.js",
    ],

	// [REQUIRED] Browser list to run tests. All specs will be launched for each browser.
    capabilities: [{
        browserName: "chrome"
    },{
       browserName: "chromium", // we also can use "chromium" as the browser name, but a path to chrome.exe should be defined.
       chromeOptions: {
           binary: "path to chrome.exe",
       }
    },{
        browserName: "firefox"
        firefox_binary: "path to firefox.exe"
    },{
        browserName: "internet explorer"
    }],

	// Url or path to a html file that will be opened before all specs are started. If not defined, the blank page will be used.
	defaultTestPageUrl: "https://www.microsoft.com",

	// Urls or patterns to *.css/*.js files that will be inserted to the start page as link or script blocks. Can be used only for local pages.
    files: [
        "../Externals/JQuery/jquery.js",
    ],

	// Patterns to *.js files that will be evaluated on the start page.
    execFiles: [
        "../helpers/**.js",
    ],

	// Webdrivercss configuration. (These are the default settings)
    webdrivercss: {
        screenshotRoot: "screenshots/", // The path to save original screenshots
        failedComparisonsRoot: "screenshots/failedComparisons", // The path to save differences from original screenshots
        misMatchTolerance: 0, // Number between 0 and 100 that defines the degree of mismatch to consider two images as identical, increasing this value will decrease test coverage.
        gmOptions: { // Graphics Magick options
            appPath: require("graphics-magick-binaries").getGMBinariesPathForCurrentSystem() // Path to the Graphics Magick binaries
        }
    },
}

##Writing tests To write tests we use Jasmine test framework. To access the browser functions we use the global variable "browser". Here is an example test:

describe("Microsoft", () => {
    it("pagebodyTest", () => {
        // Tests run in NodeJS context
        // Use "browser.execute" (http://webdriver.io/api/protocol/execute.html) to run code in browser context
        return browser
            // Statement below creates a screenshot and performs verification
            .assertAreaScreenshotMatch({ 
                name: "pagebody", // By default, this will be mapped to ./screenshots/originals/chrome/Microsoft/pagebodyTest.pagebody.1920px.baseline.png
                elem: "div.row-fluid pagebody"
            }/*,[Browser.Chrome]*/); // We are able to spcify a list with focused browsers to
                                     // jasmine spec or description and it will be available only for these browsers
    });
});

##Usage

Using exposed NodeJS Api

For example, we can use the gulp to run our tests:

var gulp = require("gulp");
var webdriverClientTestRunner = require("webdriver-client-test-runner");

gulp.task("run", () => {
    return webdriverClientTestRunner.TestRunner.run({
            config: "./config.js"  // Path to our config file.
        }), webdriverClientTestRunner.Helpers.logError)
        .then(() => process.exit(0), (ex) => process.exit(1));
});

Now we can run our tests:

gulp run

From command line

webdriver-client-test-runner <path-to-config-file>