webdriverio-community / wdio-video-reporter

Reporter for WebdriverIO that makes videos of failed tests and has optional allure integration
https://webdriver.io/docs/wdio-video-reporter
MIT License
58 stars 46 forks source link

Question: Can make the recording feature to start at beginning of the execution of each test? #11

Closed xyngfei closed 5 years ago

xyngfei commented 5 years ago

I noticed that my recording video only has 1 or 2 seconds. How can start the video recording at the beginning of the test?

Besides, how the following 2 parameters can impact the video recording? videoSlowdownMultiplier Integer between [1-100]. Increase if videos are playing to quick. Default: 3 videoRenderTimeout Max seconds to wait for a video to render. Default: 5

presidenten commented 5 years ago

All your questions are answered in the readme. You really should read it. Its good. :-)

Here is an extended answer anyways.

Video can be captured in two ways: record video via vnc to the browser host or manual screenshots via selenium api.

I actually started off by making a proof of concept for another framework to split up their videos into chunks for the different tests. I wasnt super happy with the result and noticed that the video was mostly a static image while waiting and mouse and scrolling jerks the view to where it needs to be since selenium works as fast as it can and wont waste time with smooth mouse arrow movement. You can check out the example here to see what split up vnc video looks like: https://github.com/presidenten/selenoid-video-api

After seeing it, I drew the conclusion that I would get kind of the same result, and have an easier time, by taking screenshots only when the user actually does something. Fewer frames means tests run quicker and videos get smaller. Mostly wins and few cons. Thats the background to this library.

...so... to answer your question.

If you want longer videos, either performs some more actions or configure wdio-video-reporter to take screenshots on more jsonwire messages. Set logging to debug, run your test, check wdio-video-reporter log and check which messages are sent, then just add them to the config with Read more here: https://github.com/presidenten/wdio-video-reporter#advanced-configuration-parameters Default included messages here: https://github.com/presidenten/wdio-video-reporter/blob/master/src/config.js#L33 All possible messages here: https://github.com/SeleniumHQ/selenium/wiki/ Edit: Since I usually deal with web tests where each test start with a call to set url, which is included to take a screenshot, this is usually not an issue for me. For pure appium tests I would check which jsonwire message is usually sent first and add that one with ˋaddJsonWireActionsˋ.

For your final questions, check the readme here: https://github.com/presidenten/wdio-video-reporter#normal-configuration-parameters ˋvideoSlowdownMultiplierˋ is used to decide time between frames. Increase value to get slower videos, decrease to get faster videos. ˋvideoRenderTimeoutˋ Max seconds to wait for a video to render. Only used if there is a trouble with the video rendering to avoid deadlock.