fix(e2e): wait for the Notes API before running the Playwright tests - #2027
Merged
Conversation
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>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
AndyScherzinger
marked this pull request as ready for review
September 10, 2026 10:08
AndyScherzinger
requested review from
enjeck and
silverkszlo
as code owners
September 10, 2026 10:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
☑️ 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.tsreceive 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 thefast-uribump on 2026-09-02.Root cause
@nextcloud/e2e-test-serverprintsNextcloud is now ready to useimmediately afterocc 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\AppConfigkeeps the app config, including which apps are enabled, in the local APCu cache for three seconds, andoccruns 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:
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
urloption is kept soreuseExistingServerkeeps 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 eslintpasses on both changed files.Notes API is readyis printed.🤖 AI (if applicable)