Fix flaky spec

spec is spec/features/projects/project_custom_fields/overview_page/dialog/inputs_spec.rb:702
run is https://github.com/opf/openproject/actions/runs/19700308113/job/56434713171?pr=21163

When opening the options of the dropdown, the field is clicked. If unlucky, it can click on the "X" of an option already selected and remove it. When this happens, it does not open the dropdown (this explains why the previous run was flaky).

The default implementation in both Cuprite and Selenium is to click in
the middle of the element. I don't understand why we can't reproduce it
though.

Fix is to click the arrow directly.
This commit is contained in:
Christophe Bliard
2025-11-26 12:25:33 +01:00
parent 1015dce948
commit bae42c8231
@@ -42,7 +42,10 @@ module FormFields
def open_options
wait_for_autocompleter_options_to_be_loaded
wait(timeout: 3).for do
field_container.find(".ng-select-container").click
# click the arrow to prevent clicking inside the input field and
# risking to remove some elements in a mult-select (clicking the "x")
# this may close the dropdown, but it will be clicked again if it's not open anyway.
field_container.find(".ng-select-container .ng-arrow-wrapper").click
page
end.to have_css(".ng-dropdown-panel-items", wait: 0.25)
end