wix / Detox

Gray box end-to-end testing and automation framework for mobile apps
https://wix.github.io/Detox/
MIT License
11.23k stars 1.92k forks source link

Feat: Allow generating single video for the whole series of tests #3092

Open ShivamJoker opened 2 years ago

ShivamJoker commented 2 years ago

Is your feature request related to a problem? Please describe.

We have the option to record videos using --record-videos flag but it generates one video for each item of each test but what if someone want's to see the whole process with all the animations and UI interaction. (Mentioned in #1981)

Describe the solution you'd like It would be better if we can have additional options to record for

  1. Each test suite (suite)
  2. The entire test (complete)

Describe alternatives you’ve considered Maybe we can trigger the inbuilt screen recorder which comes in latest iOS and android simulators

noomorph commented 2 years ago

This is not going to happen very soon, I am afraid, not this year. We're understaffed to handle this soon, but this is definitely a good feature to have.

In the current architecture and config type terms, I can consider adding an option to:

https://github.com/wix/Detox/blob/399a19f0fc418b1aeb173e7bbafa00c4da4e849f/detox/index.d.ts#L148-L160

something like:

        interface DetoxVideoArtifactsPluginConfig {
            enabled?: boolean;
            keepOnlyFailedTestsArtifacts?: boolean;
+           recodingScope?: 'test' | 'run';            

and performing quite a heavy rewrite for:

https://github.com/wix/Detox/blob/399a19f0fc418b1aeb173e7bbafa00c4da4e849f/detox/src/artifacts/video/VideoArtifactPlugin.js#L3-L6

The previous idea to extend it from WholeTestRecorderPlugin might be not really a brilliant one. It needs to become more flexible on topic where to start and where to end the recording.

Not going further on this, but that's the outline of this change.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back.

Thank you for your contributions!

For more information on bots in this reporsitory, read this discussion.

stale[bot] commented 2 years ago

The issue has been closed for inactivity.

noomorph commented 1 year ago

This is definitely possible, and I think it makes sense to implement it once, but there are pitfalls – it is impossible to tell on the video where a test starts and ends.

ShivamJoker commented 1 year ago

What if we use ffmpeg to stitch all the videos after everything is recorded?

noomorph commented 1 year ago

Well, then it could be implemented as a post-processing step outside of Detox, probably. Either in some Shell script, or in a custom globalTeardown handler in Jest. 🤔

noomorph commented 1 year ago

@ShivamJoker Ideally I would prefer to inject timestamps into a single video recording, but it turns out we can't synchronize the video recording with the local computer time: https://stackoverflow.com/questions/74266578/how-to-synchronise-a-screen-recording-with-the-real-time – there's an indeterministic delay before the first frame is recorded, and there could be dropped frames.

noomorph commented 1 year ago

Will be solved in Detox 22. TODO: add to the epic.