Video is being attached but dosen't allow to play the video after serving the allure report.
Describe the bug
When the allure report is served, the video is attached in the MP4 format but doesn’t allow to play it.
Python Code used to attach the video
with open( f"{file_path}/video.mp4", "rb" ) as file: allure.attach( file.read(), name="Test Exectution Video", attachment_type=allure.attachment_type.MP4 )
Also tried with the below code:
allure.attach.file( f"{file_path}}/video.mp4", "Test Exectution Video", allure.attachment_type.MP4, )
Note: Tested with webm attachment_type as well but it resulted in the same issue.
Steps to reproduce the behavior:
- Generate the allure report.
- Observe that the video is attached but it doesn’t allow to play.
Expected behavior
User should be able to play the attached video
Attachments
Environment : | Allure version | 2.19.0 | | Test framework | [email protected] | | Allure adaptor | [email protected] | | Generate report using | [email protected] |
Use avc1 encoding to generate a video file. eg: self.running = True fourcc = cv2.VideoWriter_fourcc(*'avc1') screen_size = pyautogui.size() out = cv2.VideoWriter(self.output_file, fourcc, self.fps, screen_size) start_time = time.time() while self.running: img = pyautogui.screenshot() frame = np.array(img) frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR) out.write(frame) if time.time() - start_time > self.duration: break out.release() cv2.destroyAllWindows()
see https://github.com/orgs/allure-framework/discussions/2828