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

Frames from a previous test/suite are being added to the next test/suite #94

Open Diazole opened 1 year ago

Diazole commented 1 year ago

Describe the bug The last frame from the previous test is incorrectly saved as the first frame of the current test.

On the last test, a screenshot was taken after the call to ffmpeg.

I'm not sure where to start looking to help diagnose this issue as it appears to be a sync problem.

Log I have trimmed some of the incoming commands as I don't believe they add value.

--- New suite: Test Suite 1 ---

--- New test: Test 1 ---
Incoming command: /session/:sessionId/screenshot => [screenshot]
- Screenshot!! (frame: 0)
Incoming command: /session/:sessionId/screenshot => [screenshot]
- Screenshot!! (frame: 1)
Incoming command: /session/:sessionId/screenshot => [screenshot]
- Screenshot!! (frame: 2)
Incoming command: /session/:sessionId/screenshot => [screenshot]
- Screenshot!! (frame: 3)
ffmpeg command: "ffmpeg.exe" ...

--- New suite: Test Suite 2 ---

--- New test: Test 1 ---
Incoming command: /session/:sessionId/screenshot => [screenshot]
- Screenshot!! (frame: 4)
Incoming command: /session/:sessionId/screenshot => [screenshot]
- Screenshot!! (frame: 0)
Incoming command: /session/:sessionId/element/55a8bedc-cca0-4e40-bdfc-9f70884dec4b/text => [text]
ffmpeg command: "ffmpeg.exe" ...

--- New suite: Test Suite 3 ---

--- New test: Test 1 ---
Incoming command: /session/:sessionId/screenshot => [screenshot]
- Screenshot!! (frame: 1)
Incoming command: /session/:sessionId/screenshot => [screenshot]
- Screenshot!! (frame: 0)
ffmpeg command: "ffmpeg.exe" ...
Incoming command: /session/:sessionId/screenshot => [screenshot]
- Screenshot!! (frame: 1)
Incoming command: /session/:sessionId => [:sessionId]

To Reproduce I'll attempt to create an example repo and update this issue soon

Expected behavior Frames from a previous test/suite shouldn't be added to the current test/suite

Environment (please complete the following information):

wadjei commented 1 year ago

I saw this behaviour as well when working on other issues in video-reporter, but the previous test frames were always saved into the correct folder - they were just returned late. Everything happens asynchronously internally, so the screenshots are received some time after they are requested. I also noticed that onTestStart for the next test was called before onTestEnd for the preceding test had completed in many cases.

Following the log output gave the impression of frames for different tests being mixed but examining the filesystem following the suite run showed everything to be in order.

Are you seeing different behaviour?

christian-bromann commented 8 months ago

@Diazole thanks for raising the issue. Mind providing a minimal reproducible example to help us investigate the issue?