0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

playwright.config.tsについて

Posted at

複数の設定ファイル

Playwrightでは、環境に応じて異なる設定ファイルを使用できます:

  • playwright.config.ts(デフォルト)
  • playwright-prod.config.ts(本番環境用)
  • playwright-staging.config.ts(ステージング環境用)

など

特定の設定ファイルを使用する場合

npx playwright test --config=playwright-prod.config.ts

設定ファイルの構造

設定ファイルは主に2つのブロックで構成されています:

1. useブロック

  • グローバルな設定を定義
  • すべてのテストに適用される共通設定
use: {
baseURL: '[http://localhost:4200](http://localhost:4200/)',
viewport: { width: 1280, height: 720 },
screenshot: 'on',
}

2. projectsブロック

  • プロジェクトごとの個別設定
  • useブロックの設定を上書き可能
projects: [
  {
    name: 'chrome',
    use: {
      ...devices['Desktop Chrome'],
      baseURL: 'http://staging.example.com',  // useブロックの設定を上書き
    }
  }
]

この構造により、共通設定と個別設定を柔軟に組み合わせることができます。

0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?