fix: prevent race condition in environment-editor smoke test#9944
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Stabilizes the environment-editor-interactions Playwright smoke test by adding an extra synchronization point after JSON modal submission, reducing flakiness when the environment editor is closed before UI state has settled.
Changes:
- Adds a
{ delay: 200 }to the “Close” button click after submitting the JSON modal. - Adds an explicit
expect(...).toBeVisible()forkvstringbefore attempting to click it, improving failure clarity.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
✅ Circular References ReportGenerated at: 2026-05-26T05:45:51.651Z Summary
Click to view all circular references in PR (19)Click to view all circular references in base branch (19)Analysis✅ No Change: This PR does not introduce or remove any circular references. This report was generated automatically by comparing against the |
cwangsmv
approved these changes
May 25, 2026
After the JSON modal submit, the KV table state update is async. Add delay: 200 to the subsequent Close click (matching every other post-edit action in the test) so the debounce has time to settle before the dialog closes. Also add an explicit toBeVisible() assertion before clicking 'kvstring' in the console, which gives a clearer failure message if it recurs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…nt rule Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…variable test
Replace all `click({ delay: 200 })` workarounds with observable Playwright
waits: wait for new rows to be visible after Add Row, wait for the JSON
modal to be hidden after Modal Submit, and wait for the Manage Environments
heading to be hidden after Close. Clicking different cells to move focus
already triggers the OneLineEditor debounce without needing an artificial
delay.
Add a new test case that verifies a disabled KV pair falls back to the base
environment value in the sent request.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ce loss OneLineEditor now calls onChange immediately on blur so KV row values are not lost when focus moves away before the 100ms debounce fires. CodePromptModal now reads the current CodeEditor value and calls onChange explicitly when Submit is clicked, so the JSON value is always saved regardless of debounce state. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
e428668 to
7c1ea01
Compare
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
click({ delay: 200 })timing workarounds with deterministic Playwright waits:role="dialog" name="Modal"to be hiddenManage Environmentsheading to be hiddenThe original failure was
TimeoutError: waiting for getByText('kvstring')at line 127 (now line 130). The root cause wasclick({ delay: 200 })on the Close button after Modal Submit —delayadds time between mousedown and mouseup, not after the click, so it coincidentally works but is fragile. Waiting for the dialog to disappear is unambiguous and CI-safe.Test plan
npm run test:smoke:dev -- environment-editor-interactionspasses locally🤖 Generated with Claude Code