webdriverio / visual-testing

Image comparison / visual regression testing for WebdriverIO
https://webdriver.io/docs/visual-testing
MIT License
110 stars 41 forks source link

checkScreen function crashes WDIO without "autoSaveBaseline" config #16

Closed kristaps-aksjonovs closed 4 years ago

kristaps-aksjonovs commented 5 years ago

Environment (please complete the following information):

Config of WebdriverIO + wdio-image-comparison-service

const imageComparisionService = ["image-comparison", {
    baselineFolder: "./screenshots/baseline/",
    screenshotPath: "./screenshots/.tmp/",
    blockOutStatusBar: true,
    blockOutToolBar: true,
    returnAllCompareData: true,
}];

services: ["chromedriver", [...imageComparisionService]],

Describe the bug After using browser.checkScreen("ImageName") function without autoSaveBaseline: true, option in wdio service configuration, wdio crashes and leaves browser instances open.

To Reproduce Steps to reproduce the behavior:

Expected behavior I'm not really sure what is expected behaviour after using browser.checkScreen() without baseline image, but I assume it should return Error that there is no baseline image.

Log

[0-0] Error in ""after each" hook"
charData should not contain characters not allowed in XML
[0-0] /wdio-tests/node_modules/@wdio/reporter/build/index.js:110
      testStat.fail((0, _utils.getErrorsFromEvent)(test));
               ^

TypeError: Cannot read property 'fail' of undefined
    at SpecReporter.WDIOReporter.on.test (/wdio-tests/node_modules/@wdio/reporter/build/index.js:110:16)
    at SpecReporter.emit (events.js:198:13)
    at SpecReporter.EventEmitter.emit (domain.js:448:20)
    at reporters.forEach.reporter (/wdio-tests/node_modules/@wdio/runner/build/reporter.js:38:49)
    at Array.forEach (<anonymous>)
    at BaseReporter.emit (/wdio-tests/node_modules/@wdio/runner/build/reporter.js:38:20)
    at MochaAdapter.emit (/wdio-tests/node_modules/@wdio/mocha-framework/build/index.js:211:19)
    at Runner.emit (events.js:203:15)
    at Runner.EventEmitter.emit (domain.js:448:20)
    at Runner.fail (/wdio-tests/node_modules/mocha/lib/runner.js:304:8)
wswebcreation commented 5 years ago

Hi @Dorkstars

Thanks for submitting an issue, can you share a sample project with your complete setup that reproduces the issue, this is not something I have with my current tests.

Thanks

wswebcreation commented 4 years ago

Closing this issue due to inactivity

Neeham commented 1 year ago

I just experienced the same error (not comparing images, but just during negative assertion). The test:fail takes test as parameter but that param is undefined so when it tries to execute the event getErrorsFromEvent(test) it just crashes.

Configuring in wdio.conf.js for allure the following option: disableWebdriverStepsReporting: true and then we no longer see that error.