zinserjan / wdio-visual-regression-service

Visual regression service for WebdriverIO.
MIT License
102 stars 39 forks source link

checkDocument is not a function #101

Open Wexx opened 5 years ago

Wexx commented 5 years ago

Trying to write my first tests with this tool (seems really neat), but I'm running into some issues recreating the example projects I've seen (mainly this one: https://github.com/zinserjan/webdriverio-example/blob/master/test/diff-test.js).

relevant package.json items:

"wdio-visual-regression-service": "^0.9.0",
"webdriverio": "^5.11.6"

Posting the configuration below, let me know if anything else helps.

var path = require('path');
var VisualRegressionCompare = require('wdio-visual-regression-service/compare');

function getScreenshotName(basePath) {
    return function(context) {
        var testName = context.test.title;
        var resolution = context.meta.width || context.meta.orientation || 'unknown';
        var browserVersion = parseInt(/\d+/.exec(context.browser.version)[0]);
        var browserName = context.browser.name;

        return path.join(basePath, `${testName}_${resolution}_${browserName}_v${browserVersion}.png`);
      };
}

exports.config = {
    runner: 'local',
    path: '/',
    specs: [
       // 'test/specs/basic.js',
        'test/specs/visualRegression.js'
    ],
    exclude: [
    ],
    //
    maxInstances: 10,
    //
    capabilities: [{
        maxInstances: 5,
        browserName: 'chrome',
    }],
    logLevel: 'info',
    bail: 0,
    screenshotPath: './errorShots/',
    baseUrl: 'http://locally.hostedurl.com',
    waitforTimeout: 10000,
    connectionRetryTimeout: 90000,
    connectionRetryCount: 3,
    services: ['chromedriver', 'visual-regression'],
    visualRegression: {
        compare: new VisualRegressionCompare.LocalCompare({
            referenceName: getScreenshotName(path.join(process.cwd(), 'screenshots/reference')),
            screenshotName: getScreenshotName(path.join(process.cwd(), 'screenshots/screen')),
            diffName: getScreenshotName(path.join(process.cwd(), 'screenshots/diff')),
            misMatchTolerance: 0.11
          }),
          viewportChangePause: 1000,
          viewports: [{ width: 320, height: 480 }, { width: 480, height: 320 }, { width: 1024, height: 768 }],
          orientations: ['landscape', 'portrait'],
    },
    plugins: {
        'wdio-screenshot': {},
    },
    framework: 'mocha',
    reporters: ['spec'],
    mochaOpts: {
        ui: 'bdd',
        timeout: 60000
    }

}
araratmartirossyan commented 5 years ago

Same issue