diff options
| author | Alexis Reigel <alexis.reigel.ext@siemens.com> | 2018-07-03 19:28:09 +0200 |
|---|---|---|
| committer | Alexis Reigel <alexis.reigel.ext@siemens.com> | 2018-08-29 15:02:54 +0200 |
| commit | 89b30999c294d2e344d095e635d72aa16d108a2b (patch) | |
| tree | b29241e1c81ff277d8df531071429d924546b4a7 /spec/features | |
| parent | d4387d88767d76666e32feaab9deb48d43b6249a (diff) | |
| download | gitlab-ce-89b30999c294d2e344d095e635d72aa16d108a2b.tar.gz | |
use filtered search bar for admin runners
Diffstat (limited to 'spec/features')
| -rw-r--r-- | spec/features/admin/admin_runners_spec.rb | 73 |
1 files changed, 20 insertions, 53 deletions
diff --git a/spec/features/admin/admin_runners_spec.rb b/spec/features/admin/admin_runners_spec.rb index d44cea47a9f..c4231c1ea42 100644 --- a/spec/features/admin/admin_runners_spec.rb +++ b/spec/features/admin/admin_runners_spec.rb @@ -1,7 +1,8 @@ require 'spec_helper' -describe "Admin Runners" do +describe "Admin Runners", :js do include StubENV + include FilteredSearchHelpers before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') @@ -30,26 +31,20 @@ describe "Admin Runners" do end it 'shows correct runner when description matches' do - within '#runners-search' do - fill_in 'search', with: 'runner-foo' - click_button 'Search' - end + input_filtered_search_keys('runner-foo') expect(page).to have_content("runner-foo") expect(page).not_to have_content("runner-bar") end it 'shows no runner when description does not match' do - within '#runners-search' do - fill_in 'search', with: 'runner-baz' - click_button 'Search' - end + input_filtered_search_keys('runner-baz') expect(page).to have_text 'No runners found' end end - describe 'filter by status', :js do + describe 'filter by status' do it 'shows correct runner when status matches' do FactoryBot.create :ci_runner, description: 'runner-active', active: true FactoryBot.create :ci_runner, description: 'runner-paused', active: false @@ -59,8 +54,7 @@ describe "Admin Runners" do expect(page).to have_content 'runner-active' expect(page).to have_content 'runner-paused' - click_button 'Status' - click_link 'Active' + input_filtered_search_keys('status:active') expect(page).to have_content 'runner-active' expect(page).not_to have_content 'runner-paused' end @@ -71,8 +65,7 @@ describe "Admin Runners" do visit admin_runners_path - click_button 'Status' - click_link 'Offline' + input_filtered_search_keys('status:offline') expect(page).not_to have_content 'runner-active' expect(page).not_to have_content 'runner-paused' @@ -81,48 +74,22 @@ describe "Admin Runners" do end end - describe 'filter by status and enter search term', :js do - before do - FactoryBot.create :ci_runner, description: 'runner-a-1', active: true - FactoryBot.create :ci_runner, description: 'runner-a-2', active: false - FactoryBot.create :ci_runner, description: 'runner-b-1', active: true - - visit admin_runners_path - end - - it 'shows correct runner when status is selected first and then search term is entered' do - click_button 'Status' - click_link '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' + it 'shows correct runner when status is selected and search term is entered' do + FactoryBot.create :ci_runner, description: 'runner-a-1', active: true + FactoryBot.create :ci_runner, description: 'runner-a-2', active: false + FactoryBot.create :ci_runner, description: 'runner-b-1', active: true - within '#runners-search' do - fill_in 'search', with: 'runner-a' - click_button 'Search' - end - - 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 - - it 'shows correct runner when search term is entered first and then status is selected' do - within '#runners-search' do - fill_in 'search', with: 'runner-a' - click_button 'Search' - end + visit admin_runners_path - expect(page).to have_content 'runner-a-1' - expect(page).to have_content 'runner-a-2' - expect(page).not_to have_content 'runner-b-1' + 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' - click_button 'Status' - click_link 'Active' - 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 + 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 |
