diff --git a/.github/workflows/playwright-test-ci.yml b/.github/workflows/playwright-test-ci.yml index c5ccbe1c9d0cd..145b7615601d3 100644 --- a/.github/workflows/playwright-test-ci.yml +++ b/.github/workflows/playwright-test-ci.yml @@ -10,10 +10,10 @@ jobs: uses: ./.github/workflows/playwright-test-reusable.yml with: test-mode: docker-build - test-command: pnpm --filter=n8n-playwright test:container:multi-main:ui + test-command: pnpm --filter=n8n-playwright exec npx pwc-p -- --project=multi-main:ui --workers=1 shards: '[1, 2, 3, 4, 5, 6, 7, 8]' runner: blacksmith-4vcpu-ubuntu-2204 - workers: '1' + workers: '2' secrets: inherit multi-main-isolated: @@ -21,7 +21,7 @@ jobs: uses: ./.github/workflows/playwright-test-reusable.yml with: test-mode: docker-build - test-command: pnpm --filter=n8n-playwright test:container:multi-main:isolated + test-command: pnpm --filter=n8n-playwright exec npx pwc-p -- --project=multi-main:ui:isolated --workers=1 shards: '[1]' runner: blacksmith-4vcpu-ubuntu-2204 workers: '1' diff --git a/.github/workflows/playwright-test-reusable.yml b/.github/workflows/playwright-test-reusable.yml index 4f85fcafb145a..688ebceb29bd5 100644 --- a/.github/workflows/playwright-test-reusable.yml +++ b/.github/workflows/playwright-test-reusable.yml @@ -53,11 +53,11 @@ on: required: false env: - PLAYWRIGHT_BROWSERS_PATH: packages/testing/playwright/ms-playwright-cache + PLAYWRIGHT_BROWSERS_PATH: ms-playwright-cache NODE_OPTIONS: --max-old-space-size=3072 # Disable Ryuk to avoid issues with Docker since it needs privileged access, containers are cleaned on teardown anyway TESTCONTAINERS_RYUK_DISABLED: true - PLAYWRIGHT_WORKERS: ${{ inputs.workers || '2' }} # Configurable workers, defaults to 2 to reduce resource contention + PLAYWRIGHT_WORKERS: ${{ inputs.workers || '3' }} # Must match CI's COVERAGE_ENABLED to ensure Turbo cache hits (it's a globalEnv in turbo.json) COVERAGE_ENABLED: 'true' @@ -69,7 +69,7 @@ jobs: fail-fast: false matrix: shard: ${{ fromJSON(inputs.shards || '[1, 2, 3, 4, 5, 6, 7, 8]') }} - name: Test (Shard ${{ matrix.shard }}/${{ strategy.job-total }}) + name: Test (Machine ${{ matrix.shard }}) steps: - name: Checkout @@ -87,7 +87,6 @@ jobs: INCLUDE_TEST_CONTROLLER: ${{ inputs.test-mode == 'docker-build' && 'true' || '' }} - name: Install Browsers - if: inputs.test-mode == 'docker-build' run: pnpm turbo install-browsers:ci - name: Pre-pull Test Container Images @@ -104,12 +103,19 @@ jobs: - name: Run Tests run: | - ${{ inputs.test-command }} \ - --shard=${{ matrix.shard }}/${{ strategy.job-total }} \ - --workers=${{ env.PLAYWRIGHT_WORKERS }} + if echo "${{ inputs.test-command }}" | grep -q "pwc-p"; then + ${{ inputs.test-command }} + else + ${{ inputs.test-command }} \ + --shard=${{ matrix.shard }}/${{ strategy.job-total }} \ + --workers=${{ env.PLAYWRIGHT_WORKERS }} + fi env: + RESET_E2E_DB: true N8N_DOCKER_IMAGE: ${{ inputs.test-mode == 'docker-build' && 'n8nio/n8n:local' || inputs.docker-image }} CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }} + CURRENTS_PROJECT_ID: I0yzoc + CURRENTS_CI_BUILD_ID: n8n-${{ github.run_id }}-${{ github.run_attempt }} QA_PERFORMANCE_METRICS_WEBHOOK_URL: ${{ secrets.QA_PERFORMANCE_METRICS_WEBHOOK_URL }} QA_PERFORMANCE_METRICS_WEBHOOK_USER: ${{ secrets.QA_PERFORMANCE_METRICS_WEBHOOK_USER }} QA_PERFORMANCE_METRICS_WEBHOOK_PASSWORD: ${{ secrets.QA_PERFORMANCE_METRICS_WEBHOOK_PASSWORD }} diff --git a/packages/testing/playwright/currents.config.ts b/packages/testing/playwright/currents.config.ts index 546981240c869..699d936f5c788 100644 --- a/packages/testing/playwright/currents.config.ts +++ b/packages/testing/playwright/currents.config.ts @@ -3,6 +3,14 @@ import type { CurrentsConfig } from '@currents/playwright'; const config: CurrentsConfig = { recordKey: process.env.CURRENTS_RECORD_KEY ?? '', projectId: process.env.CURRENTS_PROJECT_ID ?? 'I0yzoc', + ciBuildId: + process.env.CURRENTS_CI_BUILD_ID ?? + (process.env.GITHUB_RUN_ID + ? `${process.env.GITHUB_RUN_ID}-${process.env.GITHUB_RUN_ATTEMPT ?? '1'}` + : `local-${Date.now()}`), + orchestration: { + batchSize: Number(process.env.CURRENTS_BATCH_SIZE) || 'auto', + }, ...(process.env.BUILD_WITH_COVERAGE === 'true' && { coverage: { projects: true, diff --git a/packages/testing/playwright/playwright.config.ts b/packages/testing/playwright/playwright.config.ts index 88c2a2fa57dc3..0ffdec894785e 100644 --- a/packages/testing/playwright/playwright.config.ts +++ b/packages/testing/playwright/playwright.config.ts @@ -78,6 +78,7 @@ export default defineConfig({ actionTimeout: 20000, // TODO: We might need to make this dynamic for container tests if we have low resource containers etc navigationTimeout: 10000, currentsFixturesEnabled: !!process.env.CI, + currentsBatchSize: 5, }, reporter: IS_CI