Skip to content

Commit 6a49bd6

Browse files
authored
Merge pull request #3491 from DMPRoadmap/aaron/issues/downgrade-chrome
Lower PostgreSQL GitHub Action Chrome Version to Address Breaking Changes Between Latest Chrome Version (134) and `/features` Tests
2 parents a025258 + cd3f480 commit 6a49bd6

File tree

3 files changed

+53
-32
lines changed

3 files changed

+53
-32
lines changed

.github/workflows/postgres.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,18 @@ jobs:
7575
- name: 'Yarn Install'
7676
run: |
7777
yarn install
78+
79+
# TEMPORARY WORKAROUND FOR THE FOLLOWING ISSUE: https://github.com/DMPRoadmap/roadmap/issues/3485
80+
# Remove this once our tests are compatible with the new version of Chrome
81+
# Source: https://github.com/teamcapybara/capybara/issues/2800#issuecomment-2731100953
82+
- name: Remove image-bundled Chrome
83+
run: sudo apt-get purge google-chrome-stable
84+
- name: Setup stable Chrome
85+
uses: browser-actions/setup-chrome@v1
86+
with:
87+
chrome-version: 128
88+
install-chromedriver: true
89+
install-dependencies: true
7890

7991
# Initialize the DB
8092
- name: 'Setup Test DB'

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- Fixed bar chart click function in the Usage dashboard (GitHub issue #3443)
66
- Fixed broken link for the V1 API documentation.
77
- Fix `hidden_field_tag` Nested Attributes Format For Rails 7 Upgrade and Add Test Coverage [#3479](https://github.com/DMPRoadmap/roadmap/pull/3479)
8-
8+
- Lower PostgreSQL GitHub Action Chrome Version to Address Breaking Changes Between Latest Chrome Version (134) and `/features` Tests [#3491](https://github.com/DMPRoadmap/roadmap/pull/3491)
99

1010
**Note this upgrade is mainly a migration from Bootstrap 3 to Bootstrap 5.**
1111

spec/features/modal_search_spec.rb

Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,7 @@
2323
end
2424

2525
it 'Modal search opens and closes and allows user to search, select and remove items', :js do
26-
# Open the modal
27-
click_button 'Add a repository'
28-
expect(page).to have_text('Repository search')
29-
30-
within('#modal-search-repositories') do
31-
# Search for the Repository
32-
fill_in 'research_output_search_term', with: @model.name
33-
click_button 'Apply filter(s)'
34-
expect(page).to have_text(@model.description)
35-
# Select the repository and make sure it no longer appears in the search results
36-
click_link 'Select'
37-
expect(page).not_to have_text(@model.description)
38-
39-
# Using JS to click on button, as click_button '.modal-header button.btn-close' did not work.
40-
modal_close_button = find('.modal-header button.btn-close')
41-
# Close the modal
42-
execute_script('arguments[0].click();', modal_close_button)
43-
end
44-
45-
# Verify that the selection was added to the main page's dom
46-
expect(page).not_to have_text('Repository search')
47-
expect(page).to have_text(@model.description)
26+
perform_modal_actions
4827
# Verify that we can remove the selection
4928
click_link 'Remove'
5029
expect(page).not_to have_text(@model.description)
@@ -55,15 +34,7 @@
5534
fill_in 'Title', with: 'Test Output'
5635
select 'Audiovisual', from: 'research_output_output_type'
5736

58-
# Open the modal and select repository
59-
click_button 'Add a repository'
60-
within('#modal-search-repositories') do
61-
fill_in 'research_output_search_term', with: @model.name
62-
click_button 'Apply filter(s)'
63-
click_link 'Select'
64-
# (execute_script('arguments[0].click();', modal_close_button) works locally here, but not as GitHub Action)
65-
find('[data-bs-dismiss="modal"]').click
66-
end
37+
perform_modal_actions
6738

6839
click_button 'Save'
6940

@@ -80,4 +51,42 @@
8051
expect(research_output.repositories).to include(@model)
8152
expect(research_output.plan).to eq(@plan)
8253
end
54+
55+
private
56+
57+
# handles opening + closing of the modal, as well as the actions performed within the modal
58+
def perform_modal_actions
59+
open_modal
60+
61+
within('#modal-search-repositories') do
62+
search_and_select_repository_within_modal
63+
close_modal
64+
end
65+
# Verify that the selection was added to the main page's dom
66+
expect(page).not_to have_text('Repository search')
67+
expect(page).to have_text(@model.description)
68+
end
69+
70+
def open_modal
71+
# Open the modal
72+
click_button 'Add a repository'
73+
expect(page).to have_text('Repository search')
74+
end
75+
76+
def search_and_select_repository_within_modal
77+
# Search for the Repository
78+
fill_in 'research_output_search_term', with: @model.name
79+
click_button 'Apply filter(s)'
80+
expect(page).to have_text(@model.description)
81+
# Select the repository and make sure it no longer appears in the search results
82+
click_link 'Select'
83+
expect(page).not_to have_text(@model.description)
84+
end
85+
86+
def close_modal
87+
# Using JS to click on button, as click_button '.modal-header button.btn-close' did not work.
88+
modal_close_button = find('.modal-header button.btn-close')
89+
# Close the modal
90+
execute_script('arguments[0].click();', modal_close_button)
91+
end
8392
end

0 commit comments

Comments
 (0)