From 1dbcddf799d55d49d074fd0cf65d2c8f22b0c8d3 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Thu, 19 Feb 2026 13:39:26 +1100 Subject: [PATCH] Select found option after search to fix spec Selecting the tom select option in the dropdown often happened quicker than the search finished. In that case we selected the option from the list of all options and then the search would present the found option again and leave the dropdown open. This didn't cause any trouble in the past because any other action would close the dropdown again. But the new cuprite version didn't trigger the next click on the target element. It would just close the dropdown on the next click without further action. That would then break the next assertion looking for the next open dropdown, which didn't open with the click. Selecting the "active" option means that we wait for the search to finish and present an option as active. Clicking that option closes the dropdown without opening it again. --- spec/support/tom_select_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/support/tom_select_helper.rb b/spec/support/tom_select_helper.rb index ab653a4555..86b1e1fd9d 100644 --- a/spec/support/tom_select_helper.rb +++ b/spec/support/tom_select_helper.rb @@ -15,7 +15,7 @@ module TomSelectHelper tomselect_wrapper.find(".ts-control").click # Use send_keys as setting the value directly doesn't trigger the search tomselect_wrapper.find(:css, '.ts-dropdown input.dropdown-input').send_keys(value) - tomselect_wrapper.find(:css, '.ts-dropdown .ts-dropdown-content .option', text: value).click + tomselect_wrapper.find(:css, '.ts-dropdown .ts-dropdown-content .option.active', text: value).click end def tomselect_select(value, options)