mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-02-01 22:47:40 +00:00
feat: migrate cypress e2e tests to playwright (#1739)
This commit is contained in:
5
.github/actions/setup-frontend/action.yml
vendored
5
.github/actions/setup-frontend/action.yml
vendored
@@ -13,8 +13,9 @@ runs:
|
||||
- if: inputs.install-e2e-binaries == 'false'
|
||||
shell: bash
|
||||
run: |
|
||||
echo "CYPRESS_INSTALL_BINARY=0" >> $GITHUB_ENV
|
||||
echo "PUPPETEER_SKIP_DOWNLOAD=true" >> $GITHUB_ENV
|
||||
echo "CYPRESS_INSTALL_BINARY=0" >> $GITHUB_ENV
|
||||
echo "PUPPETEER_SKIP_DOWNLOAD=true" >> $GITHUB_ENV
|
||||
echo "PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1" >> $GITHUB_ENV
|
||||
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
|
||||
with:
|
||||
run_install: false
|
||||
|
||||
99
.github/workflows/test.yml
vendored
99
.github/workflows/test.yml
vendored
@@ -346,7 +346,81 @@ jobs:
|
||||
name: frontend_dist
|
||||
path: ./frontend/dist
|
||||
|
||||
test-frontend-e2e:
|
||||
test-frontend-e2e-playwright:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- api-build
|
||||
- frontend-build
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
shard: [1, 2, 3, 4, 5, 6]
|
||||
total-shards: [6]
|
||||
services:
|
||||
dex:
|
||||
image: ghcr.io/go-vikunja/dex-testing:main@sha256:d401c06a9f8fd36ece446a07499b827232af7f21eb36872a76c9eac4d0c77bab
|
||||
ports:
|
||||
- 5556:5556
|
||||
container:
|
||||
image: mcr.microsoft.com/playwright:v1.57.0-jammy
|
||||
options: --user 1001
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
||||
- name: Download Vikunja Binary
|
||||
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6
|
||||
with:
|
||||
name: vikunja_bin
|
||||
- uses: ./.github/actions/setup-frontend
|
||||
with:
|
||||
install-e2e-binaries: false # Playwright browsers already in container
|
||||
- name: Download Frontend
|
||||
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6
|
||||
with:
|
||||
name: frontend_dist
|
||||
path: ./frontend/dist
|
||||
- run: chmod +x ./vikunja
|
||||
- name: Run Playwright tests
|
||||
timeout-minutes: 20
|
||||
working-directory: frontend
|
||||
run: |
|
||||
pnpm run preview:vikunja &
|
||||
pnpm run preview &
|
||||
|
||||
# Wait for services to be ready (using GET method)
|
||||
pnpx wait-on http-get://127.0.0.1:4173 http-get://127.0.0.1:3456/api/v1/info --timeout 60000
|
||||
|
||||
pnpm run test:e2e --shard=${{ matrix.shard }}/${{ matrix.total-shards }}
|
||||
env:
|
||||
PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS: 1
|
||||
TEST_SECRET: averyLongSecretToSe33dtheDB
|
||||
VIKUNJA_SERVICE_TESTINGTOKEN: averyLongSecretToSe33dtheDB
|
||||
VIKUNJA_LOG_LEVEL: DEBUG
|
||||
VIKUNJA_CORS_ENABLE: 1
|
||||
VIKUNJA_SERVICE_PUBLICURL: http://127.0.0.1:3456
|
||||
VIKUNJA_DATABASE_PATH: memory
|
||||
VIKUNJA_DATABASE_TYPE: sqlite
|
||||
VIKUNJA_RATELIMIT_NOAUTHLIMIT: 1000
|
||||
VIKUNJA_AUTH_OPENID_ENABLED: 1
|
||||
VIKUNJA_AUTH_OPENID_PROVIDERS_DEX_NAME: Dex
|
||||
VIKUNJA_AUTH_OPENID_PROVIDERS_DEX_AUTHURL: http://dex:5556
|
||||
VIKUNJA_AUTH_OPENID_PROVIDERS_DEX_CLIENTID: vikunja
|
||||
VIKUNJA_AUTH_OPENID_PROVIDERS_DEX_CLIENTSECRET: secret
|
||||
- name: Upload Playwright Report
|
||||
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
|
||||
if: always()
|
||||
with:
|
||||
name: playwright-report-${{ matrix.shard }}
|
||||
path: frontend/playwright-report/
|
||||
retention-days: 30
|
||||
- name: Upload Test Results
|
||||
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
|
||||
if: always()
|
||||
with:
|
||||
name: playwright-test-results-${{ matrix.shard }}
|
||||
path: frontend/test-results/
|
||||
retention-days: 30
|
||||
|
||||
test-frontend-e2e-cypress:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- api-build
|
||||
@@ -356,15 +430,6 @@ jobs:
|
||||
image: ghcr.io/go-vikunja/dex-testing:main@sha256:d401c06a9f8fd36ece446a07499b827232af7f21eb36872a76c9eac4d0c77bab
|
||||
ports:
|
||||
- 5556:5556
|
||||
strategy:
|
||||
# when one test fails, DO NOT cancel the other
|
||||
# containers, because this will kill Cypress processes
|
||||
# leaving Cypress Cloud hanging ...
|
||||
# https://github.com/cypress-io/github-action/issues/48
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# Only run parallel tests for non-fork PRs, single container for forks
|
||||
containers: ${{ github.event.pull_request.head.repo.fork != true && fromJSON('[1, 2, 3, 4]') || fromJSON('[1]') }}
|
||||
container:
|
||||
image: cypress/browsers:latest@sha256:7331c596894429c9809c9a8bf92158224d151d5fa9736d14cf8e0268805a37ab
|
||||
options: --user 1001
|
||||
@@ -387,7 +452,6 @@ jobs:
|
||||
timeout-minutes: 20
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
||||
CYPRESS_API_URL: http://127.0.0.1:3456/api/v1
|
||||
CYPRESS_TEST_SECRET: averyLongSecretToSe33dtheDB
|
||||
CYPRESS_DEFAULT_COMMAND_TIMEOUT: 60000
|
||||
@@ -408,19 +472,10 @@ jobs:
|
||||
install: false
|
||||
working-directory: frontend
|
||||
browser: chrome
|
||||
record: ${{ github.event.pull_request.head.repo.fork != true }}
|
||||
parallel: ${{ github.event.pull_request.head.repo.fork != true }}
|
||||
record: false
|
||||
parallel: false
|
||||
start: |
|
||||
pnpm run preview:vikunja
|
||||
pnpm run preview
|
||||
wait-on: http://127.0.0.1:4173,http://127.0.0.1:3456/api/v1/info
|
||||
wait-on-timeout: 10
|
||||
|
||||
# This step only exists so that we can make it required, because we can't make
|
||||
# the actual test step required due to the matrix
|
||||
test-frontend-e2e-success:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- test-frontend-e2e
|
||||
steps:
|
||||
- run: exit 0
|
||||
|
||||
Reference in New Issue
Block a user