Skip to content
Open
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
9 changes: 9 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,14 @@ module.exports = {
'n/no-unpublished-import': 'off',
},
},
{
// The e2e suite and its server script run in Node, outside the bundle.
files: ['playwright/**', 'playwright.config.ts'],
rules: {
'n/no-unpublished-import': 'off',
'n/no-process-exit': 'off',
'no-console': 'off',
},
},
],
}
109 changes: 109 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later

name: Playwright

on: pull_request

permissions:
contents: read

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

jobs:
playwright:
runs-on: ubuntu-latest
timeout-minutes: 30

name: Playwright e2e

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

- 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.3'

- 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
npm run build

# Server master dropped the bundled Viewer app (nextcloud/server#63954);
# until a release supports @nextcloud/viewer, test against the PR that does.
- name: Build richdocuments with @nextcloud/viewer support
env:
# nextcloud/richdocuments#6142 (fix/6060-nextcloud-viewer-v2)
RICHDOCUMENTS_SHA: e101e6b3266cdb37e570137733bada08ca3f34af
run: |
git init -q "$RUNNER_TEMP/richdocuments"
cd "$RUNNER_TEMP/richdocuments"
git fetch -q --depth=1 https://github.com/nextcloud/richdocuments.git "$RICHDOCUMENTS_SHA"
git checkout -q FETCH_HEAD
composer install --no-dev
npm ci
npm run build
echo "RICHDOCUMENTS_PATH=$RUNNER_TEMP/richdocuments" >> "$GITHUB_ENV"

- name: Build Text with @nextcloud/viewer support
env:
# nextcloud/text#9235 (feature/migrate-new-viewer-api)
TEXT_SHA: 06f59d2bb2b4744ede66e7a60fabfe5cbde0c99c
CYPRESS_INSTALL_BINARY: 0
run: |
git init -q "$RUNNER_TEMP/text"
cd "$RUNNER_TEMP/text"
git fetch -q --depth=1 https://github.com/nextcloud/text.git "$TEXT_SHA"
git checkout -q FETCH_HEAD
composer install --no-dev
npm ci
npm run build
echo "TEXT_PATH=$RUNNER_TEMP/text" >> "$GITHUB_ENV"

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

- name: Run Playwright tests
run: npm run test:e2e
env:
NEXTCLOUD_E2E_LOG_FILE: test-results/nextcloud.log

- name: Upload results
if: ${{ !cancelled() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: playwright-report
path: |
playwright-report/
test-results/
retention-days: 7

summary:
permissions:
contents: none
runs-on: ubuntu-latest-low
needs: playwright

if: always()

name: playwright-summary

steps:
- name: Summary status
run: if ${{ needs.playwright.result != 'success' }}; then exit 1; fi
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@
/tests/.phpunit.cache

/node_modules/

/test-results/
/playwright-report/
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,23 @@ every component needs outside a running NC page
stub. `src/test-utils/fixtures.ts` has `makeNode()`/`makeCreator()` factories
for building test data. CI runs the suite on PRs via `test-unit.yml`.

End-to-end tests use Playwright and need Docker:

```bash
npx playwright install chromium
npm run build
npm run test:e2e
```

`playwright/start-nextcloud-server.mjs` starts a Nextcloud server (master)
with this app, Text and richdocuments, plus a Collabora CODE container on
port 9980. When both are already running they are reused, so
`npm run start:nextcloud` in a second terminal speeds up repeated runs.
`COLLABORA_PORT` changes the Collabora host port; `RICHDOCUMENTS_PATH` and
`TEXT_PATH` point at local checkouts (with built `js/` and `vendor/`) instead
of the app store release and Text main. Example files live in
`playwright/support/files/`. CI runs the suite via `playwright.yml`.

### 5. Committing changes

Commit **source only** (`src/`, `lib/`, …) — do **not** commit the built
Expand Down
Loading
Loading