Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions spec/support/select_from_tom_select.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@ def select_from_tom_select(item_text, from:)
# global.
select = find("##{from}", visible: false)
wrapper = select.find(:xpath, '..')
expect(wrapper).to have_css('.ts-wrapper', wait: 15)
expect(wrapper).to have_css('.ts-control', wait: 15)

# Open the dropdown by clicking the control
wrapper.find('.ts-control').click
input = wrapper.find('.ts-control input')

# Focus the input explicitly; in headless CI the click above does not always
# move focus to the textbox before we dispatch the input event.
page.execute_script('arguments[0].focus();', input.native)

# Type first 3 characters to trigger search (shouldLoad requires >= 3).
# Use JS to set the value and dispatch an input event directly, instead of
# send_keys (which can race with TomSelect's debounce timer in headless CI
Expand Down