Skip to content

Commit d8db709

Browse files
committed
Fix GH Action test: close modal via Bootstrap API
- Manual button click simulation for closing the modal works locally but fails in GitHub Actions. Switching to Bootstrap's modal('hide') API call provides reliable modal closing behavior across all environments. - Strangely, `execute_script('arguments[0].click();', modal_close_button)` works for the 'Modal search opens and closes and allows user to search, select and remove items' test within this same file.
1 parent 527c347 commit d8db709

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

spec/features/modal_search_spec.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@
6161
fill_in 'research_output_search_term', with: @model.name
6262
click_button 'Apply filter(s)'
6363
click_link 'Select'
64-
modal_close_button = find('.modal-header button.btn-close')
65-
execute_script('arguments[0].click();', modal_close_button)
64+
# Bootstrap's modal API is necessary for modal to close when test is run as GitHub Action
65+
# (execute_script('arguments[0].click();', modal_close_button) somehow works for the other test within this file)
66+
execute_script("$('#modal-search-repositories').modal('hide')")
6667
end
6768

6869
click_button 'Save'

0 commit comments

Comments
 (0)