zinserjan / wdio-screenshot

A WebdriverIO plugin. Additional commands for taking screenshots with WebdriverIO.
MIT License
109 stars 43 forks source link

browser.checkDocument only takes a screenshot of the viewport #71

Closed MatteoVH closed 7 years ago

MatteoVH commented 7 years ago

When using the exposed checkDocument function only the viewport is taken a screenshot of. I would expect this to take a screenshot of the entire page so that I can check if visual regressions are present past the end of the current viewport. Instead this function seems to behave the same as checkViewport. Checking the source seems to confirm this.

Here's some sample code from my step definition (Cucumber) for ensuring the document hasn't visually regressed:

/**
* Check the screenshot of the page against the existing baseline
* @param  {Function} done        Function to execute when finished
*/
module.exports = (done) => {
    const results = browser.checkDocument();
    results.forEach((result) => {
      expect(result.isWithinMisMatchTolerance).to.be.true;
    });
    done();
};

This works for the viewport but doesn't check changes beyond its boundary.

MatteoVH commented 7 years ago

Oops, meant to post this in the wdio-visual-regression-service repo