fix: resolve connection settings e2e test flakiness#13
Merged
simonCatBot merged 5 commits intomasterfrom Mar 31, 2026
Merged
Conversation
…ings e2e test The original test used page.waitForRequest() to capture the PUT /api/rocclaw request after clicking 'Save settings'. However, saveSettings() in useStudioGatewaySettings triggers a state update that causes React to replace the ConnectionPanel DOM subtree (token reset via applySettingsEnvelope clears the token input, which can cascade into a full panel re-render in concurrent mode). When this happens between Playwright's initial element check and the actual click, it throws 'element was detached from the DOM'. Using waitForResponse sidesteps this: the response listener is set up against the page's network context before the click fires, so it fires regardless of which DOM node the button lives on. We then extract the request body from response.request().body() to assert on the payload.
10c4689 to
8bde70b
Compare
added 4 commits
March 30, 2026 22:27
…ures Test changes: - Use Promise.all to race click() against waitForResponse(), ensuring the response wait is active before the click fires. This prevents races where React re-renders the button out from under Playwright. - Verify persisted settings via GET /api/rocclaw after the click instead of parsing the request body at interception time, which was unreliable because route handlers execute in series. - Add pre-click assertions to confirm input state before clicking. CI changes: - Remove continue-on-error: true from lint-typecheck job level. - Remove continue-on-error: true from the lint step and e2e job level, so failures in any CI job cause the overall run to fail.
The page.waitForResponse interception times out on CI even though the click succeeds — likely because the stub route ordering differs between local and CI environments. Instead, wait for the UI to transition to the post-save state (Test connection button visible), which is the most reliable signal that the save completed successfully, then verify the persisted settings via GET /api/rocclaw.
…ncurrent renders React concurrent rendering causes ConnectionPanel to be unstable (element modified during actionability checks). Using force:true bypasses the stability check while still dispatching the click event at the correct coordinates.
…stub page.request.get() bypasses page.route stubs, causing stubRocclawRoute to never see the GET and return stale stub state. Using page.evaluate to call fetch() inside the browser ensures the route handler intercepts it and returns the updated stub state after the PUT.
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
Fixes the flaky connection-settings e2e test and enables strict CI failures.
Test fix
Root cause: The original test used page.waitForRequest() to capture the PUT request. saveSettings() triggers React state updates that replace the ConnectionPanel DOM subtree while Playwright is mid-click, causing "element was detached from the DOM".
Fix:
CI fix
Test results