在剧作家中录制魅力的视频
如何录制视频,并将其附加到Trace或屏幕截图之类的魅力?
use: {
actionTimeout: 0,
trace: 'on',
screenshot: 'on',
viewport: {width:1920, height: 1080},
video: 'on',
},
这就是我在playwright.config.ts和视频中所拥有的只是一个不起作用的东西。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据 dir
recordVideo
上下文选项的属性。否则不会录制视频。因此,您的配置文件应该看起来像这样:另外,您可以指定录制视频目录 。
不要忘记在测试结束时致电
browsercontext.close()
,以成功保存视频。就个人而言,我在test.afterall()
挂钩中进行此操作。edit :有一个 open oble Issue 关于某些配置选项无法按预期工作,包括
视频
一个。在第一个评论中,其中一位开发人员指出“ 视频在这种情况下不起作用,这是一个已知的问题。” 。也许您可以完全跳过视频
选项 - 我想它仍然可以正常工作。edit2 :要将视频录制附加到Allure Reporter,请在
test.afterall()
Hook中包含以下代码:According to the documentation, you have to specify the
dir
property ofrecordVideo
context option. Otherwise videos are not recorded. Thus, your configuration file should look like this:Also, you can specify the record video directory on page level.
Don't forget to call
browserContext.close()
at the end of your tests, for the videos to be successfully saved. Personally, I do it intest.afterAll()
hook.EDIT: There is an open issue regarding some config options not working as expected, including the
video
one. On the first comment, one of the developers states that "Video does not work in this case, that's a known issue.". Maybe you can skip thevideo
option completely - I guess it will still work.EDIT2: To attach the video recording to Allure reporter, include the following code in
test.afterAll()
hook:对于带有Allure报告视频的剧作家
,将显示为链接
附件
,单击它时 - 在下一个Tab Video中打开带有方案的标签视频for playwright with allure report
video will be attached, it is shown as a link

attachment
, when click on it - open in the next tab video with scenario run