Skip to content

fix(e2e): wait for the Notes API before running the Playwright tests - #2027

Merged
AndyScherzinger merged 1 commit into
mainfrom
fix/noid/e2e-wait-for-notes-api
Sep 10, 2026
Merged

fix(e2e): wait for the Notes API before running the Playwright tests#2027
AndyScherzinger merged 1 commit into
mainfrom
fix/noid/e2e-wait-for-notes-api

Conversation

@AndyScherzinger

@AndyScherzinger AndyScherzinger commented Sep 10, 2026

Copy link
Copy Markdown
Member

☑️ Summary

The Playwright job fails intermittently on pull requests that do not touch the tests, always the same way: the first tests in attachment-api.spec.ts receive Nextcloud's HTML 404 page when they create a note, and a retry a few seconds later succeeds. Recent examples are #1972 (run), #2024, #2023 and the fast-uri bump on 2026-09-02.

Root cause

@nextcloud/e2e-test-server prints Nextcloud is now ready to use immediately after occ app:enable notes, and the Playwright config waits for exactly that line before starting the suite. At that moment the Apache workers do not serve the app yet. OC\AppConfig keeps the app config, including which apps are enabled, in the local APCu cache for three seconds, and occ runs in a separate process that cannot invalidate it. A request landing in that window compiles a route collection without the notes routes, so it is answered with the generic 404 page.

Measured against the e2e container by disabling the app, priming a request and enabling it again:

run first 200 after enabling
1 1967 ms
2 508 ms
3 1970 ms

Whether a CI run fails depends only on where its first request lands in that cycle, which is why the failure moves between unrelated pull requests. The trace of the failing job confirms the response is the server's 404 page, not a Notes error.

Fix

The start script polls the Notes API after configuring Nextcloud and prints its own readiness line once the endpoint answers 200. The Playwright config waits for that line instead of the library's.

The url option is kept so reuseExistingServer keeps working for local runs. It is a sound gate on its own: on the container used here an unknown app route answers 404, which Playwright does not accept as ready, while a live one answers 401, which it does. It was never reached before because the stdout line won the race.

Testing

  • npx eslint passes on both changed files.
  • Full local Playwright run against Docker: 34 passed, and the tests only start after Notes API is ready is printed.
  • Opened as a draft to observe the Playwright job in CI.

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

The Playwright suite starts as soon as @nextcloud/e2e-test-server prints
"Nextcloud is now ready to use", right after `occ app:enable notes` has
run. The web workers do not see the app yet at that point: Nextcloud keeps
the app config and the compiled route collection in APCu for three seconds
and the occ process cannot invalidate that cache. Requests sent in that
window are answered with Nextcloud's 404 page, which made the attachment
API tests fail on unrelated pull requests such as #1972 and several
dependabot bumps.

Poll the Notes API in the start script and only report readiness once it
answers, and let the Playwright config wait for that line instead.

Assisted-by: Claude Code:claude-fable-5-1
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
@nextcloud-command nextcloud-command added the AI assisted This PR contains AI-assisted commits label Sep 10, 2026
@AndyScherzinger AndyScherzinger added this to the 6.1.0 milestone Sep 10, 2026
@codecov

codecov Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@AndyScherzinger
AndyScherzinger marked this pull request as ready for review September 10, 2026 10:08
@AndyScherzinger
AndyScherzinger merged commit d7056f7 into main Sep 10, 2026
36 checks passed
@AndyScherzinger
AndyScherzinger deleted the fix/noid/e2e-wait-for-notes-api branch September 10, 2026 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI assisted This PR contains AI-assisted commits technical debt tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants