Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
026533a
chore: add @playwright/test dependency and e2e scripts
vitormattos Feb 26, 2026
7d03931
chore: add playwright configuration
vitormattos Feb 26, 2026
66e7d58
test(e2e): add Nextcloud login helper for Playwright
vitormattos Feb 26, 2026
28491ff
test(e2e): add OCS provisioning helpers for Playwright
vitormattos Feb 26, 2026
782edc4
test(e2e): add sign herself with click-to-sign spec
vitormattos Feb 26, 2026
68bdda8
ci: add Playwright E2E workflow
vitormattos Feb 26, 2026
f821152
chore: remove unecessary comment
vitormattos Feb 26, 2026
69ca4d0
fix: use matrix to identify server version
vitormattos Feb 26, 2026
d6a51f3
fix(ci): pass app path to nextcloud-version-matrix action
vitormattos Feb 26, 2026
03ba48c
fix(ci): use matrix server-versions branch for notifications and acti…
vitormattos Feb 26, 2026
9825c35
fix(ci): enable debug mode to allow --use-local-cert on libresign:ins…
vitormattos Feb 26, 2026
e1f0360
fix(e2e): add direct LibreSign API helper and safe JSON parsing
vitormattos Feb 26, 2026
4d0e1c7
fix(e2e): use ocsRequest for openssl endpoint via ocs/v2.php prefix
vitormattos Feb 26, 2026
56191a2
fix: run into GitHub Action
vitormattos Feb 26, 2026
6511ed6
ci(e2e): add debug logging to router.php to diagnose path issues
vitormattos Feb 26, 2026
1d5218a
test(e2e): debug: log URL being constructed before page.goto
vitormattos Feb 26, 2026
9330c6d
fix(e2e): set front_controller_active so Nextcloud generates clean URLs
vitormattos Feb 26, 2026
4d15de5
fix(e2e): set admin email so account autocomplete resolves admin@emai…
vitormattos Feb 26, 2026
40d6709
ci(e2e): split setup into nextcloud, app dependencies and libresign s…
vitormattos Feb 26, 2026
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
249 changes: 249 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,249 @@
# SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
# SPDX-License-Identifier: AGPL-3.0-or-later

name: Playwright Tests

on:
pull_request:
branches: [main]

permissions:
contents: read

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

jobs:
matrix:
runs-on: ubuntu-latest
outputs:
server-max: ${{ steps.versions.outputs.branches-max-list }}
steps:
- name: Checkout app
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

- name: Get version matrix
id: versions
uses: icewind1991/nextcloud-version-matrix@8a7bac6300b2f0f3100088b297995a229558ddba # v1.3.2.3.1.3.2

changes:
runs-on: ubuntu-latest

outputs:
src: ${{ steps.changes.outputs.src }}

steps:
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
continue-on-error: true
with:
filters: |
src:
- '.github/workflows/playwright.yml'
- 'appinfo/**'
- 'lib/**'
- 'src/**'
- 'templates/**'
- 'playwright/**'
- 'playwright.config.ts'
- 'package.json'
- 'package-lock.json'

playwright:
runs-on: ubuntu-latest
timeout-minutes: 60

needs: [matrix, changes]
if: needs.changes.outputs.src != 'false'

strategy:
matrix:
server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }}

name: Playwright E2E Tests

services:
mailpit:
image: axllent/mailpit
ports:
- 8025:8025/tcp
- 1025:1025/tcp

steps:
- name: Set app env
run: |
# Split and keep last
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV

- name: Install system dependencies
run: sudo apt update && sudo apt install poppler-utils

- name: Checkout server
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}

- name: Checkout app
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
submodules: true
path: apps/${{ env.APP_NAME }}

- name: Get php version
id: php_versions
uses: icewind1991/nextcloud-version-matrix@8a7bac6300b2f0f3100088b297995a229558ddba # v1.3.2.3.1.3.2
with:
filename: apps/${{ env.APP_NAME }}/appinfo/info.xml

- name: Set up php ${{ steps.php_versions.outputs.php-min }}
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2
with:
php-version: ${{ steps.php_versions.outputs.php-min }}
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, sqlite, pdo_sqlite, xmlreader, xmlwriter, zip, zlib
coverage: none
ini-file: development
ini-values: disable_functions=
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check composer file existence
id: check_composer
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
with:
files: apps/${{ env.APP_NAME }}/composer.json

- name: Set up composer dependencies
if: steps.check_composer.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
run: |
composer remove nextcloud/ocp --dev --no-scripts
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:
path: apps/${{ env.APP_NAME }}
fallbackNode: '^24'
fallbackNpm: '^11'

- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.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 node dependencies & build app
working-directory: apps/${{ env.APP_NAME }}
env:
CYPRESS_INSTALL_BINARY: 0
run: |
npm ci
TESTING=true npm run build --if-present

- name: Set up Nextcloud
run: |
sudo echo "127.0.0.1 mailpit" | sudo tee -a /etc/hosts
mkdir data
./occ maintenance:install \
--verbose \
--database=sqlite \
--admin-user admin \
--admin-pass admin
./occ --version

- name: Install app dependencies
run: |
git clone --depth 1 -b ${{ matrix.server-versions }} https://github.com/nextcloud/notifications apps/notifications
composer --working-dir=apps/notifications install --no-dev
./occ app:enable --force notifications
git clone --depth 1 -b ${{ matrix.server-versions }} https://github.com/nextcloud/activity apps/activity
composer --working-dir=apps/activity install --no-dev
./occ app:enable --force activity

- name: Set up LibreSign
run: |
./occ app:enable --force ${{ env.APP_NAME }}
./occ config:system:set allow_local_remote_servers --value true --type boolean
./occ config:system:set auth.bruteforce.protection.enabled --value false --type boolean
./occ config:system:set ratelimit.protection.enabled --value false --type boolean
./occ config:system:set mail_smtphost --value mailpit
./occ config:system:set mail_smtpport --value 1025 --type integer
./occ config:system:set overwrite.cli.url --value 'http://localhost:8080'
./occ config:system:set overwritehost --value 'localhost:8080'
./occ config:system:set debug --value true --type boolean
./occ libresign:install --use-local-cert --java
./occ libresign:install --use-local-cert --jsignpdf
./occ libresign:install --use-local-cert --pdftk
./occ libresign:configure:openssl \
--cn="Common Name" \
--c=BR \
--ou="Organization Unit" \
--st="Rio de Janeiro" \
--o=LibreSign \
--l="Rio de Janeiro"
./occ user:setting admin settings email [email protected]

- name: Start PHP built-in server
run: |
# front_controller_active tells Nextcloud to generate clean URLs (without index.php prefix)
# This mirrors what Apache mod_rewrite does via .htaccess RewriteRule
front_controller_active=true php -S localhost:8080 -t . apps/${{ env.APP_NAME }}/playwright/router.php &
# Wait for server to become available
timeout 30 bash -c 'until curl -s http://localhost:8080/status.php > /dev/null; do sleep 1; done'
echo "Nextcloud is ready at http://localhost:8080"

- name: Install Playwright browsers
working-directory: apps/${{ env.APP_NAME }}
run: npx playwright install chromium --with-deps

- name: Run Playwright tests
working-directory: apps/${{ env.APP_NAME }}
env:
PLAYWRIGHT_BASE_URL: http://localhost:8080
NEXTCLOUD_ADMIN_USER: admin
NEXTCLOUD_ADMIN_PASSWORD: admin
run: npx playwright test

- name: Upload Playwright report
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
if: always()
with:
name: playwright-report
path: apps/${{ env.APP_NAME }}/playwright-report/
retention-days: 30

- name: Upload test results
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
if: always()
with:
name: playwright-test-results
path: apps/${{ env.APP_NAME }}/test-results/
retention-days: 30

- name: Print Nextcloud logs
if: always()
run: cat data/nextcloud.log 2>/dev/null || echo "No Nextcloud logs found"

summary:
permissions:
contents: none
runs-on: ubuntu-latest
needs: [matrix, changes, playwright]

if: always()

name: playwright-summary

steps:
- name: Summary status
run: if ${{ needs.changes.outputs.src != 'false' && needs.playwright.result != 'success' }}; then exit 1; fi
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ node_modules/
/lib/Vendor/
/coverage
/dist/
/test-results/
64 changes: 64 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
"stylelint:fix": "stylelint src/**/*.scss src/**/*.vue --fix",
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage"
"test:coverage": "vitest run --coverage",
"test:e2e": "playwright test",
"test:e2e:ui": "playwright test --ui --ui-host=0.0.0.0 --ui-port=9323",
"test:e2e:report": "playwright show-report"
},
"dependencies": {
"@codemirror/autocomplete": "^6.18.3",
Expand Down Expand Up @@ -75,6 +78,7 @@
"npm": "^11.3.0"
},
"devDependencies": {
"@playwright/test": "^1.58.1",
"@nextcloud/browserslist-config": "^3.1.2",
"@nextcloud/eslint-config": "^8.4.2",
"@nextcloud/stylelint-config": "^3.2.1",
Expand Down
Loading
Loading