Recently I came across a use case of recording the video of the test execution in my CI environment - where tests run in headless mode).
My thought was - record video of the test execution in CI - save it if test failed, else discard it.
Below are some resources I came across for potentially implementing this -
Unfortunately for me - due to some other infrastructure constraints - this got de-prioritized. But hopefully I will be getting back to this soon.