forked from n8n-io/n8n
-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (68 loc) · 2.68 KB
/
playwright-test-reusable.yml
File metadata and controls
77 lines (68 loc) · 2.68 KB
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
70
71
72
73
74
75
76
77
name: Playwright Tests - Reusable
on:
workflow_call:
inputs:
test-mode:
description: 'Test mode: local (pnpm start from local), docker-build, or docker-pull'
required: false
default: 'local'
type: string
shards:
description: 'Shards for parallel execution'
required: false
default: '[1, 2]'
type: string
docker-image:
description: 'Docker image to use (for docker-pull mode)'
required: false
default: 'n8nio/n8n:nightly'
type: string
secrets:
CURRENTS_RECORD_KEY:
required: true
env:
PLAYWRIGHT_BROWSERS_PATH: packages/testing/playwright/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: 3 # We have 2 CPUs on this runner but we can use more workers since it's low CPU intensive
jobs:
test:
runs-on: blacksmith-2vcpu-ubuntu-2204
strategy:
fail-fast: false
matrix:
shard: ${{ fromJSON(inputs.shards || '[1, 2]') }}
name: Test (Shard ${{ matrix.shard }}/${{ strategy.job-total }})
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1
- name: Setup Environment
uses: ./.github/actions/setup-nodejs-blacksmith
with:
build-command: ${{ inputs.test-mode == 'docker-build' && 'pnpm build:docker' || 'pnpm turbo build:playwright' }}
enable-docker-cache: ${{ inputs.test-mode != 'local' }}
env:
INCLUDE_TEST_CONTROLLER: ${{ inputs.test-mode == 'docker-build' && 'true' || '' }}
- name: Install Browsers (Docker Build)
if: inputs.test-mode == 'docker-build'
run: pnpm turbo install-browsers:ci
- name: Run Tests (Local)
if: inputs.test-mode == 'local'
run: |
pnpm --filter=n8n-playwright test:local \
--shard=${{ matrix.shard }}/${{ strategy.job-total }} \
--workers=${{ env.PLAYWRIGHT_WORKERS }}
env:
CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }}
- name: Run Tests (Docker)
if: inputs.test-mode != 'local'
run: |
pnpm --filter=n8n-playwright test:container:standard \
--shard=${{ matrix.shard }}/${{ strategy.job-total }} \
--workers=${{ env.PLAYWRIGHT_WORKERS }}
env:
N8N_DOCKER_IMAGE: ${{ inputs.test-mode == 'docker-build' && 'n8nio/n8n:local' || inputs.docker-image }}
CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }}