Cypress E2E Tests #1608
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Cypress E2E Tests | |
on: | |
workflow_dispatch: | |
# schedule: | |
# - cron: '*/5 * * * *' # Runs every 5 minutes | |
inputs: | |
environment: | |
description: 'Select environment' | |
required: true | |
default: 'PROD' | |
type: choice | |
options: | |
- PROD | |
- TOOLS | |
jobs: | |
cypress-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
# don't fail the entire matrix on failure | |
fail-fast: false | |
matrix: | |
# run copies of the current job in parallel | |
containers: [1] # , 2, 3, 4, 5, 6, 7, 8, 9, 10] - temp disabled mass | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18.18.2' | |
- name: Setup authentication for vite & other synthetic test variables | |
working-directory: app/web | |
run: | | |
sudo apt update | |
sudo apt install uuid -y | |
cp .env .env.local | |
echo "VITE_AUTH0_USERNAME=${{ secrets.VITE_AUTH0_USERNAME }}" >> .env.local | |
echo "VITE_AUTH0_PASSWORD=${{ secrets.VITE_AUTH0_PASSWORD }}" >> .env.local | |
echo "VITE_SI_CYPRESS_MULTIPLIER=${{ vars.VITE_PROD_SI_CYPRESS_MULTIPLIER }}" >> .env.local | |
if [ "${{ github.event.inputs.environment }}" == "PROD" ]; then | |
echo "VITE_SI_WORKSPACE_URL=${{ vars.VITE_PROD_SI_WORKSPACE_URL }}" >> .env.local | |
echo "VITE_SI_WORKSPACE_ID=${{ vars.VITE_PROD_SI_WORKSPACE_ID }}" >> .env.local | |
elif [ "${{ github.event.inputs.environment }}" == "TOOLS" ]; then | |
echo "VITE_SI_WORKSPACE_URL=${{ vars.VITE_TOOLS_SI_WORKSPACE_URL }}" >> .env.local | |
echo "VITE_SI_WORKSPACE_ID=${{ vars.VITE_TOOLS_SI_WORKSPACE_ID }}" >> .env.local | |
fi | |
echo "VITE_UUID=$(uuid)" >> .env.local | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8.10.5 | |
- name: Install Cypress | |
working-directory: app/web | |
run: | | |
pnpm i | |
pnpm install cypress | |
- uses: nick-fields/retry@v2 | |
with: | |
max_attempts: 3 | |
timeout_minutes: 20 | |
command: cd app/web && npx cypress run --spec "cypress/e2e/**" | |
- name: 'Upload Cypress Recordings to Github' | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: cypress-recordings-run-${{ matrix.containers }} | |
path: app/web/cypress/videos/**/*.mp4 | |
retention-days: 5 | |
- name: Send Slack Failure Webhook | |
if: failure() | |
run: | | |
curl -X POST -H 'Content-type: application/json' --data "{\"text\": \":si: Failed Cypress E2E Test for Production: <https://github.com/systeminit/si/actions/runs/$GITHUB_RUN_ID|:test_tube: Link>\"}" ${{ secrets.SLACK_WEBHOOK_URL }} |