Skip to content

Commit 4062365

Browse files
justin808claude
andcommitted
Wait for DOM selector to exist before interacting with it
The streaming test for 'React Router Sixth Page' was failing with: Unable to find css "#ServerComponentRouter-react-component-0" The issue was that 'within(dom_selector)' was being called before the selector actually existed in the DOM. For streaming renders, the element may not appear immediately even with increased wait time. Fix: Add explicit wait for the CSS selector to exist before trying to interact with it using within(). This ensures Capybara waits for the streamed content to fully render before attempting to find child elements. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 6ba7660 commit 4062365

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

react_on_rails_pro/spec/dummy/spec/system/integration_spec.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ def change_text_expect_dom_selector(dom_selector, expect_no_change: false)
99

1010
Capybara.using_wait_time(Capybara.default_max_wait_time * 3) do
1111
# Streaming renders can take a bit longer for the target node to appear
12+
# First ensure the selector exists before trying to interact with it
13+
expect(page).to have_css(dom_selector)
14+
1215
within(dom_selector) do
1316
find("input").set new_text
1417
within("h3") do

0 commit comments

Comments
 (0)