wswebcreation / protractor-image-comparison

npm-module to compare images with protractor
86 stars 38 forks source link

Fails when using maximize() #25

Closed knylx1 closed 7 years ago

knylx1 commented 7 years ago

The tests fail when using browser.driver.manage().window().maximize() with error Failed: Height has to be greater than zero.

configs:

  browser.protractorImageComparison = new protractorImageComparison({
    autoSaveBaseline: true,
    formatImageName: '{tag}-{browserName}-{width}x{height}-dpr-{dpr}',
    baselineFolder: './test/baseline/',
    screenshotPath: './test/screenshots/',
    disableCSSAnimation: true,
    ignoreAntialiasing: true,
    ignoreColors: true
  });

test.js

describe('test', () => {
  beforeEach(() => {
    browser.driver.manage().window().maximize();
    browser.get('https://google.com');
  });

  it('should match the page', () => {
    expect(browser.protractorImageComparison.checkFullPageScreen('test')).toEqual(0);
  });
});

Works perfectly when removing the line browser.driver.manage().window().maximize();

wswebcreation commented 7 years ago

Hi @klemieux ,

Thanks for pointing this out. I've tested it and saw that there's a bug in the code. The strange thing is that on my machine (Chrome 58 and OSX 10.12.5) this also happens without the browser.driver.manage().window().maximize(); on https://google.com. I located the problem and I'm going to create a fix today.

wswebcreation commented 7 years ago

Created a new release with the fix. Please upgrade to 1.2.5