From fcc71bcf38d3adf22f323571da914462762aa0cd Mon Sep 17 00:00:00 2001 From: Aaron Contreras Date: Tue, 28 Nov 2023 12:14:59 -0500 Subject: [PATCH] Treat the condition dropdowns just as action selections are treated Adding the action doesn't seem to be flaky as it's treated like an ng-select autocomplete. When inspecting the failing screenshots on the CI, it seems that the value on the project condition is not even set. This tells me that there's probably a timing issue with ng-select that a simple `fill_in :x, with: x` doesn't handle too well. However, I haven't seen a single failure on the prior step which uses the autocomplete logic for filling up the form field. I'm giving this a try to see if just treating it like another ng-select autocomplete stabilizes the spec. --- .../pages/admin/custom_actions/form.rb | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/spec/support/pages/admin/custom_actions/form.rb b/spec/support/pages/admin/custom_actions/form.rb index b31104c44b6a..9b5460af14f8 100644 --- a/spec/support/pages/admin/custom_actions/form.rb +++ b/spec/support/pages/admin/custom_actions/form.rb @@ -85,21 +85,11 @@ def set_action(name, value) end def set_condition(name, value) - page.within('#custom-actions-form--conditions') do - page.find_field(name) - end - Array(value).each do |val| - within '#custom-actions-form--conditions' do - fill_in name, with: val - end - - retry_block do - find('.ng-option', wait: 5, text: val).click + set_condition_value(name, val) - within '#custom-actions-form--conditions' do - expect_selected_option val - end + within '#custom-actions-form--conditions' do + expect_selected_option val end end end @@ -109,6 +99,16 @@ def set_condition(name, value) def set_action_value(name, value) field = find('#custom-actions-form--active-actions .form--field', text: name, wait: 5) + set_field_value(field, name, value) + end + + def set_condition_value(name, value) + field = find('#custom-actions-form--conditions .form--field', text: name, wait: 5) + + set_field_value(field, name, value) + end + + def set_field_value(field, name, value) autocomplete = false Array(value).each do |val|