Skip to content

Commit bf4c317

Browse files
committed
fix(ci): show the server log when a Playwright test fails
The workflow step that shows the Nextcloud log on failure printed nothing when a test had failed. With CI set, playwright/start-server.mjs stops the test server when Playwright ends, and that removes the container before the step can read the log from it. @nextcloud/e2e-test-server saves the log first when NEXTCLOUD_E2E_LOG_FILE is set, so the workflow now sets it to test-results/nextcloud.log, and the step prints that file. The report upload already includes test-results/, so the log is uploaded too. Version 0.6.0 of the library read the log through the Docker copy API, which cannot see the tmpfs the data directory is on, so it saved nothing. The dependency moves to 0.6.1, which reads the log by running cat inside the container; the lockfile changes in that package only. If the server script fails during setup and leaves its container running, the step falls back to reading the log from that container, as it did before. Signed-off-by: Oleksander Piskun <oleksandr2088@icloud.com>
1 parent da54068 commit bf4c317

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

‎.github/workflows/playwright.yml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,16 @@ jobs:
9191
run: npx playwright test
9292
env:
9393
BRANCH: ${{ matrix.server-versions }}
94+
# stopNextcloud() saves the Nextcloud log here, if there is one, before it removes the container
95+
NEXTCLOUD_E2E_LOG_FILE: test-results/nextcloud.log
9496

9597
- name: Show Nextcloud log on failure
9698
if: failure()
97-
run: docker ps -q --filter name=nextcloud-e2e-test-server | xargs -r -I{} docker exec {} cat data/nextcloud.log || true
99+
# print the saved log, or else the log of a test server container that is still running
100+
run: |
101+
cat test-results/nextcloud.log 2>/dev/null \
102+
|| docker ps -q --filter name=nextcloud-e2e-test-server | xargs -r -I{} docker exec {} cat data/nextcloud.log \
103+
|| true
98104
99105
- name: Upload Playwright report
100106
if: failure()

‎package-lock.json‎

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"devDependencies": {
6565
"@nextcloud/babel-config": "^1.2.0",
6666
"@nextcloud/browserslist-config": "^3.0.1",
67-
"@nextcloud/e2e-test-server": "^0.6.0",
67+
"@nextcloud/e2e-test-server": "^0.6.1",
6868
"@nextcloud/eslint-config": "^9.0.1",
6969
"@nextcloud/stylelint-config": "^3.0.1",
7070
"@nextcloud/vite-config": "^2.5.2",

0 commit comments

Comments
 (0)