From 6656ac51e2a5ab7b4b7aae41111c6a93e649abfc Mon Sep 17 00:00:00 2001 From: taroj1205 Date: Sun, 22 Jun 2025 17:30:13 +1200 Subject: [PATCH] chore(playwright): improve playwright speed --- .github/workflows/ci-pipeline.yml | 2 +- playwright.config.ts | 61 ++++++++++++------------------- 2 files changed, 25 insertions(+), 38 deletions(-) diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index ed68814..98a91a1 100644 --- a/.github/workflows/ci-pipeline.yml +++ b/.github/workflows/ci-pipeline.yml @@ -154,7 +154,7 @@ jobs: - name: Run Playwright Tests run: bunx turbo run test:playwright - timeout-minutes: 10 + timeout-minutes: 8 - name: Upload Playwright Report uses: actions/upload-artifact@v4 diff --git a/playwright.config.ts b/playwright.config.ts index ee80e25..7c35369 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -26,46 +26,33 @@ export default defineConfig({ }, /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - - { - name: 'firefox', - use: { ...devices['Desktop Firefox'] }, - }, - - { - name: 'webkit', - use: { ...devices['Desktop Safari'] }, - }, - - /* Test against mobile viewports. */ - // { - // name: 'Mobile Chrome', - // use: { ...devices['Pixel 5'] }, - // }, - // { - // name: 'Mobile Safari', - // use: { ...devices['iPhone 12'] }, - // }, - - /* Test against branded browsers. */ - // { - // name: 'Microsoft Edge', - // use: { ...devices['Desktop Edge'], channel: 'msedge' }, - // }, - // { - // name: 'Google Chrome', - // use: { ...devices['Desktop Chrome'], channel: 'chrome' }, - // }, - ], + projects: process.env.CI + ? [ + // Only run Firefox in CI for speed + { + name: 'firefox', + use: { ...devices['Desktop Firefox'] }, + }, + ] + : [ + // Run all browsers locally for thorough testing + { + name: 'chromium', + use: { ...devices['Desktop Chrome'] }, + }, + { + name: 'firefox', + use: { ...devices['Desktop Firefox'] }, + }, + { + name: 'webkit', + use: { ...devices['Desktop Safari'] }, + }, + ], /* Run your local dev server before starting the tests */ webServer: { - command: process.env.CI ? 'npm run start' : 'npm run dev', + command: process.env.CI ? 'bun run start' : 'bun run dev', url: 'http://localhost:3000', reuseExistingServer: !process.env.CI, },