From e31c702bb8aa2f1d054f0eda122a5b5e9c802df3 Mon Sep 17 00:00:00 2001 From: Keith Lawrence Date: Wed, 14 Aug 2024 10:57:03 +0100 Subject: [PATCH] Add test for switch app link --- app/views/layouts/application.html.erb | 5 +++++ spec/system/main_menu_spec.rb | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index c8845eb20..511be0722 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -37,6 +37,11 @@ href: services_path, active: current_page?(services_path), } + + menu_option << { + text: "Switch app", + href: Plek.find("signon"), + } %> <%= render "govuk_publishing_components/components/layout_header", { diff --git a/spec/system/main_menu_spec.rb b/spec/system/main_menu_spec.rb index 2a4461d5a..ec9c9bf5f 100644 --- a/spec/system/main_menu_spec.rb +++ b/spec/system/main_menu_spec.rb @@ -9,13 +9,14 @@ stub_organisations_api_has_organisations_with_bodies([{ "title" => "Department of Randomness", "details" => { "slug" => "random-department" } }]) end - it "shows only the Services menu item" do + it "shows only the Services/Switch app menu items" do visit "/" within(".govuk-header__container") do - expect(page).not_to have_content("Broken Links") - expect(page).not_to have_content("Councils") - expect(page).to have_content("Services") + expect(page).not_to have_link("Broken Links") + expect(page).not_to have_link("Councils") + expect(page).to have_link("Services") + expect(page).to have_link("Switch app") end end end @@ -23,13 +24,14 @@ context "as a GDS Editor" do before { login_as_gds_editor } - it "shows all three menu options" do + it "shows all four menu options" do visit "/" within(".govuk-header__container") do - expect(page).to have_content("Broken Links") - expect(page).to have_content("Councils") - expect(page).to have_content("Services") + expect(page).to have_link("Broken Links") + expect(page).to have_link("Councils") + expect(page).to have_link("Services") + expect(page).to have_link("Switch app") end end end