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:
module.exports = {
    
    jasmine: {
        defaultTimeoutInterval: 30000
    },
	
    specs: [
        "./lib/tests/**/*Tests.js",
    ],
	
    capabilities: [{
        browserName: "chrome"
    },{
       browserName: "chromium", 
       chromeOptions: {
           binary: "path to chrome.exe",
       }
    },{
        browserName: "firefox"
        firefox_binary: "path to firefox.exe"
    },{
        browserName: "internet explorer"
    }],
	
	defaultTestPageUrl: "https://www.microsoft.com",
	
    files: [
        "../Externals/JQuery/jquery.js",
    ],
	
    execFiles: [
        "../helpers/**.js",
    ],
	
    webdrivercss: {
        screenshotRoot: "screenshots/", 
        failedComparisonsRoot: "screenshots/failedComparisons", 
        misMatchTolerance: 0, 
        gmOptions: { 
            appPath: require("graphics-magick-binaries").getGMBinariesPathForCurrentSystem() 
        }
    },
}
##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", () => {
        
        
        return browser
            
            .assertAreaScreenshotMatch({ 
                name: "pagebody", 
                elem: "div.row-fluid pagebody"
            }); 
                                     
    });
});
##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"  
        }), 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>