Skip to content

Commit

Permalink
Treat the condition dropdowns just as action selections are treated
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aaron-contreras committed Nov 28, 2023
1 parent 839c40f commit fcc71bc
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions spec/support/pages/admin/custom_actions/form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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|
Expand Down

0 comments on commit fcc71bc

Please sign in to comment.