wdio-video-reporter
wdio-video-reporter copied to clipboard
Video reporter is not working on new project
Describe the bug I install the wdio (npm init wdio@latest .) select the video reporter as an option, finish the installing after running the example of tests I see the next error
[0-0] Error in ""before all" hook in "{root}"" Error: done() called multiple times in hook <"before all" hook in "{root}"> (of root suite); in addition, done() received error: TypeError [ERR_INVALID_ARG_TYPE]: The "paths[0]" argument must be of type string. Received undefined at createMultipleDoneError (/Users/*/node_modules/mocha/lib/errors.js:428:13) at multiple (/*/node_modules/mocha/lib/runnable.js:290:24) at Hook.done [as callback] (/*/node_modules/mocha/lib/runnable.js:301:14) at Runner._uncaught (/*/node_modules/mocha/lib/runner.js:1011:21) at process.emit (node:events:530:35) at process.emit (node:domain:488:12) at process._fatalException (node:internal/process/execution:178:25) [0-0] file:///*/node_modules/@wdio/reporter/build/index.js:89 [0-0] hookStats.complete(getErrorsFromEvent(hook)); [0-0] ^ [0-0] [0-0] TypeError: Cannot read properties of undefined (reading 'complete') [0-0] at SpecReporter.<anonymous> (file:///*/node_modules/@wdio/reporter/build/index.js:89:23) [0-0] at SpecReporter.emit (node:events:518:28) [0-0] at SpecReporter.emit (node:domain:488:12) [0-0] at file:///usr/local/lib/node_modules/@wdio/local-runner/node_modules/@wdio/runner/build/reporter.js:47:56 [0-0] at Array.forEach (<anonymous>) [0-0] at BaseReporter.emit (file:///usr/local/lib/node_modules/@wdio/local-runner/node_modules/@wdio/runner/build/reporter.js:47:25) [0-0] at MochaAdapter.emit (file:///*/node_modules/@wdio/mocha-framework/build/index.js:162:24) [0-0] at Runner.emit (node:events:530:35) [0-0] at Runner.emit (node:domain:488:12) [0-0] at Runner.fail (/*/node_modules/mocha/lib/runner.js:453:8) [0-0] [0-0] Node.js v20.11.0 [0-0] FAILED in chrome - file:///test/specs/example.e2e.js
everything works good after removing the video reporter from list of reporters from config file. Could you help me with that?
package.json looks like { "name": "wdiosandbox", "type": "module", "devDependencies": { "@wdio/allure-reporter": "^8.28.0", "@wdio/local-runner": "^8.28.0", "@wdio/mocha-framework": "^8.28.0", "@wdio/spec-reporter": "^8.28.0", "chromedriver": "^120.0.1", "wdio-chromedriver-service": "^8.1.1", "wdio-video-reporter": "^5.1.1" }, "scripts": { "wdio": "wdio run ./wdio.conf.js" } }
@soroko-sergey thanks for raising the issue. I've seen someone else posting the issue so definitely something funky here. Any contributions or investigations would be appreciated.
if I set onlyRecordLastFailure: true
then I can get tests to run, but then it hangs at the end, not synchronized.
if i set onlyRecordLastFailure: false
then I get the above error
[0-0] 2024-01-23T21:23:15.423Z INFO webdriver: RESULT true
[0-0] 2024-01-23T21:23:15.423Z INFO webdriver: RESULT undefined
[0-0] 2024-01-23T21:23:15.423Z DEBUG @wdio/utils:shim: Finished to run "beforeSuite" hook in 1815ms
[0-0] Error in ""before all" hook in "{root}""
Error: done() called multiple times in hook <"before all" hook in "{root}"> (of root suite); in addition, done() received error: TypeError [ERR_INVALID_ARG_TYPE]: The "paths[0]" argument must be of type string. Received undefined
at createMultipleDoneError (C:\Users\josh\Documents\git\steno\selenium\node_modules\mocha\lib\errors.js:428:13)
at multiple (C:\Users\josh\Documents\git\steno\selenium\node_modules\mocha\lib\runnable.js:290:24)
at Hook.done [as callback] (C:\Users\josh\Documents\git\steno\selenium\node_modules\mocha\lib\runnable.js:301:14)
at Runner._uncaught (C:\Users\josh\Documents\git\steno\selenium\node_modules\mocha\lib\runner.js:1011:21)
at process.emit (node:events:530:35)
at process.emit (node:domain:488:12)
at process.emit.sharedData.processEmitHook.installedValue [as emit] (C:\Users\josh\Documents\git\steno\selenium\node_modules\@cspotcode\source-map-support\source-map-support.js:745:40)
at process._fatalException (node:internal/process/execution:178:25)
[0-0] file:///C:/Users/josh/Documents/git/steno/selenium/node_modules/@wdio/reporter/build/index.js:89
[0-0] hookStats.complete(getErrorsFromEvent(hook));
[0-0] ^
[0-0]
[0-0] TypeError: Cannot read properties of undefined (reading 'complete')
[0-0] at VideoReporter.<anonymous> (file:///C:/Users/josh/Documents/git/steno/selenium/node_modules/@wdio/reporter/build/index.js:89:23)
[0-0] at VideoReporter.emit (node:events:518:28)
[0-0] at VideoReporter.emit (node:domain:488:12)
[0-0] at file:///C:/Users/josh/Documents/git/steno/selenium/node_modules/@wdio/runner/build/reporter.js:47:56
[0-0] at Array.forEach (<anonymous>)
[0-0] at BaseReporter.emit (file:///C:/Users/josh/Documents/git/steno/selenium/node_modules/@wdio/runner/build/reporter.js:47:25)
[0-0] at MochaAdapter.emit (file:///C:/Users/josh/Documents/git/steno/selenium/node_modules/@wdio/mocha-framework/build/index.js:162:24)
[0-0] at Runner.emit (node:events:530:35)
[0-0] at Runner.emit (node:domain:488:12)
[0-0] at Runner.fail (C:\Users\josh\Documents\git\steno\selenium\node_modules\mocha\lib\runner.js:453:8)
[0-0] at Hook.<anonymous> (C:\Users\josh\Documents\git\steno\selenium\node_modules\mocha\lib\runner.js:494:14)
[0-0] at Hook.emit (node:events:518:28)
[0-0] at Hook.emit (node:domain:488:12)
[0-0] at multiple (C:\Users\josh\Documents\git\steno\selenium\node_modules\mocha\lib\runnable.js:290:10)
[0-0] at Hook.done [as callback] (C:\Users\josh\Documents\git\steno\selenium\node_modules\mocha\lib\runnable.js:301:14)
[0-0] at Runner._uncaught (C:\Users\josh\Documents\git\steno\selenium\node_modules\mocha\lib\runner.js:1011:21)
[0-0] at process.emit (node:events:530:35)
[0-0] at process.emit (node:domain:488:12)
[0-0] at process.emit.sharedData.processEmitHook.installedValue [as emit] (C:\Users\josh\Documents\git\steno\selenium\node_modules\@cspotcode\source-map-support\source-map-support.js:745:40)
[0-0] at process._fatalException (node:internal/process/execution:178:25)
[0-0]
[0-0] Node.js v20.11.0
2024-01-23T21:23:15.472Z DEBUG @wdio/local-runner: Runner 0-0 finished with exit code 7
[0-0] FAILED in chrome - file:///C:/Users/josh/Documents/git/steno/selenium/test/specs/ops-header.e2e.ts (3 retries)
2024-01-23T21:23:15.473Z INFO @wdio/cli:launcher: Run onWorkerEnd hook
2024-01-23T21:23:15.473Z INFO @wdio/cli:launcher: Run onComplete hook
OK
Spec Files: 0 passed, 3 retries, 1 failed, 1 total (100% completed) in 00:01:05
my reporters section in wdio.conf.ts:
reporters: [
// "spec",
[
video,
{
saveAllVideos: false, // If true, also saves videos for successful test cases
videoSlowdownMultiplier: 1, // Higher to get slower videos, lower for faster videos [Value 1-100]
outputDir: TEST_ARTIFACTS_DIR,
videoRenderTimeout: 60, // Max seconds to wait for a video to finish rendering
screenshotIntervalSecs: 3,
onlyRecordLastFailure: false,
},
],
],
I was running into this issue as well and was able to find a fix by updating the outputDir details. I have another hotfix prepared to have a fallback in the instance where the outputDir is not set in capabilities nor the reporter configuration.
With this implemented, I have been able to use the screenshots effectively and linked up the results with the nice-html reporter.
Here are the configurations I have ended with:
reporters: [
'spec',
['video', {
saveAllVideos: true,
videoSlowdownMultiplier: 1,
screenshotIntervalSecs: 0.5,
outputDir: './reports/html-reports',
}],
['html-nice', {
outputDir: './reports/html-reports/',
filename: 'report.html',
reportTitle: 'Test Report Title',
linkScreenshots: true,
//to show the report in a browser when done
showInBrowser: false,
collapseTests: true,
//to turn on screenshots after every test must be false to use video
useOnAfterCommandForScreenshot: false,
produceJson: false,
produceHtml: true
}],
],
FWIW Mine is now working after version 5.1.4