diff options
Diffstat (limited to 'spec/features/runners_spec.rb')
-rw-r--r-- | spec/features/runners_spec.rb | 54 |
1 files changed, 50 insertions, 4 deletions
diff --git a/spec/features/runners_spec.rb b/spec/features/runners_spec.rb index cee0910aef7..40ba0fa9ebb 100644 --- a/spec/features/runners_spec.rb +++ b/spec/features/runners_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Runners' do +RSpec.describe 'Runners', feature_category: :runner_fleet do let_it_be(:user) { create(:user) } before do @@ -117,11 +117,35 @@ RSpec.describe 'Runners' do it 'user sees CI/CD setting page' do visit project_runners_path(project) - expect(page.find('.available-shared-runners')).to have_content(shared_runner.display_name) + within '[data-testid="available-shared-runners"]' do + expect(page).to have_content(shared_runner.display_name) + end + end + + context 'when multiple shared runners are configured' do + let_it_be(:shared_runner_2) { create(:ci_runner, :instance) } + + it 'shows the runner count' do + visit project_runners_path(project) + + within '[data-testid="available-shared-runners"]' do + expect(page).to have_content format(_('Available shared runners: %{count}'), { count: 2 }) + end + end + + it 'adds pagination to the shared runner list' do + stub_const('Projects::Settings::CiCdController::NUMBER_OF_RUNNERS_PER_PAGE', 1) + + visit project_runners_path(project) + + within '[data-testid="available-shared-runners"]' do + expect(find('.pagination')).not_to be_nil + end + end end end - context 'when multiple runners are configured' do + context 'when multiple project runners are configured' do let!(:project_runner_2) { create(:ci_runner, :project, projects: [project]) } it 'adds pagination to the runner list' do @@ -306,7 +330,7 @@ RSpec.describe 'Runners' do end context 'project with a group and a group runner' do - let_it_be(:ci_runner) do + let_it_be(:group_runner) do create(:ci_runner, :group, groups: [group], description: 'group-runner') end @@ -330,6 +354,28 @@ RSpec.describe 'Runners' do expect(page).to have_content 'Disable group runners' expect(project.reload.group_runners_enabled).to be true end + + context 'when multiple group runners are configured' do + let_it_be(:group_runner_2) { create(:ci_runner, :group, groups: [group]) } + + it 'shows the runner count' do + visit project_runners_path(project) + + within '[data-testid="group-runners"]' do + expect(page).to have_content format(_('Available group runners: %{runners}'), { runners: 2 }) + end + end + + it 'adds pagination to the group runner list' do + stub_const('Projects::Settings::CiCdController::NUMBER_OF_RUNNERS_PER_PAGE', 1) + + visit project_runners_path(project) + + within '[data-testid="group-runners"]' do + expect(find('.pagination')).not_to be_nil + end + end + end end end end |