diff options
Diffstat (limited to 'spec/features/admin/admin_runners_spec.rb')
-rw-r--r-- | spec/features/admin/admin_runners_spec.rb | 77 |
1 files changed, 47 insertions, 30 deletions
diff --git a/spec/features/admin/admin_runners_spec.rb b/spec/features/admin/admin_runners_spec.rb index 04dc206f052..582535790bd 100644 --- a/spec/features/admin/admin_runners_spec.rb +++ b/spec/features/admin/admin_runners_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe "Admin Runners", feature_category: :runner_fleet do - include Spec::Support::Helpers::Features::RunnersHelpers + include Features::RunnersHelpers include Spec::Support::Helpers::ModalHelpers let_it_be(:admin) { create(:admin) } @@ -23,8 +23,6 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do describe "runners creation" do before do - stub_feature_flags(create_runner_workflow: true) - visit admin_runners_path end @@ -34,15 +32,30 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do end describe "runners registration" do - before do - stub_feature_flags(create_runner_workflow: false) + context 'when create_runner_workflow_for_namespace is enabled' do + before do + stub_feature_flags(create_runner_workflow_for_admin: true) - visit admin_runners_path + visit admin_runners_path + end + + it_behaves_like "shows and resets runner registration token" do + let(:dropdown_text) { s_('Runners|Register an instance runner') } + let(:registration_token) { Gitlab::CurrentSettings.runners_registration_token } + end end - it_behaves_like "shows and resets runner registration token" do - let(:dropdown_text) { s_('Runners|Register an instance runner') } - let(:registration_token) { Gitlab::CurrentSettings.runners_registration_token } + context 'when create_runner_workflow_for_namespace is disabled' do + before do + stub_feature_flags(create_runner_workflow_for_admin: false) + + visit admin_runners_path + end + + it_behaves_like "shows and resets runner registration token" do + let(:dropdown_text) { s_('Runners|Register an instance runner') } + let(:registration_token) { Gitlab::CurrentSettings.runners_registration_token } + end end end @@ -373,11 +386,9 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do it_behaves_like 'shows no runners found' - it 'shows active tab' do + it 'shows active tab with no runner' do expect(page).to have_link('Instance', class: 'active') - end - it 'shows no runner' do expect(page).not_to have_content 'runner-project' expect(page).not_to have_content 'runner-group' end @@ -471,10 +482,12 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do it_behaves_like 'shows no runners registered' it 'shows tabs with total counts equal to 0' do - expect(page).to have_link('All 0') - expect(page).to have_link('Instance 0') - expect(page).to have_link('Group 0') - expect(page).to have_link('Project 0') + aggregate_failures do + expect(page).to have_link('All 0') + expect(page).to have_link('Instance 0') + expect(page).to have_link('Group 0') + expect(page).to have_link('Project 0') + end end end @@ -493,6 +506,16 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do end end + describe "Runner create page", :js do + before do + visit new_admin_runner_path + end + + it_behaves_like 'creates runner and shows register page' do + let(:register_path_pattern) { register_admin_runner_path('.*') } + end + end + describe "Runner show page", :js do let_it_be(:runner) do create( @@ -546,11 +569,8 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do end end - it 'deletes runner' do + it 'deletes runner and redirects to runner list' do expect(page.find('[data-testid="alert-success"]')).to have_content('deleted') - end - - it 'redirects to runner list' do expect(current_url).to match(admin_runners_path) end end @@ -593,12 +613,9 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do wait_for_requests end - it 'show success alert' do - expect(page.find('[data-testid="alert-success"]')).to have_content('saved') - end - - it 'redirects to runner page' do + it 'show success alert and redirects to runner page' do expect(current_url).to match(admin_runner_path(project_runner)) + expect(page.find('[data-testid="alert-success"]')).to have_content('saved') end end @@ -632,12 +649,12 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do assigned_project = page.find('[data-testid="assigned-projects"]') expect(page).to have_content('Runner assigned to project.') - expect(assigned_project).to have_content(project2.path) + expect(assigned_project).to have_content(project2.name) end end context 'with project runner' do - let(:project_runner) { create(:ci_runner, :project, projects: [project1]) } + let_it_be(:project_runner) { create(:ci_runner, :project, projects: [project1]) } before do visit edit_admin_runner_path(project_runner) @@ -647,7 +664,7 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do end context 'with locked runner' do - let(:locked_runner) { create(:ci_runner, :project, projects: [project1], locked: true) } + let_it_be(:locked_runner) { create(:ci_runner, :project, projects: [project1], locked: true) } before do visit edit_admin_runner_path(locked_runner) @@ -658,7 +675,7 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do end describe 'disable/destroy' do - let(:runner) { create(:ci_runner, :project, projects: [project1]) } + let_it_be(:runner) { create(:ci_runner, :project, projects: [project1]) } before do visit edit_admin_runner_path(runner) @@ -672,7 +689,7 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do new_runner_project = page.find('[data-testid="unassigned-projects"]') expect(page).to have_content('Runner unassigned from project.') - expect(new_runner_project).to have_content(project1.path) + expect(new_runner_project).to have_content(project1.name) end end end |