|
| 1 | +# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | +name: Playwright Tests |
| 4 | +on: |
| 5 | + pull_request: |
| 6 | + branches: [main] |
| 7 | + |
| 8 | +jobs: |
| 9 | + test: |
| 10 | + timeout-minutes: 60 |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - name: Checkout app |
| 14 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 15 | + |
| 16 | + - name: Check composer.json |
| 17 | + id: check_composer |
| 18 | + uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v2 |
| 19 | + with: |
| 20 | + files: 'composer.json' |
| 21 | + |
| 22 | + - name: Install composer dependencies |
| 23 | + if: steps.check_composer.outputs.files_exists == 'true' |
| 24 | + run: composer install --no-dev |
| 25 | + |
| 26 | + - name: Read package.json node and npm engines version |
| 27 | + uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3 |
| 28 | + id: versions |
| 29 | + with: |
| 30 | + fallbackNode: '^20' |
| 31 | + fallbackNpm: '^10' |
| 32 | + |
| 33 | + - name: Set up node ${{ steps.versions.outputs.nodeVersion }} |
| 34 | + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 |
| 35 | + with: |
| 36 | + node-version: ${{ steps.versions.outputs.nodeVersion }} |
| 37 | + |
| 38 | + - name: Set up npm ${{ steps.versions.outputs.npmVersion }} |
| 39 | + run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}" |
| 40 | + |
| 41 | + - name: Install node dependencies & build app |
| 42 | + run: | |
| 43 | + npm ci |
| 44 | + TESTING=true npm run build --if-present |
| 45 | +
|
| 46 | + - name: Install Playwright Browsers |
| 47 | + run: npx playwright install chromium --only-shell |
| 48 | + |
| 49 | + - name: Run Playwright tests |
| 50 | + run: npx playwright test |
| 51 | + |
| 52 | + - uses: actions/upload-artifact@v4 |
| 53 | + if: always() |
| 54 | + with: |
| 55 | + name: playwright-report |
| 56 | + path: playwright-report/ |
| 57 | + retention-days: 30 |
0 commit comments