技術共有

pytest-playwright を使用してスクリーンショットとビデオを録画し、Allure レポートに追加します

2024-07-12

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

1. 環境への依存

python、バージョン3.9.5
pytest-playwright, version==0.5.1
allure-pytest、バージョン
2.13.5
pytest、バージョン6.2.5
魅力、バージョン
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

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

2. パラメータの説明

pytest-playwright プラグインの次の 3 つのパラメーターは、スクリーンショット、画面記録、および追跡に使用されます。

  • --tracing 各テストのトレースをログに記録するかどうか。onoffまたはretain-on-failure(デフォルト値:off)。
  • --video テストごとにビデオを録画するかどうか。onoffまたはretain-on-failure(デフォルト値:off)。
  • --