From a1094e2316936ed455766feb7e3e3cdafcd29b53 Mon Sep 17 00:00:00 2001 From: Alexis Reigel Date: Mon, 11 Jun 2018 16:25:53 +0200 Subject: add type filter to admin runners page --- spec/features/admin/admin_runners_spec.rb | 74 +++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 13 deletions(-) (limited to 'spec/features/admin') diff --git a/spec/features/admin/admin_runners_spec.rb b/spec/features/admin/admin_runners_spec.rb index 026dea8d22c..5db232e4365 100644 --- a/spec/features/admin/admin_runners_spec.rb +++ b/spec/features/admin/admin_runners_spec.rb @@ -73,24 +73,72 @@ describe "Admin Runners" do expect(page).to have_text 'No runners found' end + + it 'shows correct runner when status is selected and search term is entered' do + create(:ci_runner, description: 'runner-a-1', active: true) + create(:ci_runner, description: 'runner-a-2', active: false) + create(:ci_runner, description: 'runner-b-1', active: true) + + visit admin_runners_path + + input_filtered_search_keys('status:active') + expect(page).to have_content 'runner-a-1' + expect(page).to have_content 'runner-b-1' + expect(page).not_to have_content 'runner-a-2' + + input_filtered_search_keys('status:active runner-a') + expect(page).to have_content 'runner-a-1' + expect(page).not_to have_content 'runner-b-1' + expect(page).not_to have_content 'runner-a-2' + end end - it 'shows correct runner when status is selected and search term is entered', :js do - create(:ci_runner, description: 'runner-a-1', active: true) - create(:ci_runner, description: 'runner-a-2', active: false) - create(:ci_runner, description: 'runner-b-1', active: true) + describe 'filter by type', :js do + it 'shows correct runner when type matches' do + create :ci_runner, :project, description: 'runner-project' + create :ci_runner, :group, description: 'runner-group' - visit admin_runners_path + visit admin_runners_path + + expect(page).to have_content 'runner-project' + expect(page).to have_content 'runner-group' - input_filtered_search_keys('status:active') - expect(page).to have_content 'runner-a-1' - expect(page).to have_content 'runner-b-1' - expect(page).not_to have_content 'runner-a-2' + input_filtered_search_keys('type:project_type') + expect(page).to have_content 'runner-project' + expect(page).not_to have_content 'runner-group' + end + + it 'shows no runner when type does not match' do + create :ci_runner, :project, description: 'runner-project' + create :ci_runner, :group, description: 'runner-group' - input_filtered_search_keys('status:active runner-a') - expect(page).to have_content 'runner-a-1' - expect(page).not_to have_content 'runner-b-1' - expect(page).not_to have_content 'runner-a-2' + visit admin_runners_path + + input_filtered_search_keys('type:instance_type') + + expect(page).not_to have_content 'runner-project' + expect(page).not_to have_content 'runner-group' + + expect(page).to have_text 'No runners found' + end + + it 'shows correct runner when type is selected and search term is entered' do + create :ci_runner, :project, description: 'runner-a-1' + create :ci_runner, :instance, description: 'runner-a-2' + create :ci_runner, :project, description: 'runner-b-1' + + visit admin_runners_path + + input_filtered_search_keys('type:project_type') + expect(page).to have_content 'runner-a-1' + expect(page).to have_content 'runner-b-1' + expect(page).not_to have_content 'runner-a-2' + + input_filtered_search_keys('type:project_type runner-a') + expect(page).to have_content 'runner-a-1' + expect(page).not_to have_content 'runner-b-1' + expect(page).not_to have_content 'runner-a-2' + end end it 'sorts by last contact date', :js do -- cgit v1.2.1