diff options
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/admin/admin_runners_spec.rb | 48 | ||||
-rw-r--r-- | spec/features/groups/group_runners_spec.rb | 15 |
2 files changed, 34 insertions, 29 deletions
diff --git a/spec/features/admin/admin_runners_spec.rb b/spec/features/admin/admin_runners_spec.rb index fe9fd01d3d5..ece5012f0ca 100644 --- a/spec/features/admin/admin_runners_spec.rb +++ b/spec/features/admin/admin_runners_spec.rb @@ -351,14 +351,15 @@ RSpec.describe "Admin Runners" do end describe 'filter by tag' do - before_all do - create(:ci_runner, :instance, description: 'runner-blue', tag_list: ['blue']) - create(:ci_runner, :instance, description: 'runner-red', tag_list: ['red']) - end + let_it_be(:runner_1) { create(:ci_runner, :instance, description: 'runner-blue', tag_list: ['blue']) } + let_it_be(:runner_2) { create(:ci_runner, :instance, description: 'runner-2-blue', tag_list: ['blue']) } + let_it_be(:runner_3) { create(:ci_runner, :instance, description: 'runner-red', tag_list: ['red']) } - it 'shows tags suggestions' do + before do visit admin_runners_path + end + it 'shows tags suggestions' do open_filtered_search_suggestions('Tags') page.within(search_bar_selector) do @@ -367,23 +368,25 @@ RSpec.describe "Admin Runners" do end end - it 'shows correct runner when tag matches' do - visit admin_runners_path + it_behaves_like 'filters by tag' do + let(:tag) { 'blue' } + let(:found_runner) { runner_1.description } + let(:missing_runner) { runner_3.description } + end - expect(page).to have_content 'runner-blue' - expect(page).to have_content 'runner-red' + context 'when tag does not match' do + before do + input_filtered_search_filter_is_only('Tags', 'green') + end - input_filtered_search_filter_is_only('Tags', 'blue') + it_behaves_like 'shows no runners found' - expect(page).to have_content 'runner-blue' - expect(page).not_to have_content 'runner-red' + it 'shows no runner' do + expect(page).not_to have_content 'runner-blue' + end end it 'shows correct runner when tag is selected and search term is entered' do - create(:ci_runner, :instance, description: 'runner-2-blue', tag_list: ['blue']) - - visit admin_runners_path - input_filtered_search_filter_is_only('Tags', 'blue') expect(page).to have_content 'runner-blue' @@ -396,19 +399,6 @@ RSpec.describe "Admin Runners" do expect(page).not_to have_content 'runner-blue' expect(page).not_to have_content 'runner-red' end - - context 'when tag does not match' do - before do - visit admin_runners_path - input_filtered_search_filter_is_only('Tags', 'green') - end - - it_behaves_like 'shows no runners found' - - it 'shows no runner' do - expect(page).not_to have_content 'runner-blue' - end - end end it 'sorts by last contact date' do diff --git a/spec/features/groups/group_runners_spec.rb b/spec/features/groups/group_runners_spec.rb index b3e96932004..97c9103a054 100644 --- a/spec/features/groups/group_runners_spec.rb +++ b/spec/features/groups/group_runners_spec.rb @@ -189,6 +189,21 @@ RSpec.describe "Group Runners" do end end end + + describe 'filter by tag' do + let!(:runner_1) { create(:ci_runner, :group, groups: [group], description: 'runner-blue', tag_list: ['blue']) } + let!(:runner_2) { create(:ci_runner, :group, groups: [group], description: 'runner-red', tag_list: ['red']) } + + before do + visit group_runners_path(group) + end + + it_behaves_like 'filters by tag' do + let(:tag) { 'blue' } + let(:found_runner) { runner_1.description } + let(:missing_runner) { runner_2.description } + end + end end describe "Group runner show page", :js do |