Migrate e2e tests to Playwright #150
This file contains hidden or 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: Playwright | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - "v*.*" | |
| pull_request: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - elixir-version: "1.19.1" | |
| otp-version: "28.1.1" | |
| backward-compatibility: false | |
| - elixir-version: "1.16.0" | |
| otp-version: "26.0.2" | |
| backward-compatibility: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install inotify-tools | |
| run: sudo apt-get update && sudo apt-get install -y inotify-tools | |
| - name: Set up Elixir | |
| uses: erlef/setup-beam@v1.20.4 | |
| with: | |
| elixir-version: ${{ matrix.elixir-version }} # [Required] Define the Elixir version | |
| otp-version: ${{ matrix.otp-version }} # [Required] Define the Erlang/OTP version | |
| - name: Copy mix.lock for backward compatibility | |
| if: ${{ matrix.backward-compatibility }} | |
| run: cp ./.github/workflows/assets/mix.lock mix.lock | |
| - name: Cache Mix | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| deps | |
| _build | |
| key: ${{ matrix.backward-compatibility && 'backward-compatibility-' || '' }}${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} | |
| restore-keys: ${{ matrix.backward-compatibility && 'backward-compatibility-' || '' }}${{ runner.os }}-mix- | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| - name: Cache Playwright | |
| uses: actions/cache@v3 | |
| id: playwright-cache | |
| with: | |
| path: | | |
| ~/.cache/ms-playwright | |
| node_modules | |
| key: ${{ runner.os }}-playwright-${{ hashFiles('./e2e/package-lock.json') }} | |
| - name: Check prettier | |
| working-directory: ./e2e | |
| run: npx prettier . --check | |
| - name: Install Mix Dependencies | |
| run: mix deps.get | |
| - name: Install Node Dependencies | |
| working-directory: ./e2e | |
| run: npm ci | |
| - name: Install Playwright Dependencies | |
| working-directory: ./e2e | |
| run: npx playwright install --with-deps | |
| if: steps.playwright-cache.outputs.cache-hit != 'true' | |
| - name: Run Playwright tests | |
| run: mix e2e_playwright | |
| - uses: actions/upload-artifact@v4 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: ${{ matrix.backward-compatibility && 'backward-compatibility-' || '' }}playwright-report | |
| path: e2e/playwright-report/ | |
| retention-days: 1 |