zinserjan / wdio-visual-regression-service

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

diff folder is not creating #80

Closed vitalics closed 6 years ago

vitalics commented 6 years ago

environment:

name verion
OS Windows 10, version 1703, build 15063.1029
nodejs 8.9.4
npm 5.6.0
yarn 1.2.1
webdriverio 4.12.0
wdio-visual-regression-service 0.9.0

visual-regression service settings :

require('babel-register');

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

function getScreenshotName(basePath) {
  return function(context) {
    console.dir(context);
    const type = context.type;
    const testName = context.step.name; // cucumber step name
    const browserVersion = parseInt(context.browser.version, 10);
    const browserName = context.browser.name;
    const browserWidth = context.meta.width || context.meta.viewport.width;
    return path.join(basePath, `${testName}_${type}_${browserName}_v${browserVersion}_${browserWidth}.png`);
  };
}
exports.config = {
// settings
 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.01,
    }),
  },
}

project structure before (no screenshot folder): image

screenshot folder structure after test execution:

image

zinserjan commented 6 years ago

The folder isn't created when there are no diffs ;)