webdriverio-boneyard / webdrivercss

Regression testing tool for WebdriverIO v4
http://webdriver.io
MIT License
616 stars 106 forks source link

screenWidth not working #182

Open zanto001 opened 6 years ago

zanto001 commented 6 years ago

If you don't set any screenWidth screenshots will be taked in tablet mode. If you want desktop mode for the screenshots its suggested in the official README to use screenWidth. Though what happens in my case is that a regression screenshot will be taken but shortly after that deleted and no regression test is being done. Although there are clearly differences.

While debugging i came accross the windowHandleSize(...)
in/node_modules/webdrivercss/lib/documentScreenshot.js

Here is the example from that script

/**
 *
 * Save a screenshot as a base64 encoded PNG with the current state of the browser.
 *
 * <example>
    :saveScreenshot.js
    client
        // set browser window size
        .windowHandleSize({width: 500, height: 500})
        .saveScreenshot('viewport.png') // make screenshot of current viewport (500x500px)
        .saveScreenshot('wholeScreen.png', true) // makes screenshot of whole document (1280x1342px)
        .end();
 * </example>
 *
 * @param {String}   fileName    path of generated image (relative to the execution directory)
 * @param {Boolean=} totalScreen if true (default value) it takes a screenshot of whole website, otherwise only of current viewport
 *
 * @uses protocol/execute, utility/scroll, protocol/screenshot
 * @type utility
 *
 */

If someone has issues with screenWidth causing trouble, try this out :)