Run Tests #96
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: Run Tests | |
on: | |
workflow_run: | |
workflows: ["Deploy to Staging"] | |
types: | |
- completed | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "npm" | |
- name: Install dependencies | |
run: npm install | |
- name: Run lint | |
run: npm run lint | |
unit-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "npm" | |
- name: Install dependencies | |
run: npm install | |
- name: Run unit tests | |
run: npm test | |
e2e-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: List all artifacts | |
run: | | |
curl -H "Accept: application/vnd.github.v3+json" \ | |
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
https://api.github.com/repos/${{ github.repository }}/actions/artifacts | |
- name: Download deploy URL | |
id: download-artifact | |
uses: dawidd6/action-download-artifact@v3 | |
with: | |
workflow: "deploy_staging.yml" | |
workflow_conclusion: "success" | |
name: "deploy-url" | |
- name: Set deploy URL | |
id: url | |
run: echo "DEPLOY_URL=$(cat deploy-url.txt)" >> $GITHUB_ENV | |
- name: Debug deploy URL | |
run: 'echo "DEPLOY_URL: ${{ env.DEPLOY_URL }}"' | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: npm install | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
- name: Run Playwright tests | |
run: npx playwright test | |
env: | |
VITE_AUTH0_TEST_USERNAME: ${{ secrets.VITE_AUTH0_TEST_USERNAME }} | |
VITE_AUTH0_TEST_PASSWORD: ${{ secrets.VITE_AUTH0_TEST_PASSWORD }} | |
PLAYWRIGHT_TEST_BASE_URL: ${{ env.DEPLOY_URL }} | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 |