Compartir tecnología

Captura de pantalla y graba video usando pytest-playwright y agrégalo al informe Allure

2024-07-12

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

1. Dependencia del medio ambiente

pitón, versión3.9.5
pytest-playwright, version==0.5.1
allure-pytest, versión
2.13.5
pytest, versión6.2.5
atractivo, versión
2.22.0

pytest-playwrightSe admiten los siguientes parámetros de línea de comando:

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

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

2. Descripción del parámetro

pytest-playwright Estos tres parámetros del complemento se utilizan para capturas de pantalla, grabación de pantalla y seguimiento:

  • --tracing Si se debe registrar un seguimiento para cada prueba.onofforetain-on-failure(valor por defecto:off)。
  • --video Si se debe grabar un vídeo para cada prueba.onofforetain-on-failure(valor por defecto:off)。
  • --