使用pytest-playwright截图和录制视频并添加到Allure报告

一、依赖环境

python, version3.9.5
pytest-playwright, version==0.5.1
allure-pytest, version
2.13.5
pytest, version6.2.5
allure, version
2.22.0

pytest-playwright支持如下命令行参数:

Playwright:
  --browser={chromium,firefox,webkit}
                        Browser engine which should be used
  --headed              Run tests in headed mode.
  --browser-channel=BROWSER_CHANNEL
                        Browser channel to be used.
  --slowmo=SLOWMO       Run tests with slow mo
  --device=DEVICE       Device to be emulated.
  --output=OUTPUT       Directory for artifacts produced by tests, defaults to test-results.
  --tracing={on,off,retain-on-failure}
                        Whether to record a trace for each test.
  --video={on,off,retain-on-failure}
                        Whether to record video for each test.
  --screenshot={on,off,only-on-failure}
                        Whether to automatically capture a screenshot after each test.
  --full-page-screenshot
                        Whether to take a full page screenshot

二、参数说明

pytest-playwright 插件的这3 个参数用于截图,录屏和跟踪:

  • --tracing 是否为每个测试记录轨迹。onoffretain-on-failure(默认值:off)。
  • --video 是否为每次测试录制视频。onoffretain-on-failure(默认值:off)。
  • --

相关推荐

  1. vue中使用video.js,且可以录制下载视频

    2024-07-11 19:12:03       69 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-11 19:12:03       66 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-11 19:12:03       70 阅读
  3. 在Django里面运行非项目文件

    2024-07-11 19:12:03       57 阅读
  4. Python语言-面向对象

    2024-07-11 19:12:03       68 阅读

热门阅读

  1. 【React Hooks原理 - useReducer】

    2024-07-11 19:12:03       19 阅读
  2. 2024.7.10 刷题总结

    2024-07-11 19:12:03       25 阅读
  3. 什么是逻辑运算中的短路效应?

    2024-07-11 19:12:03       22 阅读
  4. 开发指南043-自定义注解

    2024-07-11 19:12:03       24 阅读
  5. C语言 比较两个字符串

    2024-07-11 19:12:03       20 阅读
  6. Andt Desgin Vue Pro 项目添加前缀访问解决

    2024-07-11 19:12:03       17 阅读
  7. MDA协议

    2024-07-11 19:12:03       23 阅读
  8. Spring Boot中集成DJL运行Python PyTorch模型:MNIST实战

    2024-07-11 19:12:03       18 阅读
  9. GraphSAGE项目练手

    2024-07-11 19:12:03       22 阅读
  10. el-dialog弹框里面的组件第二次打开create不生效

    2024-07-11 19:12:03       19 阅读