Skip to content
Open
8 changes: 5 additions & 3 deletions .github/workflows/playwright-test-docker-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
shards:
description: 'Shards for parallel execution'
required: false
default: '[1]'
default: '[1, 2, 3, 4, 5, 6, 7, 8]'
type: string
image:
description: 'Image to use'
Expand All @@ -31,8 +31,10 @@ jobs:
build-and-test:
uses: ./.github/workflows/playwright-test-reusable.yml
with:
test-mode: docker-pull
test-mode: docker-build
shards: ${{ inputs.shards }}
docker-image: ${{ inputs.image }}
test-command: pnpm --filter=n8n-playwright test:container:standard
test-command: pnpm --filter=n8n-playwright test:container:multi-main:ui
runner: blacksmith-4vcpu-ubuntu-2204
workers: '3'
secrets: inherit
20 changes: 13 additions & 7 deletions .github/workflows/playwright-test-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 "multi-main"; then
pnpm --filter=n8n-playwright exec npx pwc-p -- --project=multi-main:ui --project=multi-main:ui:isolated --workers=${{ env.PLAYWRIGHT_WORKERS }}
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 }}
Expand Down
8 changes: 8 additions & 0 deletions packages/testing/playwright/currents.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions packages/testing/playwright/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export default defineConfig<CurrentsFixtures, CurrentsWorkerFixtures>({
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: 'auto',
},

reporter: IS_CI
Expand Down
Loading