File size: 1,662 Bytes
1b50562 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | // @ts-check
import { defineConfig, devices } from '@playwright/test';
const BASE_PORT = 6113;
/**
* @see https://playwright.dev/docs/test-configuration
*/
export default defineConfig({
// E2Eテストのみを対象にする(Vitestとの競合を避ける)
testDir: './tests/e2e',
// 並列実行の worker 数
// CI では 2 workers、ローカルでは制限なし
workers: process.env.CI ? 2 : undefined,
// テストの実行タイムアウト
timeout: 30 * 1000,
// テスト実行の期待値
expect: {
// 要素が表示されるまでの最大待機時間
timeout: 5000,
},
// 失敗したテストのスクリーンショットを撮る
use: {
// ベースURL
baseURL: `http://localhost:${BASE_PORT}`,
// スクリーンショットを撮る
screenshot: 'only-on-failure',
// トレースを記録する
trace: 'on-first-retry',
// ダウンロードを許可
acceptDownloads: true,
},
// テスト実行のレポート形式
// 'list' はコンソール出力のみ、HTMLレポートは生成しない
reporter: process.env.CI ? 'github' : 'list',
// テスト前にサーバーを自動起動
webServer: {
command: `uv run aspara dashboard --port ${BASE_PORT}`,
port: BASE_PORT,
reuseExistingServer: !process.env.CI,
timeout: 60 * 1000,
},
// プロジェクト設定
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},
],
});
|