Skip to content

Commitly End-to-End testing check for Playground Apps #617

Commitly End-to-End testing check for Playground Apps

Commitly End-to-End testing check for Playground Apps #617

name: Commitly End-to-End testing check for Playground Apps
env:
BRANCH_NAME_RAW: ${{ github.event.workflow_run.head_branch || github.ref_name }}
on:
workflow_dispatch:
workflow_run:
workflows: ["Deploy Playground Apps to Vercel"]
types:
- completed
conclusion: success
jobs:
e2e-tests:
timeout-minutes: 60
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
- name: Get installed Playwright version
id: playwright-version
run: echo "::set-output name=version::$(yarn why --json @playwright/test | grep -h 'workspace:.' | jq --raw-output '.children[].locator' | sed -e 's/@playwright\/test@.*://')"
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: |
~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: List the state of node modules
continue-on-error: true
run: |
cd packages/tests-e2e
npm list
- name: Install Dependencies
run: |
cd packages/tests-e2e
npm install
- uses: actions/cache@v3
id: playwright-cache
with:
path: '~/.cache/ms-playwright'
key: '${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}'
restore-keys: |
${{ runner.os }}-playwright-
- name: Install Playwright's dependencies
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: |
cd packages/tests-e2e
npx playwright install --with-deps
- name: Install and run E2E Test for react
run: |
cd packages/tests-e2e
BRANCH_NAME=$(echo $BRANCH_NAME_RAW | tr '/_' '-')
export PLAYWRIGHT_TEST_URL="https://$BRANCH_NAME.react.playground.corbado.io"
PLAYWRIGHT_TEST_URL=$PLAYWRIGHT_TEST_URL npx playwright test --config=playwright.config.ui.ts
env:
PLAYWRIGHT_NUM_CORES: 4
PLAYWRIGHT_JWT_TOKEN: ${{ secrets.PLAYWRIGHT_JWT_TOKEN }}
PLAYWRIGHT_MICROSOFT_EMAIL: ${{ secrets.PLAYWRIGHT_MICROSOFT_EMAIL }}
PLAYWRIGHT_MICROSOFT_PASSWORD: ${{ secrets.PLAYWRIGHT_MICROSOFT_PASSWORD }}
GITHUB_RUN_ID: ${{ github.run_id }}
SLACK_BOT_USER_OAUTH_TOKEN: ${{ secrets.SLACK_BOT_USER_OAUTH_TOKEN }}
GITHUB_BRANCH_NAME: ${{ github.ref_name }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: packages/tests-e2e/playwright-report/
retention-days: 30