Skip to content

Commit 2c885c6

Browse files
committed
Fix Chrome 134 breaking changes/Add expect checks
- These changes address the Chrome 134 breaking changes (#3485). - Added `expect` statements to ensure that page loads are completing successfully. - The `expect(page).to have_current_path(%r{#{org_admin_templates_path}/\d+})` statements help verify the page load. - It would be better to implement a notification such as "Customised template created successfully." and use that to verify the page load. - These changes should be revisited (and possibly reverted) when a fix is available for these breaking changes via Chrome, Capybara, or Selenium.
1 parent 6e3b17c commit 2c885c6

File tree

9 files changed

+24
-1
lines changed

9 files changed

+24
-1
lines changed

spec/features/annotations/annotations_editing_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
end
3838
expect do
3939
click_link 'Customise'
40+
# `org_admin_template_path(Template.last)` would be preferred over %r{#{org_admin_templates_path}/\d+}
41+
# However, the test is currently evaluating Template.count prior to the new Template being created
42+
expect(page).to have_current_path(%r{#{org_admin_templates_path}/\d+})
4043
end.to change { Template.count }.by(1)
4144

4245
# New Template created
@@ -67,6 +70,9 @@
6770
end
6871
expect do
6972
click_link 'Customise'
73+
# `org_admin_template_path(Template.last)` would be preferred over %r{#{org_admin_templates_path}/\d+}
74+
# However, the test is currently evaluating Template.count prior to the new Template being created
75+
expect(page).to have_current_path(%r{#{org_admin_templates_path}/\d+})
7076
end.to change { Template.count }.by(1)
7177
template = Template.last
7278
click_link 'Customise phase'

spec/features/feedback_requests_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
end
4141

4242
# Expectations
43+
expect(page).to have_content('Feedback has been requested.')
4344
expect(plan.reload).to be_feedback_requested
4445
expect(ActionMailer::Base.deliveries).to have_exactly(1).item
4546
end

spec/features/plans_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
click_button 'Create plan'
4646

4747
# Expectations
48+
expect(page).to have_content('Successfully created the plan.')
4849
expect(@user.plans).to be_one
4950
@plan = Plan.last
5051
expect(current_path).to eql(plan_path(@plan))

spec/features/registrations_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
click_button 'Create account'
2727

2828
# Expectations
29+
expect(page).to have_text('Welcome! You have signed up successfully.')
2930
expect(current_path).to eql(plans_path)
3031
expect(page).to have_text(user_attributes[:firstname])
3132
expect(page).to have_text(user_attributes[:surname])

spec/features/sessions_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
click_button 'Sign in'
1616

1717
# Expectation
18+
expect(page).to have_content('Signed in successfully.')
1819
expect(current_path).to eql(plans_path)
1920
expect(page).to have_text(user.firstname)
2021
expect(page).to have_text(user.surname)

spec/features/templates/templates_copying_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
end
3535

3636
# Expectations
37+
expect(page).to have_content('Template was successfully copied.')
3738
expect(Template.count).to eql(2)
3839
new_template = Template.last
3940
expect(new_template.title).to include(parent_template.title)

spec/features/templates/templates_editings_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,14 @@
2626

2727
scenario "Admin edits a Template's existing question", :js do
2828
click_link 'Customisable Templates'
29+
expect(page).to have_current_path(customisable_org_admin_templates_path)
2930
within("#template_#{template.id}") do
3031
click_button 'Actions'
3132
end
3233
click_link 'Customise'
34+
# `org_admin_template_path(Template.last)` would be preferred over %r{#{org_admin_templates_path}/\d+}
35+
# However, the test is currently evaluating Template.count prior to the new Template being created
36+
expect(page).to have_current_path(%r{#{org_admin_templates_path}/\d+})
3337
# New template created
3438
template = Template.last
3539
within("#phase_#{template.phase_ids.first}") do

spec/features/templates/templates_upgrade_customisations_spec.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@
3636
click_link('Customisable Templates')
3737

3838
click_button 'Actions'
39-
expect { click_link 'Customise' }.to change { Template.count }.by(1)
39+
expect do
40+
click_link 'Customise'
41+
# `org_admin_template_path(Template.last)` would be preferred over %r{#{org_admin_templates_path}/\d+}
42+
# However, the test is currently evaluating Template.count prior to the new Template being created
43+
expect(page).to have_current_path(%r{#{org_admin_templates_path}/\d+})
44+
end.to change { Template.count }.by(1)
4045

4146
customized_template = Template.last
4247

@@ -48,6 +53,7 @@
4853
# Publish our customisation
4954
click_button 'Actions'
5055
click_link 'Publish'
56+
expect(page).to have_text('Your customisation has been published')
5157
expect(customized_template.reload.published?).to eql(true)
5258

5359
# Move to the other funder Org's Templates
@@ -88,6 +94,7 @@
8894

8995
click_button 'Actions'
9096
click_link 'Publish changes'
97+
expect(page).to have_text('Your template has been published')
9198
expect(new_funder_template.reload.published?).to eql(true)
9299

93100
# Go back to the original Org...

spec/support/helpers/sessions_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ def sign_in_as_user(user)
2020
fill_in 'Password', with: user.password.presence || 'password'
2121
click_button 'Sign in'
2222
end
23+
expect(page).to have_content('Signed in successfully.')
2324
end
2425
end

0 commit comments

Comments
 (0)