Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 0 additions & 73 deletions .github/workflows/cypress-snapshot-update.yml

This file was deleted.

171 changes: 0 additions & 171 deletions .github/workflows/cypress.yml

This file was deleted.

106 changes: 106 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT

name: Playwright

on: pull_request

concurrency:
group: playwright-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

env:
APP_NAME: ${{ github.event.repository.name }}
BRANCH: ${{ github.base_ref || github.ref_name }}

jobs:
playwright:
runs-on: ubuntu-latest

name: Playwright E2E tests

steps:
- name: Disabled on forks
if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
run: |
echo 'Can not run Playwright on forks'
exit 1

- name: Checkout app
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

- name: Check composer.json
id: check_composer
uses: andstor/file-existence-action@558493d6c74bf472d87c84eab196434afc2fa029 # v3.1.0
with:
files: 'composer.json'

- name: Install composer dependencies
if: steps.check_composer.outputs.files_exists == 'true'
run: composer install --no-dev

- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
id: versions
with:
fallbackNode: '^24'
fallbackNpm: '^11'

- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: ${{ steps.versions.outputs.nodeVersion }}

- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'

- name: Install dependencies & build app
run: |
npm ci
TESTING=true npm run build --if-present

- name: Install Playwright browsers
run: npx playwright install chromium --with-deps

- name: Run Playwright tests
run: npx playwright test
env:
BRANCH: ${{ env.BRANCH }}
CI: true

- name: Show Nextcloud logs on failure
if: failure()
run: |
docker exec nextcloud-e2e-test-server_${{ env.APP_NAME }} cat data/nextcloud.log || true

- name: Upload Playwright report
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 7
if-no-files-found: ignore

- name: Upload Playwright traces
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
if: failure()
with:
name: playwright-traces
path: test-results/
retention-days: 7
if-no-files-found: ignore

summary:
runs-on: ubuntu-latest-low
needs: playwright
if: always()
name: playwright-summary
steps:
- name: Summary status
run: if ${{ needs.playwright.result != 'success' && needs.playwright.result != 'skipped' }}; then exit 1; fi
12 changes: 5 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ coverage/
vendor
.php_cs.cache

# Cypress files
# Playwright files
js/*roboto*
cypress/downloads
cypress/screenshots
cypress/snapshots
cypress/videos
cypress/snapshots/actual
cypress/snapshots/diff
playwright-report/
test-results/
blob-report/
playwright/.cache/

# RelativeCI webpack bundle stats
webpack-stats.json
Expand Down
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,19 @@ Show your latest holiday photos and videos like in the movies. Show a glimpse of
### 🧙 Advanced development stuff
To build the Javascript whenever you make changes, you can also run `npm run dev` for development builds.

### 📷 Running cypress tests
To run e2e cypress tests, execute `npm run cypress`.
### 📷 Running Playwright tests
The end-to-end tests use [Playwright](https://playwright.dev/) and a disposable Nextcloud Docker container.

The `visual-regression` tests require additional care as they depend on installation of fonts in the application. To achieve repeatable results run the tests using `npm run cypress:visual-regression`. This will build the app with the required fonts and run the tests.
Build the app once, then run the tests:

If changes are required to the reference (base) screenshots used by the `visual-regression` tests, run `cypress:update-snapshots` and commit the updated screenshots.
```sh
npm ci
npx playwright install chromium
TESTING=true npm run build
npm run test:e2e
```

`npm run test:e2e:ui` opens the interactive UI. The Nextcloud container is started automatically by `playwright/start-server.mjs` (port 8081) and reused between local runs; set `PLAYWRIGHT_BASE_URL` to target an existing instance instead.

## API

Expand Down
Loading
Loading