From 3c180028e84fa543c1d49d3a68ce533681bbb606 Mon Sep 17 00:00:00 2001 From: Oleksander Piskun Date: Tue, 10 Nov 2026 08:38:09 +0000 Subject: [PATCH] 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 --- .github/workflows/playwright.yml | 8 +++++++- package-lock.json | 8 ++++---- package.json | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 72d9f83..7bf1ac2 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -91,10 +91,16 @@ jobs: run: npx playwright test env: BRANCH: ${{ matrix.server-versions }} + # stopNextcloud() saves the Nextcloud log here, if there is one, before it removes the container + NEXTCLOUD_E2E_LOG_FILE: test-results/nextcloud.log - name: Show Nextcloud log on failure if: failure() - run: docker ps -q --filter name=nextcloud-e2e-test-server | xargs -r -I{} docker exec {} cat data/nextcloud.log || true + # print the saved log, or else the log of a test server container that is still running + run: | + cat test-results/nextcloud.log 2>/dev/null \ + || docker ps -q --filter name=nextcloud-e2e-test-server | xargs -r -I{} docker exec {} cat data/nextcloud.log \ + || true - name: Upload Playwright report if: failure() diff --git a/package-lock.json b/package-lock.json index 314eea3..37d9744 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,7 @@ "devDependencies": { "@nextcloud/babel-config": "^1.0.0", "@nextcloud/browserslist-config": "^3.0.0", - "@nextcloud/e2e-test-server": "^0.6.0", + "@nextcloud/e2e-test-server": "^0.6.1", "@nextcloud/eslint-config": "^9.0.1", "@nextcloud/stylelint-config": "^3.1.1", "@nextcloud/webpack-vue-config": "^7.0.2", @@ -2975,9 +2975,9 @@ } }, "node_modules/@nextcloud/e2e-test-server": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/@nextcloud/e2e-test-server/-/e2e-test-server-0.6.0.tgz", - "integrity": "sha512-C/ulfZTsM6JcwRubBqS0J2vQBy6jv40nRQ5aYCbZa3JMgGMJaGJEnzzUKiQHXLN0dCpUZZ5EjXVLZw0srwc95A==", + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/@nextcloud/e2e-test-server/-/e2e-test-server-0.6.1.tgz", + "integrity": "sha512-qUnOJBubZMF3eJ1PE8nqGKZ/qt1WF/erAGolHPBxZpP0X8pCFIjBaSxI63ct7N9GGruoBiqbONgHJZI9yRwuhw==", "dev": true, "license": "AGPL-3.0-or-later", "dependencies": { diff --git a/package.json b/package.json index 16b127f..edab391 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "devDependencies": { "@nextcloud/babel-config": "^1.0.0", "@nextcloud/browserslist-config": "^3.0.0", - "@nextcloud/e2e-test-server": "^0.6.0", + "@nextcloud/e2e-test-server": "^0.6.1", "@nextcloud/eslint-config": "^9.0.1", "@nextcloud/stylelint-config": "^3.1.1", "@nextcloud/webpack-vue-config": "^7.0.2",