Testcafe: Support video recording of test running

Created on 20 Feb 2018  路  6Comments  路  Source: DevExpress/testcafe

Proposal

Last update 2/20/2018

What?

Provide an ability to create a video of a test run (in Chrome and Firefox (included headless) at start ).

Why?

Make it easier to identify why your test is failed. Especially it's actual for CI.

How?

I guess the best way is make screenshots by using browser's api and make a video from them by using a tool like ffmpeg.

Questions to answer.

  • Make one big video for the whole test run or create a separated video for every test? (I vote for the second case).
  • Save a video for every test or just for failed test? (I vote for 'failed only')

Additional requirements.

  • It should be possible to configure video quality settings

Things to do:

  • [ ] - Investigate possibility to make screenshots in Firefox;
  • [ ] - Investigate possibility to use ffmpeg or find other way;
  • [ ] - Investigate how much machine resources it requires;
  • [ ] - Figure out new API (all available options);
  • [ ] - Implement;
  • [ ] - Find ways how to save/get video for popular CI systems.

Something else?

If anyone have some thoughts here feel free to comment

!IMPORTANT! Auto-locked enhancement

Most helpful comment

For anyone who is desperate to record video from Chrome (e.g. to troubleshoot headless CI) I've made this reporter https://www.npmjs.com/package/testcafe-reporter-chrome-recorder

I wouldn't recommend to use it if there's an alternative but worked for me.

All 6 comments

We just started to test out something similar for grabbing screen videos of tests by launching a child_process.spawn of ffmpeg (and closing it) in Before() / After() hooks, naming it based on the SUT/scenario. Unfortunately, it relies on being able to record the active x11 screen session (ie, won't work in headless mode).

Maybe it would work in headless if something like xvfb was used to simulate an x11 display?

Our setup is currently testcafe+cucumberjs, so we're relying on the cucumber Before/After hooks and just using testcafe as a driver+assertion framework.

The we're using to generate the mkv is:

              child_process.spawn(
                '/usr/bin/ffmpeg',
                `-f x11grab -s 1024x700 -i :0.0+0,40 -c:v libx264 -preset ultrafast -crf 0 /tmp/${name}.mkv`.split(' ')
              )

Another thought - for C.I. you could run the setup in non-headless within a docker container (therefore, no reliance on xvfb or headless mode), we did something similar with selenium docker images (just watch when needed by hooking to a vnc server the container was running).

Implementation of the feature is delayed due to unclear consequences of adding LGPL licensed FFMPEG to TestCafe dependencies. I'm in process in process of clarifying legal considerations with our lawyer.

For anyone who is desperate to record video from Chrome (e.g. to troubleshoot headless CI) I've made this reporter https://www.npmjs.com/package/testcafe-reporter-chrome-recorder

I wouldn't recommend to use it if there's an alternative but worked for me.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or feature requests. For TestCafe API, usage and configuration inquiries, we recommend asking them on StackOverflow.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

multivoltage picture multivoltage  路  3Comments

madroneropaulo picture madroneropaulo  路  3Comments

marchugon picture marchugon  路  4Comments

Lukas-Kullmann picture Lukas-Kullmann  路  3Comments

KaneMorgan picture KaneMorgan  路  3Comments