diff --git a/Gemfile.lock b/Gemfile.lock index 97fef6ed7b..b5cfaf6fd3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -623,16 +623,16 @@ GEM unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.30.0) parser (>= 3.2.1.0) - rubocop-capybara (2.19.0) + rubocop-capybara (2.20.0) rubocop (~> 1.41) - rubocop-factory_bot (2.24.0) + rubocop-factory_bot (2.25.0) rubocop (~> 1.33) rubocop-rails (2.23.1) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) rubocop-ast (>= 1.30.0, < 2.0) - rubocop-rspec (2.25.0) + rubocop-rspec (2.26.0) rubocop (~> 1.40) rubocop-capybara (~> 2.17) rubocop-factory_bot (~> 2.22) diff --git a/config/rubocop/factory_bot.yml b/config/rubocop/factory_bot.yml index 8846abf742..9d7ec47226 100644 --- a/config/rubocop/factory_bot.yml +++ b/config/rubocop/factory_bot.yml @@ -4,6 +4,8 @@ FactoryBot/CreateList: Enabled: false FactoryBot/AssociationStyle: Enabled: false +FactoryBot/ExcessiveCreateList: + Enabled: false FactoryBot/FactoryAssociationWithStrategy: Exclude: - 'spec/factories/access_requests.rb' diff --git a/docs/spec/govuk_tech_docs/open_api/renderer_spec.rb b/docs/spec/govuk_tech_docs/open_api/renderer_spec.rb index 32a9e26cc4..3c6d8b229f 100644 --- a/docs/spec/govuk_tech_docs/open_api/renderer_spec.rb +++ b/docs/spec/govuk_tech_docs/open_api/renderer_spec.rb @@ -73,8 +73,8 @@ rendered = render.api_full rendered = Capybara::Node::Simple.new(rendered) - expect(rendered).not_to have_css('h2#servers') - expect(rendered).not_to have_css('div#server-list') + expect(rendered).to have_no_css('h2#servers') + expect(rendered).to have_no_css('div#server-list') end it 'renders a server with no description' do @@ -89,7 +89,7 @@ rendered = Capybara::Node::Simple.new(rendered) expect(rendered).to have_css('h2#servers') expect(rendered).to have_css('div#server-list>a', text: 'https://example.com') - expect(rendered).not_to have_css('div#server-list>p') + expect(rendered).to have_no_css('div#server-list>p') end it 'renders a list of servers' do diff --git a/spec/components/add_course_button_spec.rb b/spec/components/add_course_button_spec.rb index 2520dfce72..504977b9f8 100644 --- a/spec/components/add_course_button_spec.rb +++ b/spec/components/add_course_button_spec.rb @@ -38,7 +38,7 @@ let(:provider) { build(:provider, study_sites: [build(:site, :study_site)], recruitment_cycle:) } it 'renders a study sites link' do - expect(rendered_content).not_to have_link( + expect(rendered_content).to have_no_link( 'add a study site', href: publish_provider_recruitment_cycle_study_sites_path( provider.provider_code, @@ -72,7 +72,7 @@ let(:provider) { build(:provider, :accredited_provider, recruitment_cycle:) } it 'renders an accredited provider link' do - expect(rendered_content).not_to have_link( + expect(rendered_content).to have_no_link( 'add an accredited provider', href: publish_provider_recruitment_cycle_accredited_providers_path( provider.provider_code, @@ -106,7 +106,7 @@ end it 'renders a schools link' do - expect(rendered_content).not_to have_link( + expect(rendered_content).to have_no_link( 'add a school', href: publish_provider_recruitment_cycle_schools_path( provider.provider_code, @@ -120,7 +120,7 @@ let(:provider) { build(:provider, study_sites: [build(:site, :study_site)], sites: [build(:site)], recruitment_cycle:) } it 'renders a study sites link' do - expect(rendered_content).not_to have_link( + expect(rendered_content).to have_no_link( 'add a study site', href: publish_provider_recruitment_cycle_study_sites_path( provider.provider_code, @@ -140,7 +140,7 @@ end it 'renders a schools link' do - expect(rendered_content).not_to have_link( + expect(rendered_content).to have_no_link( 'add a school', href: publish_provider_recruitment_cycle_schools_path( provider.provider_code, @@ -154,7 +154,7 @@ let(:provider) { build(:provider, :accredited_provider, study_sites: [build(:site, :study_site)], sites: [build(:site)], recruitment_cycle:) } it 'renders a study sites link' do - expect(rendered_content).not_to have_link( + expect(rendered_content).to have_no_link( 'add a study site', href: publish_provider_recruitment_cycle_study_sites_path( provider.provider_code, @@ -164,7 +164,7 @@ end it 'renders an accredited provider link' do - expect(rendered_content).not_to have_link( + expect(rendered_content).to have_no_link( 'add an accredited provider', href: publish_provider_recruitment_cycle_accredited_providers_path( provider.provider_code, @@ -174,7 +174,7 @@ end it 'renders a schools link' do - expect(rendered_content).not_to have_link( + expect(rendered_content).to have_no_link( 'add a school', href: publish_provider_recruitment_cycle_schools_path( provider.provider_code, diff --git a/spec/components/find/courses/international_students_component/view_spec.rb b/spec/components/find/courses/international_students_component/view_spec.rb index 3d5c6240fa..bdccf07e6f 100644 --- a/spec/components/find/courses/international_students_component/view_spec.rb +++ b/spec/components/find/courses/international_students_component/view_spec.rb @@ -41,11 +41,11 @@ end it 'does not tell candidates the 3-year residency rule' do - expect(page).not_to have_text('To apply for this teaching apprenticeship course, you’ll need to have lived in the UK for at least 3 years before the start of the course') + expect(page).to have_no_text('To apply for this teaching apprenticeship course, you’ll need to have lived in the UK for at least 3 years before the start of the course') end it 'does not tell candidates about settled and pre-settled status' do - expect(page).not_to have_text('EEA nationals with settled or pre-settled status under the') + expect(page).to have_no_text('EEA nationals with settled or pre-settled status under the') end end @@ -87,11 +87,11 @@ end it 'does not tell candidates the 3-year residency rule' do - expect(page).not_to have_text('To apply for this teaching apprenticeship course, you’ll need to have lived in the UK for at least 3 years before the start of the course') + expect(page).to have_no_text('To apply for this teaching apprenticeship course, you’ll need to have lived in the UK for at least 3 years before the start of the course') end it 'does not tell candidates about settled and pre-settled status' do - expect(page).not_to have_text('EEA nationals with settled or pre-settled status under the') + expect(page).to have_no_text('EEA nationals with settled or pre-settled status under the') end end diff --git a/spec/components/find/phase_banner/view_spec.rb b/spec/components/find/phase_banner/view_spec.rb index d8f13264fd..8817c5d4b3 100644 --- a/spec/components/find/phase_banner/view_spec.rb +++ b/spec/components/find/phase_banner/view_spec.rb @@ -17,14 +17,14 @@ module PhaseBanner allow(Settings.environment).to receive(:name).and_return(environment) render_inline(described_class.new) - expect(page).to have_selector(".govuk-phase-banner .govuk-tag--#{colour}") + expect(page).to have_css(".govuk-phase-banner .govuk-tag--#{colour}") end end context "when no value is passed in to 'no_border'" do it 'renders a border' do render_inline(described_class.new) - expect(page).not_to have_css('.app-phase-banner--no-border') + expect(page).to have_no_css('.app-phase-banner--no-border') end end diff --git a/spec/components/gcse_row_content_spec.rb b/spec/components/gcse_row_content_spec.rb index f04f25113a..d35283bec5 100644 --- a/spec/components/gcse_row_content_spec.rb +++ b/spec/components/gcse_row_content_spec.rb @@ -102,8 +102,8 @@ render_inline(described_class.new(course: course.decorate)) - expect(page).not_to have_content('Grade 4 (C) or above in English and maths, or equivalent qualification') - expect(page).not_to have_content('Grade 4 (C) or above in English, maths and science, or equivalent qualification') + expect(page).to have_no_content('Grade 4 (C) or above in English and maths, or equivalent qualification') + expect(page).to have_no_content('Grade 4 (C) or above in English, maths and science, or equivalent qualification') end end diff --git a/spec/components/header_spec.rb b/spec/components/header_spec.rb index e1f06bb2c6..5bc8980854 100644 --- a/spec/components/header_spec.rb +++ b/spec/components/header_spec.rb @@ -19,7 +19,7 @@ it "doesn't contain a sign out link if no current user" do render_inline(described_class.new(service_name: 'test')) - expect(component).not_to have_text('Sign out') + expect(component).to have_no_text('Sign out') end context 'for an admin user' do diff --git a/spec/components/notification_banner_spec.rb b/spec/components/notification_banner_spec.rb index b88ee16e0d..3d0e1fbbc7 100644 --- a/spec/components/notification_banner_spec.rb +++ b/spec/components/notification_banner_spec.rb @@ -13,7 +13,7 @@ end it "doesn't add the success class" do - expect(component).not_to have_css('.govuk-notification-banner--success') + expect(component).to have_no_css('.govuk-notification-banner--success') end it "has a default title of 'Important'" do diff --git a/spec/components/phase_banner_spec.rb b/spec/components/phase_banner_spec.rb index c9e8002c2b..2996c356cd 100644 --- a/spec/components/phase_banner_spec.rb +++ b/spec/components/phase_banner_spec.rb @@ -16,7 +16,7 @@ allow(Settings.environment).to receive(:name).and_return(environment) render_inline(described_class.new) - expect(page).to have_selector(".govuk-phase-banner .govuk-tag--#{colour}") + expect(page).to have_css(".govuk-phase-banner .govuk-tag--#{colour}") end end @@ -35,7 +35,7 @@ context "when no value is passed in to 'no_border'" do it 'renders a border' do render_inline(described_class.new) - expect(page).not_to have_css('.app-phase-banner--no-border') + expect(page).to have_no_css('.app-phase-banner--no-border') end end diff --git a/spec/components/search_result_title_component_spec.rb b/spec/components/search_result_title_component_spec.rb index 5a38a38ddf..e12134fe0e 100644 --- a/spec/components/search_result_title_component_spec.rb +++ b/spec/components/search_result_title_component_spec.rb @@ -36,7 +36,7 @@ expect(page).to have_text("No results found for ‘#{query}’") expect(page).to have_link('Change your search', href: '/test') - expect(page).not_to have_text("if the #{search_resource} you’re looking for is not listed.") + expect(page).to have_no_text("if the #{search_resource} you’re looking for is not listed.") end def render_component(results_count) diff --git a/spec/components/support_title_bar_spec.rb b/spec/components/support_title_bar_spec.rb index c3a7c08eed..f200d78a4a 100644 --- a/spec/components/support_title_bar_spec.rb +++ b/spec/components/support_title_bar_spec.rb @@ -11,7 +11,7 @@ end it 'does not render the provided title' do - expect(component).not_to have_text("Recruitment cycle #{Settings.current_recruitment_cycle_year}") + expect(component).to have_no_text("Recruitment cycle #{Settings.current_recruitment_cycle_year}") end it 'does not render the recruitment cycle link' do diff --git a/spec/components/title_bar_spec.rb b/spec/components/title_bar_spec.rb index e83738e8e0..bf1bbce291 100644 --- a/spec/components/title_bar_spec.rb +++ b/spec/components/title_bar_spec.rb @@ -14,7 +14,7 @@ end it 'does not render the provided title' do - expect(component).not_to have_text('BAT School') + expect(component).to have_no_text('BAT School') end it 'does not render the recruitment cycle link' do diff --git a/spec/features/auth/persona_spec.rb b/spec/features/auth/persona_spec.rb index 4ced9e5012..591c03acdb 100644 --- a/spec/features/auth/persona_spec.rb +++ b/spec/features/auth/persona_spec.rb @@ -40,7 +40,7 @@ def i_am_given_the_option_to_login_as_an_admin end def and_i_do_not_see_persona_related_text - expect(auth_sign_in_page).not_to have_text('Use Personas to access an account.') - expect(auth_sign_in_page).not_to have_link('Sign in using a Persona') + expect(auth_sign_in_page).to have_no_text('Use Personas to access an account.') + expect(auth_sign_in_page).to have_no_link('Sign in using a Persona') end end diff --git a/spec/features/auth/provider_user_signs_in_spec.rb b/spec/features/auth/provider_user_signs_in_spec.rb index 64b8cb19fc..9711a1e328 100644 --- a/spec/features/auth/provider_user_signs_in_spec.rb +++ b/spec/features/auth/provider_user_signs_in_spec.rb @@ -26,7 +26,7 @@ def then_i_am_expected_to_sign_in end def when_i_sign_in - click_button 'Sign in using DfE Sign-in' + click_link_or_button 'Sign in using DfE Sign-in' end def then_i_can_access_the_publish diff --git a/spec/features/auth/support_user_signs_in_spec.rb b/spec/features/auth/support_user_signs_in_spec.rb index 0efe9506af..eac3f304e8 100644 --- a/spec/features/auth/support_user_signs_in_spec.rb +++ b/spec/features/auth/support_user_signs_in_spec.rb @@ -25,7 +25,7 @@ def then_i_am_expected_to_sign_in end def when_i_sign_in - click_button 'Sign in using DfE Sign-in' + click_link_or_button 'Sign in using DfE Sign-in' end def then_i_can_access_the_support_interface diff --git a/spec/features/find/feature_flags_spec.rb b/spec/features/find/feature_flags_spec.rb index 181bf2be7e..e87f46dc39 100644 --- a/spec/features/find/feature_flags_spec.rb +++ b/spec/features/find/feature_flags_spec.rb @@ -57,11 +57,11 @@ def then_i_should_see_the_existing_feature_flags end def when_i_activate_the_feature - within(feature_card) { click_link 'Confirm environment to make changes' } + within(feature_card) { click_link_or_button 'Confirm environment to make changes' } fill_in 'Type ‘test’ to confirm that you want to proceed', with: 'test' - click_button 'Continue' + click_link_or_button 'Continue' - within(feature_card) { click_button 'Activate' } + within(feature_card) { click_link_or_button 'Activate' } end def then_the_feature_is_activated @@ -72,7 +72,7 @@ def then_the_feature_is_activated end def when_i_deactivate_the_feature - within(feature_card) { click_button 'Deactivate' } + within(feature_card) { click_link_or_button 'Deactivate' } end def then_the_feature_is_deactivated diff --git a/spec/features/find/maintainance_page_spec.rb b/spec/features/find/maintainance_page_spec.rb index 75bb1513e3..23994175b6 100644 --- a/spec/features/find/maintainance_page_spec.rb +++ b/spec/features/find/maintainance_page_spec.rb @@ -15,7 +15,7 @@ visit find_path expect(page).to have_current_path find_maintenance_path - expect(page).not_to have_content 'This service will be unavailable on' + expect(page).to have_no_content 'This service will be unavailable on' end end diff --git a/spec/features/find/maintenance_banner_spec.rb b/spec/features/find/maintenance_banner_spec.rb index 09ec0ff293..fa4c24fadf 100644 --- a/spec/features/find/maintenance_banner_spec.rb +++ b/spec/features/find/maintenance_banner_spec.rb @@ -19,7 +19,7 @@ visit find_path - expect(page).not_to have_content 'This service will be unavailable on' + expect(page).to have_no_content 'This service will be unavailable on' end end end diff --git a/spec/features/find/result_page_filters/engineers_teach_physics_spec.rb b/spec/features/find/result_page_filters/engineers_teach_physics_spec.rb index 19e69f3b2d..3df643a32e 100644 --- a/spec/features/find/result_page_filters/engineers_teach_physics_spec.rb +++ b/spec/features/find/result_page_filters/engineers_teach_physics_spec.rb @@ -50,7 +50,7 @@ def given_i_choose_music def and_i_provide_my_visa_status choose 'Yes' - click_button 'Find courses' + click_link_or_button 'Find courses' end def then_i_see_that_the_etp_checkbox_is_unchecked @@ -60,6 +60,6 @@ def then_i_see_that_the_etp_checkbox_is_unchecked end def then_i_dont_see_the_etp_checkbox - expect(find_results_page).not_to have_text('Only show Engineers teach physics courses') + expect(find_results_page).to have_no_text('Only show Engineers teach physics courses') end end diff --git a/spec/features/find/search/across_england/further_education_spec.rb b/spec/features/find/search/across_england/further_education_spec.rb index a008658fae..74420c2e6f 100644 --- a/spec/features/find/search/across_england/further_education_spec.rb +++ b/spec/features/find/search/across_england/further_education_spec.rb @@ -41,7 +41,7 @@ def and_i_select_the_across_england_radio_button end def and_i_click_continue - click_button 'Continue' + click_link_or_button 'Continue' end def then_i_should_see_the_age_groups_form @@ -68,7 +68,7 @@ def when_i_select_my_visa_status end def and_i_click_find_courses - click_button 'Find courses' + click_link_or_button 'Find courses' end def then_i_should_see_the_find_results_page diff --git a/spec/features/find/search/across_england/primary_spec.rb b/spec/features/find/search/across_england/primary_spec.rb index 8feefc4a33..5cef007877 100644 --- a/spec/features/find/search/across_england/primary_spec.rb +++ b/spec/features/find/search/across_england/primary_spec.rb @@ -73,11 +73,11 @@ def and_i_select_the_across_england_radio_button end def and_i_click_continue - click_button 'Continue' + click_link_or_button 'Continue' end def when_i_click_back - click_link 'Back' + click_link_or_button 'Back' end def when_i_click_continue @@ -127,7 +127,7 @@ def then_i_should_see_the_subjects_form end def and_i_click_find_courses - click_button 'Find courses' + click_link_or_button 'Find courses' end alias_method :when_i_click_find_courses, :and_i_click_find_courses diff --git a/spec/features/find/search/across_england/secondary_spec.rb b/spec/features/find/search/across_england/secondary_spec.rb index 120769a182..57db37c186 100644 --- a/spec/features/find/search/across_england/secondary_spec.rb +++ b/spec/features/find/search/across_england/secondary_spec.rb @@ -69,7 +69,7 @@ private def and_i_see_that_the_visa_checkbox_is_not_checked - expect(page).not_to have_checked_field('Only show courses with visa sponsorship') + expect(page).to have_no_checked_field('Only show courses with visa sponsorship') end def given_the_bursaries_and_scholarships_feature_flag_is_deactivated @@ -85,7 +85,7 @@ def then_i_should_see_the_financial_support_banner end def then_i_should_not_see_the_financial_support_banner - expect(page).not_to have_css('.govuk-notification-banner__heading', text: 'Financial support') + expect(page).to have_no_css('.govuk-notification-banner__heading', text: 'Financial support') end def when_i_visit_the_secondary_subjects_page @@ -107,12 +107,12 @@ def and_i_select_the_across_england_radio_button end def and_i_click_continue - click_button 'Continue' + click_link_or_button 'Continue' end alias_method :when_i_click_continue, :and_i_click_continue def when_i_click_back - click_link 'Back' + click_link_or_button 'Back' end def and_age_group_radio_selected @@ -146,7 +146,7 @@ def then_i_should_see_the_subjects_form end def and_i_click_find_courses - click_button 'Find courses' + click_link_or_button 'Find courses' end alias_method :when_i_click_find_courses, :and_i_click_find_courses diff --git a/spec/features/find/search/editing_a_search_spec.rb b/spec/features/find/search/editing_a_search_spec.rb index eb4c62190b..898766fe8b 100644 --- a/spec/features/find/search/editing_a_search_spec.rb +++ b/spec/features/find/search/editing_a_search_spec.rb @@ -82,7 +82,7 @@ def then_i_should_see_the_find_results_page end def when_i_change_my_search_query - click_link 'Change' + click_link_or_button 'Change' end def then_i_should_see_the_start_page diff --git a/spec/features/find/search/location_options_spec.rb b/spec/features/find/search/location_options_spec.rb index a05049a8a7..3afe3abcc0 100644 --- a/spec/features/find/search/location_options_spec.rb +++ b/spec/features/find/search/location_options_spec.rb @@ -71,7 +71,7 @@ def then_i_should_see_the_start_page end def when_i_click_back - click_link 'Back' + click_link_or_button 'Back' end def and_the_location_radio_button_is_selected @@ -82,12 +82,12 @@ def when_i_enter_an_invalid_location_with_some_options find_courses_by_location_or_training_provider_page.location.set('invalid location') find_courses_by_location_or_training_provider_page.continue.click choose 'Further education' - click_button 'Continue' + click_link_or_button 'Continue' end def and_i_provide_my_visa_status choose 'Yes' - click_button 'Find courses' + click_link_or_button 'Find courses' end def then_should_see_the_no_results_text diff --git a/spec/features/find/search/provider_options_spec.rb b/spec/features/find/search/provider_options_spec.rb index d97e6d0fe0..4f07f9dd86 100644 --- a/spec/features/find/search/provider_options_spec.rb +++ b/spec/features/find/search/provider_options_spec.rb @@ -70,7 +70,7 @@ def then_i_should_see_the_start_page end def when_i_click_back - click_link 'Back' + click_link_or_button 'Back' end def and_the_provider_radio_button_is_selected diff --git a/spec/features/find/search/viewing_a_course_spec.rb b/spec/features/find/search/viewing_a_course_spec.rb index 3f67a5a811..b20615c75f 100644 --- a/spec/features/find/search/viewing_a_course_spec.rb +++ b/spec/features/find/search/viewing_a_course_spec.rb @@ -226,7 +226,7 @@ def then_i_should_see_the_course_information expect(find_course_show_page.financial_support_details).to have_content('Financial support from the training provider') - expect(find_course_show_page.required_qualifications).not_to have_content( + expect(find_course_show_page.required_qualifications).to have_no_content( @course.latest_published_enrichment.required_qualifications ) @@ -291,7 +291,7 @@ def then_i_should_see_the_course_information [@provider.address1, @provider.address2, @provider.address3, @provider.town, @provider.address4, @provider.postcode].compact.join(' ') ) - expect(find_course_show_page.school_placements).not_to have_content('Suspended site with vacancies') + expect(find_course_show_page.school_placements).to have_no_content('Suspended site with vacancies') @course.site_statuses.new_or_running.map(&:site).uniq.each do |site| expect(find_course_show_page).to have_content(smart_quotes(site.decorate.full_address)) @@ -303,7 +303,7 @@ def then_i_should_see_the_course_information expect(find_course_show_page.apply_link[:href]).to eq("/course/#{provider.provider_code}/#{@course.course_code}/apply") - expect(find_course_show_page).not_to have_content('When you apply you’ll need these codes for the Choices section of your application form') + expect(find_course_show_page).to have_no_content('When you apply you’ll need these codes for the Choices section of your application form') expect(find_course_show_page).not_to have_end_of_cycle_notice diff --git a/spec/features/find/sorted_by_filter_spec.rb b/spec/features/find/sorted_by_filter_spec.rb index 58dc60e3db..24f40bdec1 100644 --- a/spec/features/find/sorted_by_filter_spec.rb +++ b/spec/features/find/sorted_by_filter_spec.rb @@ -85,6 +85,6 @@ def given_that_i_select_the_option(selected_option) end def when_i_click_sort - click_button 'Sort' + click_link_or_button 'Sort' end end diff --git a/spec/features/find/switcher_cycles_spec.rb b/spec/features/find/switcher_cycles_spec.rb index 7f3b182689..db79564460 100644 --- a/spec/features/find/switcher_cycles_spec.rb +++ b/spec/features/find/switcher_cycles_spec.rb @@ -74,7 +74,7 @@ def and_i_choose(option) end def then_i_click_on_update_button - page.click_button('Update point in recruitment cycle') + page.click_link_or_button('Update point in recruitment cycle') end def and_i_should_see_the_success_banner diff --git a/spec/features/publish/accredited_provider_spec.rb b/spec/features/publish/accredited_provider_spec.rb index 902590ffef..4dc5b09d2e 100644 --- a/spec/features/publish/accredited_provider_spec.rb +++ b/spec/features/publish/accredited_provider_spec.rb @@ -89,7 +89,7 @@ private def and_i_click_remove_ap - click_button 'Remove accredited provider' + click_link_or_button 'Remove accredited provider' end def then_i_should_see_the_cannot_remove_ap_text @@ -97,7 +97,7 @@ def then_i_should_see_the_cannot_remove_ap_text end def and_i_click_remove - click_link 'Remove' + click_link_or_button 'Remove' end def and_i_create_a_new_accredited_provider @@ -110,7 +110,7 @@ def and_i_create_a_new_accredited_provider end def and_i_click_change - click_link('Change') + click_link_or_button('Change') end def and_i_should_see_the_accredited_providers @@ -133,7 +133,7 @@ def then_i_should_be_taken_back_to_the_confirm_page end def when_i_click_the_back_link - click_link 'Back' + click_link_or_button 'Back' end def then_i_should_be_taken_to_the_accredited_provider_search_page @@ -144,7 +144,7 @@ def then_i_should_be_taken_to_the_accredited_provider_search_page def when_i_click_the_change_link_for(field) within '.govuk-summary-list' do - click_link "Change #{field}" + click_link_or_button "Change #{field}" end end @@ -174,7 +174,7 @@ def then_i_should_be_taken_to_the_index_page def when_i_confirm_the_changes expect do - click_button 'Add accredited provider' + click_link_or_button 'Add accredited provider' end.to have_enqueued_email(Users::OrganisationMailer, :added_as_an_organisation_to_training_partner) end @@ -195,7 +195,7 @@ def when_i_input_some_information def when_i_input_some_different_information fill_in 'About the accredited provider', with: 'updates to the AP description' - click_button 'Update description' + click_link_or_button 'Update description' end def and_i_search_with_an_invalid_query @@ -210,8 +210,8 @@ def when_i_select_the_provider def then_i_should_still_see_the_provider_i_searched_for expect(page).to have_content(@accredited_provider.provider_name) - expect(page).not_to have_content(@accredited_provider_two.provider_name) - expect(page).not_to have_content(@accredited_provider_three.provider_name) + expect(page).to have_no_content(@accredited_provider_two.provider_name) + expect(page).to have_no_content(@accredited_provider_three.provider_name) end def and_i_should_see_an_error_message(error_message = form_title) @@ -226,8 +226,8 @@ def when_i_continue_without_selecting_an_accredited_provider def then_i_see_the_provider_i_searched_for expect(page).to have_content(@accredited_provider.provider_name) - expect(page).not_to have_content(@accredited_provider_two.provider_name) - expect(page).not_to have_content(@accredited_provider_three.provider_name) + expect(page).to have_no_content(@accredited_provider_two.provider_name) + expect(page).to have_no_content(@accredited_provider_three.provider_name) end def given_there_are_accredited_providers_in_the_database_with_users @@ -244,7 +244,7 @@ def when_i_search_for_an_accredited_provider_with_a_valid_query end def when_i_click_add_accredited_provider - click_link 'Add accredited provider' + click_link_or_button 'Add accredited provider' end def then_i_see_the_correct_text_for_no_accredited_providers @@ -252,7 +252,7 @@ def then_i_see_the_correct_text_for_no_accredited_providers end def when_i_click_on_the_accredited_provider_tab - click_link 'Accredited provider' + click_link_or_button 'Accredited provider' end alias_method :and_i_click_on_the_accredited_provider_tab, :when_i_click_on_the_accredited_provider_tab @@ -271,7 +271,7 @@ def form_title end def click_continue - click_button 'Continue' + click_link_or_button 'Continue' end alias_method :and_i_continue_without_entering_a_description, :click_continue diff --git a/spec/features/publish/add_course_button_spec.rb b/spec/features/publish/add_course_button_spec.rb index 08e4b35026..40e23b53ca 100644 --- a/spec/features/publish/add_course_button_spec.rb +++ b/spec/features/publish/add_course_button_spec.rb @@ -20,7 +20,7 @@ def then_i_should_see_the_add_study_site_link end def and_i_should_not_see_the_add_course_button - expect(page).not_to have_link('Add course') + expect(page).to have_no_link('Add course') end def then_i_should_see_the_add_course_button diff --git a/spec/features/publish/course_confirmation_spec.rb b/spec/features/publish/course_confirmation_spec.rb index 6b0c678077..f88cedd59a 100644 --- a/spec/features/publish/course_confirmation_spec.rb +++ b/spec/features/publish/course_confirmation_spec.rb @@ -81,11 +81,11 @@ def then_i_should_be_back_on_the_confirmation_page end def and_i_submit_without_selecting_a_study_site - click_button 'Continue' + click_link_or_button 'Continue' end def and_i_click_select_a_study_site - click_link 'Select a study site' + click_link_or_button 'Select a study site' end def given_i_am_authenticated_as_a_provider_user_in_the_next_cycle diff --git a/spec/features/publish/courses/add_accredited_provider_when_publishing_a_course_spec.rb b/spec/features/publish/courses/add_accredited_provider_when_publishing_a_course_spec.rb index 88eb9ef6db..0e56ce6491 100644 --- a/spec/features/publish/courses/add_accredited_provider_when_publishing_a_course_spec.rb +++ b/spec/features/publish/courses/add_accredited_provider_when_publishing_a_course_spec.rb @@ -150,12 +150,12 @@ def and_i_click_the_publish_button end def when_i_click_the_select_accredited_provider_error_message_link - page.click_link('Select an accredited provider') + page.click_link_or_button('Select an accredited provider') end def and_i_choose_the_new_accredited_provider choose accredited_provider.provider_name - page.click_button('Update accredited provider') + page.click_link_or_button('Update accredited provider') expect(page).to have_content('Accredited provider updated') end diff --git a/spec/features/publish/courses/adding_an_accredited_provider_to_an_unpublished_course_spec.rb b/spec/features/publish/courses/adding_an_accredited_provider_to_an_unpublished_course_spec.rb index e6f98de84d..a1764de28e 100644 --- a/spec/features/publish/courses/adding_an_accredited_provider_to_an_unpublished_course_spec.rb +++ b/spec/features/publish/courses/adding_an_accredited_provider_to_an_unpublished_course_spec.rb @@ -19,7 +19,7 @@ end def given_i_click_change_accredited_provider - click_link 'Change accredited provider' + click_link_or_button 'Change accredited provider' end def then_i_should_see_the_success_message @@ -27,7 +27,7 @@ def then_i_should_see_the_success_message end def and_i_click_update_accredited_provider - click_button 'Update accredited provider' + click_link_or_button 'Update accredited provider' end def and_i_choose_the_new_accredited_provider @@ -36,7 +36,7 @@ def and_i_choose_the_new_accredited_provider end def when_i_click_select_an_accredited_provider - click_link 'Select an accredited provider' + click_link_or_button 'Select an accredited provider' end def and_i_create_a_new_accredited_provider @@ -68,7 +68,7 @@ def and_i_search_for_an_accredited_provider_with_a_valid_query end def click_continue - click_button 'Continue' + click_link_or_button 'Continue' end def form_title @@ -76,15 +76,15 @@ def form_title end def and_i_click_the_add_accredited_provider_link - click_link 'Add at least one accredited provider' + click_link_or_button 'Add at least one accredited provider' end def and_i_click_add_accredited_provider_link - click_link 'Add accredited provider' + click_link_or_button 'Add accredited provider' end def and_i_click_add_accredited_provider_button - click_button 'Add accredited provider' + click_link_or_button 'Add accredited provider' end def given_i_am_authenticated_as_a_provider_user diff --git a/spec/features/publish/courses/copy_from_list_spec.rb b/spec/features/publish/courses/copy_from_list_spec.rb index 3016c85997..91ac5a5df7 100644 --- a/spec/features/publish/courses/copy_from_list_spec.rb +++ b/spec/features/publish/courses/copy_from_list_spec.rb @@ -83,7 +83,7 @@ def when_i_select_a_course_to_copy end def and_i_click_copy - click_button 'Copy content' + click_link_or_button 'Copy content' end def then_i_see_an_alert_that_the_changes_are_not_saved_yet diff --git a/spec/features/publish/courses/editing_application_status_spec.rb b/spec/features/publish/courses/editing_application_status_spec.rb index 7b890cb6c9..894619ddee 100644 --- a/spec/features/publish/courses/editing_application_status_spec.rb +++ b/spec/features/publish/courses/editing_application_status_spec.rb @@ -34,11 +34,11 @@ def when_i_visit_the_course_show_page end def and_i_click_open_course_link - click_link 'Open course' + click_link_or_button 'Open course' end def and_i_click_close_course_link - click_link 'Close course' + click_link_or_button 'Close course' end def and_i_should_be_back_on_the_course_page @@ -70,11 +70,11 @@ def then_i_am_on_the_application_status_confirm_page end def and_i_click_open_course - click_button 'Open course' + click_link_or_button 'Open course' end def and_i_click_close_course - click_button 'Close course' + click_link_or_button 'Close course' end def given_i_am_authenticated_as_a_provider_user diff --git a/spec/features/publish/courses/editing_applications_open_spec.rb b/spec/features/publish/courses/editing_applications_open_spec.rb index 15692e158e..1dbb593e93 100644 --- a/spec/features/publish/courses/editing_applications_open_spec.rb +++ b/spec/features/publish/courses/editing_applications_open_spec.rb @@ -58,7 +58,7 @@ def given_i_choose_as_soon_as_find_is_open end def when_i_click_update - page.click_button('Update applications open date') + page.click_link_or_button('Update applications open date') end def then_i_should_see_the_earliest_date_applications_can_open diff --git a/spec/features/publish/courses/editing_apprenticeship_spec.rb b/spec/features/publish/courses/editing_apprenticeship_spec.rb index 12b6ecb534..1cfeb45cd1 100644 --- a/spec/features/publish/courses/editing_apprenticeship_spec.rb +++ b/spec/features/publish/courses/editing_apprenticeship_spec.rb @@ -44,7 +44,7 @@ private def when_i_go_back - click_link('Back') + click_link_or_button('Back') end def then_i_should_be_on_the_publish_courses_apprenticeship_edit_page diff --git a/spec/features/publish/courses/editing_course_information_spec.rb b/spec/features/publish/courses/editing_course_information_spec.rb index da8950e112..d9c0b49df4 100644 --- a/spec/features/publish/courses/editing_course_information_spec.rb +++ b/spec/features/publish/courses/editing_course_information_spec.rb @@ -60,7 +60,7 @@ 'Interview process', 'How school placements work' ].each do |name| - expect(publish_course_information_edit_page.copy_content_warning).not_to have_content(name) + expect(publish_course_information_edit_page.copy_content_warning).to have_no_content(name) end expect(publish_course_information_edit_page.about_course.value).to eq(course3_enrichment.about_course) diff --git a/spec/features/publish/courses/editing_course_length_and_funding_type_spec.rb b/spec/features/publish/courses/editing_course_length_and_funding_type_spec.rb index e85c5c9c10..8172fcea39 100644 --- a/spec/features/publish/courses/editing_course_length_and_funding_type_spec.rb +++ b/spec/features/publish/courses/editing_course_length_and_funding_type_spec.rb @@ -101,7 +101,7 @@ 'Fee details', 'Financial support' ].each do |name| - expect(publish_course_fee_edit_page.copy_content_warning).not_to have_content(name) + expect(publish_course_fee_edit_page.copy_content_warning).to have_no_content(name) end expect(publish_course_fee_edit_page.course_length.other).to be_checked diff --git a/spec/features/publish/courses/editing_course_requirements_spec.rb b/spec/features/publish/courses/editing_course_requirements_spec.rb index ceb4a86338..a2792cfb4c 100644 --- a/spec/features/publish/courses/editing_course_requirements_spec.rb +++ b/spec/features/publish/courses/editing_course_requirements_spec.rb @@ -78,7 +78,7 @@ [ 'other requirements' ].each do |name| - expect(publish_course_requirement_edit_page.copy_content_warning).not_to have_content(name) + expect(publish_course_requirement_edit_page.copy_content_warning).to have_no_content(name) end expect(publish_course_requirement_edit_page.personal_qualities.value).to eq(course3_enrichment.personal_qualities) diff --git a/spec/features/publish/courses/editing_course_start_spec.rb b/spec/features/publish/courses/editing_course_start_spec.rb index 3855332a78..b420fd63c6 100644 --- a/spec/features/publish/courses/editing_course_start_spec.rb +++ b/spec/features/publish/courses/editing_course_start_spec.rb @@ -47,7 +47,7 @@ def given_i_choose_december end def when_i_click_update - page.click_button('Update course start date') + page.click_link_or_button('Update course start date') end def then_i_should_see_the_december_start_date diff --git a/spec/features/publish/courses/editing_engineers_teach_physics_spec.rb b/spec/features/publish/courses/editing_engineers_teach_physics_spec.rb index 735134984e..2dc821c1f8 100644 --- a/spec/features/publish/courses/editing_engineers_teach_physics_spec.rb +++ b/spec/features/publish/courses/editing_engineers_teach_physics_spec.rb @@ -114,7 +114,7 @@ def and_i_click_continue end def when_i_go_back - click_link('Back') + click_link_or_button('Back') end def provider diff --git a/spec/features/publish/courses/editing_funding_type_spec.rb b/spec/features/publish/courses/editing_funding_type_spec.rb index 32b7cb8f70..d2e728c4c7 100644 --- a/spec/features/publish/courses/editing_funding_type_spec.rb +++ b/spec/features/publish/courses/editing_funding_type_spec.rb @@ -70,7 +70,7 @@ private def when_i_go_back - click_link('Back') + click_link_or_button('Back') end def then_i_should_be_on_the_publish_courses_funding_type_edit_page @@ -114,7 +114,7 @@ def and_i_continue end def and_i_cancel - click_link 'Cancel' + click_link_or_button 'Cancel' end def then_the_course_should_should_still_be_fee_paying diff --git a/spec/features/publish/courses/editing_study_sites_spec.rb b/spec/features/publish/courses/editing_study_sites_spec.rb index 90fcbf478b..88a5242a00 100644 --- a/spec/features/publish/courses/editing_study_sites_spec.rb +++ b/spec/features/publish/courses/editing_study_sites_spec.rb @@ -80,17 +80,17 @@ def course end def and_i_click_add_study_site - click_link 'Select a study site' + click_link_or_button 'Select a study site' end def and_i_check_the_first_study_site_and_submit check(provider.study_sites.first.location_name) - click_button 'Update study sites' + click_link_or_button 'Update study sites' end def and_i_uncheck_the_first_study_site_and_submit uncheck(provider.study_sites.first.location_name) - click_button 'Update study sites' + click_link_or_button 'Update study sites' end def then_i_should_see_the_study_site_location_name @@ -98,7 +98,7 @@ def then_i_should_see_the_study_site_location_name end def given_i_click_change_study_sites - click_link 'Change study sites' + click_link_or_button 'Change study sites' end def and_the_previously_selected_study_site_is_still_checked @@ -106,19 +106,19 @@ def and_the_previously_selected_study_site_is_still_checked end def and_the_study_site_checkbox_is_not_checked - expect(page).not_to have_field(checked: true) + expect(page).to have_no_field(checked: true) end def given_i_click_cancel - click_link 'Cancel' + click_link_or_button 'Cancel' end def given_i_publish_the_course - click_button 'Publish course' + click_link_or_button 'Publish course' end def when_i_click_add_at_lease_one_study_site - click_link 'Add at least one study site' + click_link_or_button 'Add at least one study site' end def then_i_should_be_on_the_study_sites_page diff --git a/spec/features/publish/courses/editing_visa_sponsorship_spec.rb b/spec/features/publish/courses/editing_visa_sponsorship_spec.rb index 0383628b90..75d381c71d 100644 --- a/spec/features/publish/courses/editing_visa_sponsorship_spec.rb +++ b/spec/features/publish/courses/editing_visa_sponsorship_spec.rb @@ -68,7 +68,7 @@ def and_i_choose_yes_to_the_skilled_worker_sponsorship_question end def and_i_continue_for(visa_type) - click_button "Update #{visa_type} visas" + click_link_or_button "Update #{visa_type} visas" end def provider diff --git a/spec/features/publish/courses/new_engineers_teach_physics_spec.rb b/spec/features/publish/courses/new_engineers_teach_physics_spec.rb index 57794270e0..3e533b073f 100644 --- a/spec/features/publish/courses/new_engineers_teach_physics_spec.rb +++ b/spec/features/publish/courses/new_engineers_teach_physics_spec.rb @@ -83,7 +83,7 @@ def and_i_click_continue end def when_i_go_back - click_link('Back') + click_link_or_button('Back') end def and_i_select_an_option diff --git a/spec/features/publish/courses/new_visa_sponsorship_spec.rb b/spec/features/publish/courses/new_visa_sponsorship_spec.rb index b88705fe57..da02b88705 100644 --- a/spec/features/publish/courses/new_visa_sponsorship_spec.rb +++ b/spec/features/publish/courses/new_visa_sponsorship_spec.rb @@ -85,7 +85,7 @@ def and_i_choose_salary end def and_i_click_continue - click_button 'Continue' + click_link_or_button 'Continue' end def then_i_should_see_the_student_visas_title diff --git a/spec/features/publish/courses/publishing_a_course_spec.rb b/spec/features/publish/courses/publishing_a_course_spec.rb index 74b34c8306..78c95a6cbf 100644 --- a/spec/features/publish/courses/publishing_a_course_spec.rb +++ b/spec/features/publish/courses/publishing_a_course_spec.rb @@ -108,7 +108,7 @@ def then_i_should_see_the_unpublished_changes_message def and_i_do_not_see_the_unpublished_content_on_find page.driver.header 'Host', 'find' visit "/course/#{provider.provider_code}/#{course.course_code}" - expect(page).not_to have_content('some new description') + expect(page).to have_no_content('some new description') end def then_i_see_the_content_on_find diff --git a/spec/features/publish/courses/withdrawing_a_course_spec.rb b/spec/features/publish/courses/withdrawing_a_course_spec.rb index 3c054d6245..b82e311fe0 100644 --- a/spec/features/publish/courses/withdrawing_a_course_spec.rb +++ b/spec/features/publish/courses/withdrawing_a_course_spec.rb @@ -32,7 +32,7 @@ scenario 'i can close the course instead' do and_there_is_a_course_i_want_to_withdraw when_i_visit_the_course_publish_courses_withdrawal_page - and_i_click_link('close the course instead') + and_i_click_link_or_button('close the course instead') then_i_should_be_on_the_close_confirmation_page end @@ -110,5 +110,5 @@ def then_i_should_be_on_the_close_confirmation_page expect(page.current_url).to end_with("publish/organisations/#{provider.provider_code}/#{provider.recruitment_cycle_year}/courses/#{course.course_code}/application_status?goto=withdraw") end - alias_method :and_i_click_link, :click_link + alias_method :and_i_click_link_or_button, :click_link_or_button end diff --git a/spec/features/publish/editing_visa_sponsorships_spec.rb b/spec/features/publish/editing_visa_sponsorships_spec.rb index 2a24fe294a..a356848427 100644 --- a/spec/features/publish/editing_visa_sponsorships_spec.rb +++ b/spec/features/publish/editing_visa_sponsorships_spec.rb @@ -62,7 +62,7 @@ def when_i_visit_the_provider_details_page end def then_i_should_not_see_any_visa_details - expect(page).not_to have_content('Visa sponsorship') + expect(page).to have_no_content('Visa sponsorship') end def then_i_should_see_visa_details diff --git a/spec/features/publish/how_to_use_this_service_spec.rb b/spec/features/publish/how_to_use_this_service_spec.rb index a38e877c53..6b74c5ac6d 100644 --- a/spec/features/publish/how_to_use_this_service_spec.rb +++ b/spec/features/publish/how_to_use_this_service_spec.rb @@ -37,7 +37,7 @@ def given_i_visit_the_root_path end def when_i_click_how_to_use_this_service - click_link 'How to use this service' + click_link_or_button 'How to use this service' end def then_i_should_see_the_h1_how_to_use_this_service @@ -45,7 +45,7 @@ def then_i_should_see_the_h1_how_to_use_this_service end def given_i_click_add_an_organisation - click_link 'Add an organisation' + click_link_or_button 'Add an organisation' end def then_i_should_see_the_h1_add_an_organisation @@ -53,11 +53,11 @@ def then_i_should_see_the_h1_add_an_organisation end def given_i_click_on_the_how_to_use_this_service_breadcrumb - click_link 'How to use this service', match: :first + click_link_or_button 'How to use this service', match: :first end def when_i_click_on_add_and_remove_users - click_link 'Add and remove users' + click_link_or_button 'Add and remove users' end def then_i_should_see_the_h1_add_and_remove_users @@ -65,7 +65,7 @@ def then_i_should_see_the_h1_add_and_remove_users end def when_i_click_on_change_an_accredited_provider_relationship - click_link 'Change an accredited provider relationship' + click_link_or_button 'Change an accredited provider relationship' end def then_i_should_see_the_h1_change_an_accredited_provider_relationship @@ -73,7 +73,7 @@ def then_i_should_see_the_h1_change_an_accredited_provider_relationship end def when_i_click_on_roll_over_courses_to_a_new_recruitment_cycle - click_link 'Roll over courses to a new recruitment cycle' + click_link_or_button 'Roll over courses to a new recruitment cycle' end def then_i_should_see_the_h1_roll_over_courses_to_a_new_recruitment_cycle @@ -81,7 +81,7 @@ def then_i_should_see_the_h1_roll_over_courses_to_a_new_recruitment_cycle end def when_click_on_help_writing_course_descriptions - click_link 'Help writing course descriptions' + click_link_or_button 'Help writing course descriptions' end def then_i_should_see_the_h1_help_writing_course_descriptions @@ -89,7 +89,7 @@ def then_i_should_see_the_h1_help_writing_course_descriptions end def when_i_click_on_course_summary_examples - click_link 'Course summary examples' + click_link_or_button 'Course summary examples' end def then_i_should_see_the_h1_course_summary_examples diff --git a/spec/features/publish/managing_schools_spec.rb b/spec/features/publish/managing_schools_spec.rb index b561e825c3..462d0e4f25 100644 --- a/spec/features/publish/managing_schools_spec.rb +++ b/spec/features/publish/managing_schools_spec.rb @@ -90,7 +90,7 @@ def and_the_school_is_added end def and_i_click_add_school - click_button 'Add school' + click_link_or_button 'Add school' end def and_i_am_on_the_schools_check_page @@ -114,7 +114,7 @@ def and_i_set_valid_new_details end def and_i_click_the_link_to_enter_a_school_manually - click_link 'I cannot find the school - enter manually' + click_link_or_button 'I cannot find the school - enter manually' end def and_i_cannot_delete_the_school @@ -132,11 +132,11 @@ def and_the_school_is_deleted end def and_i_click_remove_school_button - click_button 'Remove school' + click_link_or_button 'Remove school' end def when_i_click_cancel - click_link 'Cancel' + click_link_or_button 'Cancel' end def then_i_am_on_the_school_delete_page @@ -144,7 +144,7 @@ def then_i_am_on_the_school_delete_page end def and_i_click_remove_school_link - click_link 'Remove school' + click_link_or_button 'Remove school' end def when_i_visit_the_publish_school_show_page @@ -176,7 +176,7 @@ def then_i_am_on_the_index_page end def and_i_click_back - click_link 'Back' + click_link_or_button 'Back' end def and_the_school_is_updated @@ -186,7 +186,7 @@ def and_the_school_is_updated end def and_i_click_update - click_button 'Update school' + click_link_or_button 'Update school' end def and_i_change_school_details diff --git a/spec/features/publish/managing_study_sites_spec.rb b/spec/features/publish/managing_study_sites_spec.rb index cc229bfd5a..61c7bcf7a8 100644 --- a/spec/features/publish/managing_study_sites_spec.rb +++ b/spec/features/publish/managing_study_sites_spec.rb @@ -75,12 +75,12 @@ end def and_i_click_back - click_link 'Back' + click_link_or_button 'Back' end def and_i_enter_invalid_details fill_in('Address line 1', with: '') - click_button 'Update study site' + click_link_or_button 'Update study site' end def and_the_updated_site_is_displayed @@ -89,11 +89,11 @@ def and_the_updated_site_is_displayed def and_i_change_the_name fill_in('Study site name', with: 'Hogwarts') - click_button 'Update study site' + click_link_or_button 'Update study site' end def and_i_click_a_change_link - click_link(class: 'govuk-link location_name') + click_link_or_button(class: 'govuk-link location_name') end def and_i_am_on_the_study_sites_show_page @@ -102,7 +102,7 @@ def and_i_am_on_the_study_sites_show_page alias_method :then_i_am_on_the_study_site_show_page, :and_i_am_on_the_study_sites_show_page def when_i_click_on_a_study_site - click_link site.location_name + click_link_or_button site.location_name end def add_study_site_with_valid_details @@ -134,7 +134,7 @@ def then_i_am_on_the_index_page end def and_i_click_add_study_site - click_button 'Add study site' + click_link_or_button 'Add study site' end def and_i_am_on_the_study_sites_check_page @@ -142,7 +142,7 @@ def and_i_am_on_the_study_sites_check_page end def and_i_click_the_link_to_enter_a_school_manually - click_link 'I cannot find the school - enter manually' + click_link_or_button 'I cannot find the school - enter manually' end def and_i_set_valid_new_details @@ -150,7 +150,7 @@ def and_i_set_valid_new_details page.fill_in 'Address line 1', with: '123 Test Street' page.fill_in 'Town or city', with: 'London' page.fill_in 'Postcode', with: 'KT8 9AU' - click_button 'Continue' + click_link_or_button 'Continue' end def and_i_set_invalid_new_details @@ -158,7 +158,7 @@ def and_i_set_invalid_new_details page.fill_in 'Address line 1', with: '123 Test Street' page.fill_in 'Town or city', with: 'London' page.fill_in 'Postcode', with: 'KT8 9AU' - click_button 'Continue' + click_link_or_button 'Continue' end def and_i_set_existing_name_details @@ -166,11 +166,11 @@ def and_i_set_existing_name_details page.fill_in 'Address line 1', with: 'Another Test Street' page.fill_in 'Town or city', with: 'Manchester' page.fill_in 'Postcode', with: 'M16 0RA' - click_button 'Continue' + click_link_or_button 'Continue' end def when_i_click_add_study_site - click_link 'Add study site' + click_link_or_button 'Add study site' end def then_i_should_see_a_list_of_study_sites @@ -186,7 +186,7 @@ def when_i_visit_the_study_sites_page end def and_i_click_add_school - click_button 'Add school' + click_link_or_button 'Add school' end def given_i_am_authenticated_as_a_provider_user @@ -196,7 +196,7 @@ def given_i_am_authenticated_as_a_provider_user end def and_i_click_to_remove - click_link 'Remove study site' + click_link_or_button 'Remove study site' end def then_i_am_on_the_study_sites_delete_page @@ -204,11 +204,11 @@ def then_i_am_on_the_study_sites_delete_page end def when_i_click_cancel - click_link 'Cancel' + click_link_or_button 'Cancel' end def and_i_click_the_remove_study_site_button - click_button 'Remove study site' + click_link_or_button 'Remove study site' end def and_the_study_site_is_deleted @@ -222,7 +222,7 @@ def given_there_is_an_associated_course def and_i_cannot_delete_the_study_site expect(page).to have_content('You cannot remove this study site') - expect(page).not_to have_button('Remove study site') + expect(page).to have_no_button('Remove study site') end private diff --git a/spec/features/publish/managing_users_spec.rb b/spec/features/publish/managing_users_spec.rb index ee7b7f78bb..37e8a4a1fa 100644 --- a/spec/features/publish/managing_users_spec.rb +++ b/spec/features/publish/managing_users_spec.rb @@ -133,7 +133,7 @@ def given_i_visit_the_publish_users_index_page alias_method :when_i_visit_the_publish_users_index_page, :given_i_visit_the_publish_users_index_page def when_the_user_i_want_to_add_has_not_already_been_added - expect(publish_users_index_page).not_to have_text('willy.wonka@bat-school.com') + expect(publish_users_index_page).to have_no_text('willy.wonka@bat-school.com') end def and_i_click_add_user @@ -153,7 +153,7 @@ def and_i_fill_in_email end def and_i_continue - click_button 'Continue' + click_link_or_button 'Continue' end def and_i_am_on_the_check_page @@ -205,7 +205,7 @@ def and_i_see_the_new_first_name_is_displayed end def and_the_warning_email_text_should_not_be_displayed - expect(page).not_to have_text('Warning The user will be sent an email to tell them you’ve changed their email address') + expect(page).to have_no_text('Warning The user will be sent an email to tell them you’ve changed their email address') end def and_i_see_the_new_last_name_is_displayed @@ -217,7 +217,7 @@ def given_the_user_has_an_associated_dfe_signin_account end def then_i_should_not_see_any_change_links - expect(page).not_to have_link 'Change' + expect(page).to have_no_link 'Change' end def and_i_click_add_user @@ -244,13 +244,13 @@ def then_it_should_display_the_correct_error_messages end def and_i_click_on_the_user - click_link 'Mr User' + click_link_or_button 'Mr User' end alias_method :when_i_click_on_the_user, :and_i_click_on_the_user def when_i_click_on_user_two - click_link 'Mr Cool' + click_link_or_button 'Mr Cool' end def i_should_be_on_the_publish_users_show_page @@ -282,7 +282,7 @@ def and_i_confirm end def then_the_user_should_be_deleted - expect(publish_provider_users_page).not_to have_text 'Mr Cool' + expect(publish_provider_users_page).to have_no_text 'Mr Cool' end def and_the_new_email_is_displayed @@ -290,7 +290,7 @@ def and_the_new_email_is_displayed end def and_i_click_update_user - click_button 'Update user' + click_link_or_button 'Update user' end def then_i_should_see_a_validation_error_message diff --git a/spec/features/publish/primary_nav_spec.rb b/spec/features/publish/primary_nav_spec.rb index 13afffa092..846304331a 100644 --- a/spec/features/publish/primary_nav_spec.rb +++ b/spec/features/publish/primary_nav_spec.rb @@ -60,6 +60,6 @@ def and_i_should_not_see_the_training_partners_link end def and_i_should_not_see_the_training_partners_link - expect(page).not_to have_text 'Change organisation' + expect(page).to have_no_text 'Change organisation' end end diff --git a/spec/features/publish/providers_index_spec.rb b/spec/features/publish/providers_index_spec.rb index 9ad02d9d74..e52a6d38c6 100644 --- a/spec/features/publish/providers_index_spec.rb +++ b/spec/features/publish/providers_index_spec.rb @@ -69,7 +69,7 @@ def when_i_click_on_organisations end def when_i_click_on_the_current_cycle_link - click_link "#{Settings.current_recruitment_cycle_year.to_i - 1} to #{Settings.current_recruitment_cycle_year} - current" + click_link_or_button "#{Settings.current_recruitment_cycle_year.to_i - 1} to #{Settings.current_recruitment_cycle_year} - current" end def and_there_is_a_previous_recruitment_cycle @@ -86,7 +86,7 @@ def i_should_be_on_the_courses_index_page_in_the_same_recruitment_cycle end def and_click_change_recruitment_cycle - click_link 'Change recruitment cycle' + click_link_or_button 'Change recruitment cycle' end def given_we_are_not_in_rollover @@ -143,7 +143,7 @@ def and_there_are_providers end def and_i_click_on_a_provider - click_link 'Bat School' + click_link_or_button 'Bat School' end def i_should_see_the_change_organisation_link @@ -156,6 +156,6 @@ def i_should_be_on_the_organisations_list end def and_i_click_the_change_organisation_link - click_link 'Change organisation' + click_link_or_button 'Change organisation' end end diff --git a/spec/features/publish/searching_for_a_school_spec.rb b/spec/features/publish/searching_for_a_school_spec.rb index 03a3dcbe2b..e51fdd104e 100644 --- a/spec/features/publish/searching_for_a_school_spec.rb +++ b/spec/features/publish/searching_for_a_school_spec.rb @@ -32,7 +32,7 @@ private def and_i_go_back - click_link 'Back' + click_link_or_button 'Back' end def given_i_am_authenticated_as_a_provider_user @@ -61,12 +61,12 @@ def when_i_search_for_a_school_with_a_partial_query def then_i_should_see_a_single_radio_list expect(page).to have_content @school.name - expect(page).not_to have_content @school_two.name - expect(page).not_to have_content @school_three.name + expect(page).to have_no_content @school_two.name + expect(page).to have_no_content @school_three.name end def then_i_should_see_a_radio_list - expect(page).not_to have_content @school.name + expect(page).to have_no_content @school.name expect(page).to have_content @school_two.name expect(page).to have_content @school_three.name end @@ -117,7 +117,7 @@ def and_i_should_still_see_the_school_i_searched_for end def click_continue - click_button 'Continue' + click_link_or_button 'Continue' end def provider diff --git a/spec/features/publish/searching_for_a_study_site_spec.rb b/spec/features/publish/searching_for_a_study_site_spec.rb index 66d0d9a238..616de508ee 100644 --- a/spec/features/publish/searching_for_a_study_site_spec.rb +++ b/spec/features/publish/searching_for_a_study_site_spec.rb @@ -60,19 +60,19 @@ def when_i_continue_without_selecting_a_school end def click_continue - click_button 'Continue' + click_link_or_button 'Continue' end def then_i_should_see_a_radio_list - expect(page).not_to have_content @school.name + expect(page).to have_no_content @school.name expect(page).to have_content @school_two.name expect(page).to have_content @school_three.name end def then_i_should_see_a_single_radio_list expect(page).to have_content @school.name - expect(page).not_to have_content @school_two.name - expect(page).not_to have_content @school_three.name + expect(page).to have_no_content @school_two.name + expect(page).to have_no_content @school_three.name end def when_i_search_for_a_school_with_a_partial_query diff --git a/spec/features/publish/viewing_a_course_preview_spec.rb b/spec/features/publish/viewing_a_course_preview_spec.rb index bdd224da82..60d37722dd 100644 --- a/spec/features/publish/viewing_a_course_preview_spec.rb +++ b/spec/features/publish/viewing_a_course_preview_spec.rb @@ -22,11 +22,11 @@ scenario 'blank about the training provider' do given_i_am_authenticated(user: user_with_no_course_enrichments) when_i_visit_the_publish_course_preview_page - and_i_click_link('Enter details about the training provider') + and_i_click_link_or_button('Enter details about the training provider') then_i_should_be_on_about_your_organisation_page - and_i_click_link('Back') + and_i_click_link_or_button('Back') then_i_should_be_back_on_the_preview_page - and_i_click_link('Enter details about the training provider') + and_i_click_link_or_button('Enter details about the training provider') and_i_submit_a_valid_about_your_organisation then_i_should_be_back_on_the_preview_page then_i_should_see_the_updated_content('test training with your organisation') @@ -35,11 +35,11 @@ scenario 'blank training with disabilities and other needs' do given_i_am_authenticated(user: user_with_no_course_enrichments) when_i_visit_the_publish_course_preview_page - and_i_click_link('Enter details about training with disabilities and other needs') + and_i_click_link_or_button('Enter details about training with disabilities and other needs') then_i_should_be_on_about_your_organisation_page - and_i_click_link('Back') + and_i_click_link_or_button('Back') then_i_should_be_back_on_the_preview_page - and_i_click_link('Enter details about training with disabilities and other needs') + and_i_click_link_or_button('Enter details about training with disabilities and other needs') and_i_submit_a_valid_about_your_organisation then_i_should_be_back_on_the_preview_page then_i_should_see_the_updated_content('test training with disabilities') @@ -48,9 +48,9 @@ scenario 'blank course summary' do given_i_am_authenticated(user: user_with_no_course_enrichments) when_i_visit_the_publish_course_preview_page - and_i_click_link('Enter course summary') - and_i_click_link('Back') - and_i_click_link('Enter course summary') + and_i_click_link_or_button('Enter course summary') + and_i_click_link_or_button('Back') + and_i_click_link_or_button('Enter course summary') and_i_submit_a_valid_form and_i_see_the_correct_banner and_i_see_the_new_course_text @@ -60,11 +60,11 @@ scenario 'blank degree requirements' do given_i_am_authenticated(user: user_with_no_course_enrichments) when_i_visit_the_publish_course_preview_page - and_i_click_link('Enter degree requirements') + and_i_click_link_or_button('Enter degree requirements') and_i_am_on_the_degree_requirements_page - and_i_click_link('Back') + and_i_click_link_or_button('Back') then_i_should_be_back_on_the_preview_page - and_i_click_link('Enter degree requirements') + and_i_click_link_or_button('Enter degree requirements') and_i_submit_and_continue_through_the_two_forms then_i_should_see_the_updated_content('An undergraduate degree, or equivalent.') end @@ -72,9 +72,9 @@ scenario 'blank gcse requirements' do given_i_am_authenticated(user: user_with_no_course_enrichments) when_i_visit_the_publish_course_preview_page - and_i_click_link('Enter GCSE and equivalency test requirements') - and_i_click_link('Back') - and_i_click_link('Enter GCSE and equivalency test requirements') + and_i_click_link_or_button('Enter GCSE and equivalency test requirements') + and_i_click_link_or_button('Back') + and_i_click_link_or_button('Enter GCSE and equivalency test requirements') and_i_choose_no_and_submit and_i_see_the_correct_banner and_i_see_the_correct_gcse_text @@ -84,9 +84,9 @@ scenario 'blank school placements' do given_i_am_authenticated(user: user_with_no_course_enrichments) when_i_visit_the_publish_course_preview_page - and_i_click_link('Enter details about school placements') - and_i_click_link('Back') - and_i_click_link('Enter details about school placements') + and_i_click_link_or_button('Enter details about school placements') + and_i_click_link_or_button('Back') + and_i_click_link_or_button('Enter details about school placements') and_i_submit_a_valid_form and_i_see_the_correct_banner then_i_should_be_back_on_the_preview_page @@ -95,9 +95,9 @@ scenario 'blank fees uk eu' do given_i_am_authenticated(user: user_with_no_course_enrichments) when_i_visit_the_publish_course_preview_page - and_i_click_link('Enter details about fees and financial support') - and_i_click_link('Back') - and_i_click_link('Enter details about fees and financial support') + and_i_click_link_or_button('Enter details about fees and financial support') + and_i_click_link_or_button('Back') + and_i_click_link_or_button('Enter details about fees and financial support') and_i_submit_a_valid_course_fees and_i_see_the_correct_banner and_i_see_the_the_course_fee @@ -370,7 +370,7 @@ def when_i_visit_the_publish_course_preview_page ) end - alias_method :and_i_click_link, :click_link + alias_method :and_i_click_link_or_button, :click_link_or_button def then_i_should_see_the_updated_content(text) expect(page).to have_content(text) @@ -382,9 +382,9 @@ def and_i_see_the_the_course_fee def and_i_submit_and_continue_through_the_two_forms choose('No') - click_button('Continue') + click_link_or_button('Continue') choose('No') - click_button('Update degree requirements') + click_link_or_button('Update degree requirements') end def and_i_am_on_the_degree_requirements_page @@ -399,7 +399,7 @@ def and_i_see_the_correct_gcse_text def and_i_choose_no_and_submit page.all('.govuk-radios__item')[1].choose page.all('.govuk-radios__item')[3].choose - click_button 'Update GCSEs and equivalency tests' + click_link_or_button 'Update GCSEs and equivalency tests' end def and_i_see_the_correct_banner @@ -422,21 +422,21 @@ def and_i_submit_a_valid_about_your_organisation fill_in 'Training with your organisation', with: 'test training with your organisation' fill_in 'Training with disabilities and other needs', with: 'test training with disabilities' - click_button 'Save and publish' + click_link_or_button 'Save and publish' end def and_i_submit_a_valid_form fill_in 'About this course', with: 'great course' fill_in 'School placements', with: 'great placement' - click_button 'Update course information' + click_link_or_button 'Update course information' end def and_i_submit_a_valid_course_fees choose '1 year' fill_in 'Fee for UK students', with: '100' - click_button 'Update course length and fees' + click_link_or_button 'Update course length and fees' end def provider @@ -465,7 +465,7 @@ def and_i_see_financial_support expect(publish_course_preview_page.scholarship_amount).to have_content('a scholarship of £26,000') expect(publish_course_preview_page.bursary_amount).to have_content('a bursary of £24,000') - expect(publish_course_preview_page).not_to have_content('Information not yet available') + expect(publish_course_preview_page).to have_no_content('Information not yet available') end def and_i_do_not_see_financial_support diff --git a/spec/features/support/filters/provider_filters_spec.rb b/spec/features/support/filters/provider_filters_spec.rb index da76a94632..6d5d1516e8 100644 --- a/spec/features/support/filters/provider_filters_spec.rb +++ b/spec/features/support/filters/provider_filters_spec.rb @@ -67,7 +67,7 @@ def and_when_i_click_apply_filters def the_correct_provider_shows expect(support_provider_index_page.providers.length).to eq(1) expect(support_provider_index_page).to have_content(@provider_one.provider_name) - expect(support_provider_index_page).not_to have_content(@provider_two.provider_name) + expect(support_provider_index_page).to have_no_content(@provider_two.provider_name) end def then_i_can_search_by_course_code diff --git a/spec/features/support/filters/user_filters_spec.rb b/spec/features/support/filters/user_filters_spec.rb index 344c52cbd6..106265320e 100644 --- a/spec/features/support/filters/user_filters_spec.rb +++ b/spec/features/support/filters/user_filters_spec.rb @@ -70,13 +70,13 @@ def and_when_i_click_apply_filters def the_correct_admin_user_shows expect(support_users_index_page.users.length).to eq(1) expect(support_users_index_page).to have_content(@admin_user.first_name) - expect(support_users_index_page).not_to have_content(@user.first_name) + expect(support_users_index_page).to have_no_content(@user.first_name) end def the_correct_provider_user_shows expect(support_users_index_page.users.length).to eq(1) expect(support_users_index_page).to have_content(@user.first_name) - expect(support_users_index_page).not_to have_content(@admin_user.first_name) + expect(support_users_index_page).to have_no_content(@admin_user.first_name) end def given_i_have_filters_selected diff --git a/spec/features/support/providers/accredited_provider_search/searching_for_an_accredited_provider_spec.rb b/spec/features/support/providers/accredited_provider_search/searching_for_an_accredited_provider_spec.rb index e98803d4c4..879f8198fc 100644 --- a/spec/features/support/providers/accredited_provider_search/searching_for_an_accredited_provider_spec.rb +++ b/spec/features/support/providers/accredited_provider_search/searching_for_an_accredited_provider_spec.rb @@ -71,8 +71,8 @@ def when_i_search_for_an_accredited_provider_with_a_valid_query def then_i_see_the_provider_i_searched_for expect(page).to have_content(@accredited_provider.provider_name) - expect(page).not_to have_content(@accredited_provider_two.provider_name) - expect(page).not_to have_content(@accredited_provider_three.provider_name) + expect(page).to have_no_content(@accredited_provider_two.provider_name) + expect(page).to have_no_content(@accredited_provider_three.provider_name) end def when_i_select_the_provider @@ -104,8 +104,8 @@ def when_i_continue_without_selecting_an_accredited_provider def and_i_should_still_see_the_provider_i_searched_for expect(page).to have_content(@accredited_provider.provider_name) - expect(page).not_to have_content(@accredited_provider_two.provider_name) - expect(page).not_to have_content(@accredited_provider_three.provider_name) + expect(page).to have_no_content(@accredited_provider_two.provider_name) + expect(page).to have_no_content(@accredited_provider_three.provider_name) end def when_i_enter_a_description @@ -115,7 +115,7 @@ def when_i_enter_a_description def and_i_confirm_the_changes expect do - click_button 'Add accredited provider' + click_link_or_button 'Add accredited provider' end.to have_enqueued_email(Users::OrganisationMailer, :added_as_an_organisation_to_training_partner) end @@ -129,7 +129,7 @@ def and_i_should_see_the_accredited_providers end def click_continue - click_button 'Continue' + click_link_or_button 'Continue' end def when_i_am_on_the_confirm_page @@ -141,7 +141,7 @@ def when_i_am_on_the_confirm_page def and_i_click_the_change_link_for(field) within '.govuk-summary-list' do - click_link "Change #{field}" + click_link_or_button "Change #{field}" end end @@ -166,7 +166,7 @@ def then_i_should_be_taken_to_the_accredited_provider_description_page end def when_i_click_the_back_link - click_link 'Back' + click_link_or_button 'Back' end def then_i_should_be_taken_back_to_the_confirm_page diff --git a/spec/features/support/providers/accredited_providers_spec.rb b/spec/features/support/providers/accredited_providers_spec.rb index a4ae79bd7a..aee07cd626 100644 --- a/spec/features/support/providers/accredited_providers_spec.rb +++ b/spec/features/support/providers/accredited_providers_spec.rb @@ -62,21 +62,21 @@ def and_i_see_the_remove_success_message def and_i_see_the_remove_success_message; end def and_i_click_remove_ap - click_button 'Remove accredited provider' + click_link_or_button 'Remove accredited provider' end def and_i_confirm_the_changes - click_button 'Add accredited provider' + click_link_or_button 'Add accredited provider' end def when_i_input_new_information fill_in 'About the accredited provider', with: 'New AP description' - click_button 'Continue' + click_link_or_button 'Continue' end def and_i_select_the_provider choose @accredited_provider.provider_name - click_button 'Continue' + click_link_or_button 'Continue' end def form_title @@ -85,15 +85,15 @@ def form_title def and_i_search_for_an_accredited_provider_with_a_valid_query fill_in form_title, with: @accredited_provider.provider_name - click_button 'Continue' + click_link_or_button 'Continue' end def and_i_click_add_accredited_provider - click_link 'Add accredited provider' + click_link_or_button 'Add accredited provider' end def and_i_click_remove - click_link 'Remove' + click_link_or_button 'Remove' end def then_i_should_see_the_cannot_remove_text @@ -126,11 +126,11 @@ def and_i_visit_the_index_page end def and_i_click_change - click_link('Change') + click_link_or_button('Change') end def when_i_click_the_back_link - click_link 'Back' + click_link_or_button 'Back' end def and_i_see_the_success_message @@ -143,7 +143,7 @@ def then_i_should_see_the_updated_description def when_i_input_updated_description fill_in 'About the accredited provider', with: 'update the AP description' - click_button 'Update description' + click_link_or_button 'Update description' end def then_i_see_the_correct_text_for_no_accredited_providers @@ -151,7 +151,7 @@ def then_i_see_the_correct_text_for_no_accredited_providers end def and_i_click_on_the_accredited_provider_tab - click_link 'Accredited provider' + click_link_or_button 'Accredited provider' end def and_my_provider_has_accrediting_providers diff --git a/spec/features/support/providers/courses/editing_visa_sponsorship_spec.rb b/spec/features/support/providers/courses/editing_visa_sponsorship_spec.rb index 7d12e344ab..66d7963e4d 100644 --- a/spec/features/support/providers/courses/editing_visa_sponsorship_spec.rb +++ b/spec/features/support/providers/courses/editing_visa_sponsorship_spec.rb @@ -41,7 +41,7 @@ end def and_i_submit_the_form - click_button 'Update' + click_link_or_button 'Update' end def and_i_check_the_student_visa_check_box @@ -69,11 +69,11 @@ def then_the_skilled_worker_visa_checkbox_should_be_checked end def and_the_skilled_worker_visa_question_is_not_rendered - expect(page).not_to have_css('#support-edit-course-form-can-sponsor-skilled-worker-visa-true-field') + expect(page).to have_no_css('#support-edit-course-form-can-sponsor-skilled-worker-visa-true-field') end def and_the_student_visa_question_is_not_rendered - expect(page).not_to have_css('#support-edit-course-form-can-sponsor-student-visa-true-field') + expect(page).to have_no_css('#support-edit-course-form-can-sponsor-student-visa-true-field') end def given_i_am_authenticated_as_an_admin_user diff --git a/spec/features/support/providers/courses/reverting_a_withdrawal_spec.rb b/spec/features/support/providers/courses/reverting_a_withdrawal_spec.rb index e0415275bb..3768b2fefa 100644 --- a/spec/features/support/providers/courses/reverting_a_withdrawal_spec.rb +++ b/spec/features/support/providers/courses/reverting_a_withdrawal_spec.rb @@ -18,7 +18,7 @@ end def and_i_should_no_longer_see_the_revert_withdrawal_link - expect(page).not_to have_link('Revert withdrawal') + expect(page).to have_no_link('Revert withdrawal') end def then_i_should_see_the_published_and_closed_course @@ -30,7 +30,7 @@ def and_i_see_the_success_message end def and_i_confirm - click_button 'Revert withdrawal' + click_link_or_button 'Revert withdrawal' end def when_i_navigate_to_the_withdrawn_course @@ -38,7 +38,7 @@ def when_i_navigate_to_the_withdrawn_course end def and_i_click_revert_withdrawal - click_link 'Revert withdrawal' + click_link_or_button 'Revert withdrawal' end def given_i_am_authenticated_as_an_admin_user diff --git a/spec/features/support/providers/editing_a_provider_spec.rb b/spec/features/support/providers/editing_a_provider_spec.rb index a65beb83fc..eb748656bf 100644 --- a/spec/features/support/providers/editing_a_provider_spec.rb +++ b/spec/features/support/providers/editing_a_provider_spec.rb @@ -69,11 +69,11 @@ def then_i_can_view_provider_details end def when_i_click_on_the_change_link - click_link 'Change provider name' + click_link_or_button 'Change provider name' end def when_i_click_on_the_change_email_link - click_link 'Change provider email' + click_link_or_button 'Change provider email' end def then_i_am_on_the_support_provider_edit_page diff --git a/spec/features/support/providers/onboarding_a_new_provider_spec.rb b/spec/features/support/providers/onboarding_a_new_provider_spec.rb index 4415b919b2..8d10b16797 100644 --- a/spec/features/support/providers/onboarding_a_new_provider_spec.rb +++ b/spec/features/support/providers/onboarding_a_new_provider_spec.rb @@ -204,11 +204,11 @@ def and_the_provider_form_should_be_prefilled_with_the_provider_details(provider end def and_i_click_the_add_organisation_button - click_button 'Add organisation' + click_link_or_button 'Add organisation' end def and_i_click_the_continue_button - click_button 'Continue' + click_link_or_button 'Continue' end def then_i_am_redirected_to_provider_page diff --git a/spec/features/support/providers/providers_filter_spec.rb b/spec/features/support/providers/providers_filter_spec.rb index 6bf60b24f9..45eb805272 100644 --- a/spec/features/support/providers/providers_filter_spec.rb +++ b/spec/features/support/providers/providers_filter_spec.rb @@ -46,7 +46,7 @@ def then_i_see_providers_filtered_by_ukprn def when_filter_by_ukprn fill_in 'Provider name, code or UKPRN', with: '12345678' - click_button 'Apply filters' + click_link_or_button 'Apply filters' end def and_there_are_providers @@ -66,19 +66,19 @@ def then_i_see_the_providers def when_i_filter_by_provider fill_in 'Provider name, code or UKPRN', with: 'Really big school' - click_button 'Apply filters' + click_link_or_button 'Apply filters' end def when_i_filter_by_course_code fill_in 'Provider name, code or UKPRN', with: '' fill_in 'Course code', with: '2VVZ' - click_button 'Apply filters' + click_link_or_button 'Apply filters' end def when_i_filter_by_provider_code_and_course_code fill_in 'Provider name, code or UKPRN', with: 'A01' fill_in 'Course code', with: '2vvZ' - click_button 'Apply filters' + click_link_or_button 'Apply filters' end def then_i_see_providers_filtered_by_provider_name @@ -95,15 +95,15 @@ def then_i_see_the_providers_filtered_by_course_code end def when_i_remove_the_provider_filter - click_link 'Remove Really big school provider search filter' + click_link_or_button 'Remove Really big school provider search filter' end def when_i_remove_the_course_code_filter - click_link 'Remove 2VVZ course search filter' + click_link_or_button 'Remove 2VVZ course search filter' end def when_i_remove_the_provider_code_and_course_code_filter - click_link 'Remove A01 provider search filter' - click_link 'Remove 2vvZ course search filter' + click_link_or_button 'Remove A01 provider search filter' + click_link_or_button 'Remove 2vvZ course search filter' end end diff --git a/spec/features/support/providers/providers_list_spec.rb b/spec/features/support/providers/providers_list_spec.rb index 7889010992..5e3413890b 100644 --- a/spec/features/support/providers/providers_list_spec.rb +++ b/spec/features/support/providers/providers_list_spec.rb @@ -37,6 +37,6 @@ def then_i_am_on_the_provider_page end def and_i_click_on_add_provider - click_link('Add provider') + click_link_or_button('Add provider') end end diff --git a/spec/features/support/providers/schools/add_school_to_provider_spec.rb b/spec/features/support/providers/schools/add_school_to_provider_spec.rb index 97a33a40bb..3e3e53c709 100644 --- a/spec/features/support/providers/schools/add_school_to_provider_spec.rb +++ b/spec/features/support/providers/schools/add_school_to_provider_spec.rb @@ -78,11 +78,11 @@ def then_i_see_the_success_message end def and_i_click_save_and_add_another_school_button - click_button 'Save school and add another' + click_link_or_button 'Save school and add another' end def and_i_click_add_school_button - click_button 'Add school' + click_link_or_button 'Add school' end def then_i_should_see_the_school_name_listed @@ -110,7 +110,7 @@ def and_i_continue end def and_i_click_add_school - click_link 'Add school' + click_link_or_button 'Add school' end def and_i_fill_in_school_name diff --git a/spec/features/support/providers/schools/creating_multiple_schools_spec.rb b/spec/features/support/providers/schools/creating_multiple_schools_spec.rb index a4f62f45f7..6f03a32ec8 100644 --- a/spec/features/support/providers/schools/creating_multiple_schools_spec.rb +++ b/spec/features/support/providers/schools/creating_multiple_schools_spec.rb @@ -100,7 +100,7 @@ end def and_i_click_change - page.all('.govuk-summary-card__action')[1].click_link + page.all('.govuk-summary-card__action')[1].click_link_or_button end def and_the_text_field_is_prepopulated @@ -163,23 +163,23 @@ def provider end def then_i_click_add_multiple_schools - click_link 'Add multiple schools' + click_link_or_button 'Add multiple schools' end def given_i_submit_an_empty_form - click_button 'Continue' + click_link_or_button 'Continue' end def when_i_click_back - click_link 'Back' + click_link_or_button 'Back' end def when_i_click_cancel - click_link 'Cancel' + click_link_or_button 'Cancel' end def given_i_add_the_schools - click_button 'Add schools' + click_link_or_button 'Add schools' end def then_i_should_see_the_validation_error_message diff --git a/spec/features/support/providers/schools/delete_school_spec.rb b/spec/features/support/providers/schools/delete_school_spec.rb index af7b433acb..37c4f9091c 100644 --- a/spec/features/support/providers/schools/delete_school_spec.rb +++ b/spec/features/support/providers/schools/delete_school_spec.rb @@ -33,7 +33,7 @@ def then_i_am_on_the_index_page end def and_i_click_remove_school_button - click_button 'Remove school' + click_link_or_button 'Remove school' end def then_i_am_on_the_school_show_page @@ -41,7 +41,7 @@ def then_i_am_on_the_school_show_page end def when_i_click_cancel - click_link 'Cancel' + click_link_or_button 'Cancel' end def then_i_am_on_the_school_delete_page @@ -49,7 +49,7 @@ def then_i_am_on_the_school_delete_page end def when_i_click_remove_school_link - click_link 'Remove school' + click_link_or_button 'Remove school' end def and_i_visit_the_support_provider_school_show_page diff --git a/spec/features/support/providers/schools/edit_school_spec.rb b/spec/features/support/providers/schools/edit_school_spec.rb index 765d285bc2..561bb7f606 100644 --- a/spec/features/support/providers/schools/edit_school_spec.rb +++ b/spec/features/support/providers/schools/edit_school_spec.rb @@ -37,7 +37,7 @@ def then_i_am_on_the_index_page end def and_i_click_back - click_link 'Back' + click_link_or_button 'Back' end def and_the_school_is_not_updated @@ -67,7 +67,7 @@ def and_the_school_is_updated end def and_i_click_update - click_button 'Update school' + click_link_or_button 'Update school' end def and_i_change_school_details diff --git a/spec/features/support/providers/users/adding_user_to_provider_spec.rb b/spec/features/support/providers/users/adding_user_to_provider_spec.rb index 6f5b172ed8..5df2b7d9aa 100644 --- a/spec/features/support/providers/users/adding_user_to_provider_spec.rb +++ b/spec/features/support/providers/users/adding_user_to_provider_spec.rb @@ -83,7 +83,7 @@ def and_i_should_see_the_users_email_listed end def and_the_user_i_want_to_add_has_not_already_been_added - expect(support_provider_user_users_check_page).not_to have_text('viola_fisher@boyle.io') + expect(support_provider_user_users_check_page).to have_no_text('viola_fisher@boyle.io') end def then_it_should_display_the_correct_error_messages diff --git a/spec/features/support/switching_between_recruitment_cycles_spec.rb b/spec/features/support/switching_between_recruitment_cycles_spec.rb index 1e376afdce..b095700d51 100644 --- a/spec/features/support/switching_between_recruitment_cycles_spec.rb +++ b/spec/features/support/switching_between_recruitment_cycles_spec.rb @@ -58,15 +58,15 @@ def then_i_should_be_on_the_recruitment_cycle_switcher_page end def and_should_not_see_the_switch_cycle_link - expect(support_provider_index_page).not_to have_link 'Change recruitment cycle' + expect(support_provider_index_page).to have_no_link 'Change recruitment cycle' end def when_i_click_on_the_current_cycle - click_link "#{Settings.current_recruitment_cycle_year} - current" + click_link_or_button "#{Settings.current_recruitment_cycle_year} - current" end def and_click_on_the_next_cycle - click_link Settings.current_recruitment_cycle_year + 1 + click_link_or_button Settings.current_recruitment_cycle_year + 1 end def i_should_see_the_current_cycle_page @@ -74,7 +74,7 @@ def i_should_see_the_current_cycle_page end def when_click_the_switch_cycle_link - click_link 'Change recruitment cycle' + click_link_or_button 'Change recruitment cycle' end def i_should_be_on_the_next_cycle_page @@ -86,6 +86,6 @@ def and_i_should_see_the_pe_allocations_tab end def and_i_should_not_see_the_pe_allocations_tab - expect(support_provider_index_page).not_to have_link 'PE Allocations' + expect(support_provider_index_page).to have_no_link 'PE Allocations' end end diff --git a/spec/features/view_pages_spec.rb b/spec/features/view_pages_spec.rb index c4df0772ac..a8f1b8ecf4 100644 --- a/spec/features/view_pages_spec.rb +++ b/spec/features/view_pages_spec.rb @@ -6,7 +6,7 @@ scenario 'Environment label and class are read from settings' do visit '/cookies' expect(page).to have_css('.govuk-phase-banner__content__tag', text: Settings.environment.label) - expect(page).to have_selector(".app-header--#{Settings.environment.name}") + expect(page).to have_css(".app-header--#{Settings.environment.name}") end scenario 'Navigate to /cookies' do diff --git a/spec/support/page_objects/sections/copy_content.rb b/spec/support/page_objects/sections/copy_content.rb index aea90870b8..ced1b3d312 100644 --- a/spec/support/page_objects/sections/copy_content.rb +++ b/spec/support/page_objects/sections/copy_content.rb @@ -13,7 +13,7 @@ def copy_options def copy(course) select("#{course.name} (#{course.course_code})", from: 'Copy from') - click_button('Copy content') + click_link_or_button('Copy content') end end end