allure2: Generating report with mp4 video doesn't allow video to play in served report

Describe the bug Upon generating a report that include a video attached to a test, the served Allure report does not allow the mp4 video to be played

To Reproduce Steps to reproduce the behavior: Attached video with the following code snippet (Python):

        with open(os.path.join(VIDEO_RECORDINGS_DIR, _video_name), "rb") as video_file:
            allure.attach(video_file.read(), name="video", attachment_type=allure.attachment_type.MP4)

Attached generated Allure results dir - mp4 video is included and plays successfully independently and the report recognises that the there is a video attached to a test, but the video cannot be played

Expected behavior Video in report plays as when playing the video independently as a separate file in a media player.

Screenshots image

Environment (please complete the following information):

| Allure version | 2.14.0 | | Test framework | pytest@6.2.4 | | Allure adaptor | allure-pytest@2.9.43 | | Generate report using | allure@2.14.0 |

Additional context Attached generated allure results dir with all artefacts: sample-allure.zip

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 26 (5 by maintainers)

Most upvoted comments

@baev hi, I really don’t understand why you are closing the ticket? the issue is not solved yet for many users. The solution with the sleep thing is just not working.

Thanks.

In other words I would close this as this is not a bug on Allure side. If you give Allure finished MP4 file, it attaches it in Python no problem.

Exactly. Quitting the Webdriver is also important. I figured this out by checking the video file size in time during these operations and it kept changing, which let me to conclusion that the video file was not ready when I tried to attach it to Allure report.

@jsa34 great!

Interesting - I hadn’t considered the video type…

MP4 doesn’t work, but I swapped out the mp4 to be webm, and all is fine - only code change from Allure’s side is:

        with open(os.path.join(VIDEO_RECORDINGS_DIR, _video_name), "rb") as video_file:
            allure.attach(video_file.read(), name="video", attachment_type=allure.attachment_type.WEBM)

Obviously also rendered the video with vp09 codec (webm) instead of mp4, but no other changes - mp4 and webm videos both were playing fine outside of Allure report, even the video in the results dir