Skip to content

test(e2e): use cypress action #24

test(e2e): use cypress action

test(e2e): use cypress action #24

Workflow file for this run

name: End-to-End Testing (Cypress) ๐Ÿš€
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
schedule:
- cron: '0 2 * * FRI'
jobs:
cypress-run:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
browser: [ chrome, electron ]
env:
- name: no-variable
NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN: ""
- name: with-variable
NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN: "https://rekor.sigstore.dev"
node: [18]
steps:
- name: Checkout ๐Ÿ›Ž
uses: actions/checkout@v4
- name: Download the build folder
uses: actions/download-artifact@v4
with:
name: build
path: .next
# - name: Start Next.js app
# run: npm run start &
# env:
# NODE_ENV: ${{ matrix.env.name }}
# NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN: ${{ matrix.env.NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN }}
# - name: Wait for Next.js to start
# run: npx wait-on http://localhost:3000
- name: Run Cypress E2E Tests on Node v${{ matrix.node }}
uses: cypress-io/github-action@v6
with:
browser: ${{ matrix.browser }}
# we have already installed all dependencies above
# the entire command will automatically be prefixed with "npm"
# and we need the second "npm" to execute "cypress run ..." command line
command-prefix: "-H 127.0.0.1 -- npx"
install: false
parallel: true
record: true
start: npm start
# keep quoted url to be safe against YML parsing surprises
wait-on: "http://127.0.0.1:3000"
env:
NODE_ENV: ${{ matrix.env.name }}
NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN: ${{ matrix.env.NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN }}
CYPRESS_baseUrl: "http://127.0.0.1:3000"
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Screenshot Artifacts ๐Ÿ“ธ
uses: actions/upload-artifact@v4
# if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn`
- name: Upload Video Artifacts ๐ŸŽฅ
uses: actions/upload-artifact@v4
with:
name: cypress-videos
path: cypress/videos
if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn`
# - name: Upload Electron artifacts ๐Ÿ“ธ
# uses: actions/upload-artifact@v4
# with:
# name: electron-artifacts
# path: |
# ./artifacts/electron/videos
# ./artifacts/electron/screenshots
# if-no-files-found: ignore
# retention-days: 5