test: Migrate sharing spec from Cypress to Playwright (#21024)

This commit is contained in:
Artem Sorokin
2025-10-27 13:16:55 +01:00
committed by GitHub
parent 3caa5ac3a5
commit e3bb2f5c68
14 changed files with 674 additions and 835 deletions
-127
View File
@@ -1,127 +0,0 @@
name: Reusable e2e workflow
on:
workflow_call:
inputs:
branch:
description: 'GitHub branch to test.'
required: false
type: string
user:
description: 'User who kicked this off.'
required: false
type: string
default: 'schedule'
spec:
description: 'Specify specs.'
required: false
default: 'e2e/*'
type: string
parallel:
description: 'Run tests in parallel.'
required: false
default: true
type: boolean
containers:
description: 'Number of containers to run tests in.'
required: false
default: '[1, 2]'
type: string
pr_number:
description: 'PR number to run tests for.'
required: false
type: number
secrets:
CURRENTS_RECORD_KEY:
description: 'Currents record key.'
required: true
env:
NODE_OPTIONS: --max-old-space-size=3072
jobs:
testing:
runs-on: blacksmith-2vcpu-ubuntu-2204
outputs:
dashboardUrl: ${{ steps.cypress.outputs.dashboardUrl }}
strategy:
fail-fast: false
matrix:
# If spec is not e2e/* then we run only one container to prevent
# running the same tests multiple times
containers: ${{ fromJSON( inputs.spec == 'e2e/*' && inputs.containers || '[1]' ) }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ inputs.branch || github.ref }}
- name: Set up and build
uses: ./.github/actions/setup-nodejs-blacksmith
- name: Install Cypress
working-directory: cypress
run: pnpm cypress:install
- name: Cypress run
id: cypress
uses: cypress-io/github-action@be1bab96b388bbd9ce3887e397d373c8557e15af # v6.9.2
with:
working-directory: cypress
install: false
start: pnpm start
wait-on: 'http://localhost:5678'
wait-on-timeout: 120
record: false
spec: ${{ inputs.spec == 'e2e/*' && format('e2e/group{0}/**/*.cy.ts', matrix.containers) || inputs.spec }}
env:
NODE_OPTIONS: --dns-result-order=ipv4first
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
E2E_TESTS: true
COMMIT_INFO_MESSAGE: 🌳 ${{ inputs.branch }} 🤖 ${{ inputs.user }} 🗃️ ${{ inputs.spec }}
SHELL: /bin/sh
- name: Upload test results artifact
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: test-results-${{ matrix.containers }}
path: cypress/test-results-*.xml
upload-to-currents:
needs: testing
if: always()
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Download all test results
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
path: test-results
- name: Merge and upload to Currents
run: |
npm install -g @currents/cmd junit-report-merger
# Merge all XML files, so Currents can show a single view for Cypress
jrm combined-results.xml "test-results/**/test-results-*.xml"
- name: Upload merged XML as artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: merged-junit-results
path: combined-results.xml
- name: Convert and upload to Currents
run: |
currents convert \
--input-format=junit \
--input-file=combined-results.xml \
--output-dir=.currents \
--framework=node \
--framework-version=cypress-14.4.0
currents upload \
--project-id=I0yzoc \
--key=${{ secrets.CURRENTS_RECORD_KEY }} \
--ci-build-id=n8n-io/n8n-${{ github.run_id }}-${{ github.run_attempt }} \
--report-dir=.currents \
--tag=cypress
+2 -12
View File
@@ -16,16 +16,6 @@ jobs:
with:
is_pr_approved_by_maintainer: true
run-e2e-tests:
name: E2E
uses: ./.github/workflows/e2e-reusable.yml
needs: [eligibility_check]
if: needs.eligibility_check.outputs.should_run == 'true'
with:
pr_number: ${{ github.event.pull_request.number }}
user: ${{ github.event.pull_request.user.login || 'PR User' }}
secrets: inherit
run-playwright-tests:
name: Playwright
uses: ./.github/workflows/playwright-test-reusable.yml
@@ -36,9 +26,9 @@ jobs:
post-e2e-tests:
name: E2E - Checks
runs-on: ubuntu-latest
needs: [eligibility_check, run-e2e-tests, run-playwright-tests]
needs: [eligibility_check, run-playwright-tests]
if: always() && needs.eligibility_check.result != 'skipped'
steps:
- name: Fail if tests failed
if: needs.run-e2e-tests.result == 'failure' || needs.run-playwright-tests.result == 'failure'
if: needs.run-playwright-tests.result == 'failure'
run: exit 1
+1 -15
View File
@@ -10,11 +10,6 @@ on:
description: 'GitHub branch to test.'
required: false
default: 'master'
spec:
description: 'Specify specs.'
required: false
default: 'e2e/*'
type: string
user:
description: 'User who kicked this off.'
required: false
@@ -41,15 +36,6 @@ jobs:
[[ "${{ env.START_URL }}" != "" ]] && curl -v -X POST -d 'url=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}' "${{ env.START_URL }}" || echo ""
shell: bash
run-e2e-tests:
name: E2E
uses: ./.github/workflows/e2e-reusable.yml
with:
branch: ${{ github.event.inputs.branch || 'master' }}
user: ${{ github.event.inputs.user || 'PR User' }}
spec: ${{ github.event.inputs.spec || 'e2e/*' }}
secrets: inherit
run-playwright-tests:
name: Playwright
uses: ./.github/workflows/playwright-test-reusable.yml
@@ -60,7 +46,7 @@ jobs:
calls-success-url-notify:
name: Calls success URL and notifies
runs-on: ubuntu-latest
needs: [run-e2e-tests, run-playwright-tests]
needs: [run-playwright-tests]
if: ${{ github.event.inputs.success-url != '' }}
steps:
- name: Notify Slack on failure