From dae006ee0666fdc9eda4bd73bb6809dc6e32ef12 Mon Sep 17 00:00:00 2001 From: Iain McNulty Date: Thu, 14 Nov 2024 12:39:16 +0000 Subject: [PATCH] Add basic system test for all three services --- spec/system/find/load_the_service_spec.rb | 12 +++++++++++ spec/system/publish/load_the_service_spec.rb | 22 ++++++++++++++++++++ spec/system/support/load_the_service_spec.rb | 21 +++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 spec/system/find/load_the_service_spec.rb create mode 100644 spec/system/publish/load_the_service_spec.rb create mode 100644 spec/system/support/load_the_service_spec.rb diff --git a/spec/system/find/load_the_service_spec.rb b/spec/system/find/load_the_service_spec.rb new file mode 100644 index 0000000000..e342eb5ecc --- /dev/null +++ b/spec/system/find/load_the_service_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Find - Root path', service: :find do + include DfESignInUserHelper + + it 'shows the find page' do + visit '/' + expect(page).to have_content('Find courses by location or by training provider') + end +end diff --git a/spec/system/publish/load_the_service_spec.rb b/spec/system/publish/load_the_service_spec.rb new file mode 100644 index 0000000000..1c06d347d3 --- /dev/null +++ b/spec/system/publish/load_the_service_spec.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Publish - Courses page', service: :publish do + include DfESignInUserHelper + + let(:provider) { create(:provider, provider_name: 'System Provider') } + let(:course) { create(:course, provider:, name: 'System Course') } + let(:user) { create(:user, providers: [provider]) } + + before do + sign_in_system_test(user:) + course + end + + it 'shows the publish courses page' do + visit '/publish/organisations' + expect(page).to have_content('Sign out') + expect(page).to have_content(course.name) + end +end diff --git a/spec/system/support/load_the_service_spec.rb b/spec/system/support/load_the_service_spec.rb new file mode 100644 index 0000000000..d68cbebac7 --- /dev/null +++ b/spec/system/support/load_the_service_spec.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Support', service: :publish do + include DfESignInUserHelper + + let(:provider) { create(:provider, provider_name: 'System Provider') } + let(:user) { create(:user, :admin, providers: [provider]) } + + before do + sign_in_system_test(user:) + end + + it 'shows the support page' do + visit '/publish/organisations' + click_on('Support console') + expect(page).to have_current_path(%r{/support}) + expect(page).to have_content('System Provider') + end +end