# webdriver-client-test-runner

> Test runner for visual regression testing and not only.

Latest version **0.0.2** (published 2017-06-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install webdriver-client-test-runner
pnpm add webdriver-client-test-runner
yarn add webdriver-client-test-runner
bun add webdriver-client-test-runner
```

Provides the command `webdriver-client-test-runner`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2017-06-02 |
| First published | 2016-11-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.6.0 |
| Dependencies | 17 |
| Known vulnerabilities | 0 (+11 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Denis Kudelin |
| Maintainers | denis.kudelin, sgrebnov |

## Links

- npm: https://www.npmjs.com/package/webdriver-client-test-runner
- Repository: https://github.com/DenisKudelin/node-webdriver-client-test-runner
- Homepage: https://github.com/DenisKudelin/node-webdriver-client-test-runner#readme
- Issues: https://github.com/DenisKudelin/node-webdriver-client-test-runner/issues
- npm.io page: https://npm.io/package/webdriver-client-test-runner

## Dependencies (17)

- [q](https://npm.io/package/q.md) 1.4.1
- [gulp](https://npm.io/package/gulp.md) 3.9.1
- [async](https://npm.io/package/async.md) ^0.9.0
- [chalk](https://npm.io/package/chalk.md) 1.1.3
- [lodash](https://npm.io/package/lodash.md) 4.16.4
- [mkdirp](https://npm.io/package/mkdirp.md) 0.5.1
- [rimraf](https://npm.io/package/rimraf.md) 2.5.4
- [globule](https://npm.io/package/globule.md) ^1.1.0
- [request](https://npm.io/package/request.md) 2.75.0
- [node-uuid](https://npm.io/package/node-uuid.md) ^1.4.7
- [webdriverio](https://npm.io/package/webdriverio.md) 4.2.16
- [jasmine-core](https://npm.io/package/jasmine-core.md) 2.5.2
- [run-sequence](https://npm.io/package/run-sequence.md) ^1.2.2
- [command-line-args](https://npm.io/package/command-line-args.md) 3.0.1
- [graphics-magick-binaries](https://npm.io/package/graphics-magick-binaries.md) latest
- [jasmine-console-reporter-custom-1](https://npm.io/package/jasmine-console-reporter-custom-1.md) latest
- [webdrivercss-custom-v4-compatible](https://npm.io/package/webdrivercss-custom-v4-compatible.md) latest

## Recent versions

- 0.0.2 (latest) — 2017-06-02
- 0.0.1 — 2016-11-01

## 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:
```sh
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.](https://github.com/DenisKudelin/powerbi-visuals-image-comparison-tests)

##Configuration
The configuration file contains all necessary information to run your test suite. Here is an example configuration with all supported properties:
```js
// 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:
```js
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:
```js
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:
```sh
gulp run
```

#### From command line
```sh
webdriver-client-test-runner <path-to-config-file>
```

---
_Source: https://npm.io/package/webdriver-client-test-runner · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
