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