0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

PlayWrightで実行内容を録画

Last updated at Posted at 2023-05-23

公式ドキュメント

playwright.config.tsに書く場合

playwright.config.ts
import { defineConfig } from '@playwright/test';
export default defineConfig({
  use: {
    video: {
      mode: 'on-first-retry', 
      size: { width: 640, height: 480 }
    }
  },
});

Configファイル以外に書く例

video.spec.ts
const context = await browser.newContext({
  recordVideo: {
    dir: 'videos/',
    size: { width: 640, height: 480 },
  }
});

その他

特定の領域のビデオを記録する:

const rect = {
  x: 100,
  y: 100,
  width: 200,
  height: 200,
};

await page.video(rect).saveAs('./video.mp4');

特定のスクリプトを実行した後にビデオを記録する:

await page.evaluate(() => {
  // ここにスクリプトを実行します
});

await page.video().saveAs('./video.mp4');

参考youtube

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?