summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorAlexis Reigel <alexis.reigel.ext@siemens.com>2018-06-08 13:26:41 +0200
committerAlexis Reigel <alexis.reigel.ext@siemens.com>2018-08-20 17:15:11 +0200
commit16d12491c538121a4634ae69403cd66497bee82a (patch)
tree99c54aff76f92e4272088e46ac6f20ae419e4547 /spec
parentbbc305b1a24785d780fe0672d9e49f2c53af463b (diff)
downloadgitlab-ce-16d12491c538121a4634ae69403cd66497bee82a.tar.gz
add status filter to admin runners page
Diffstat (limited to 'spec')
-rw-r--r--spec/features/admin/admin_runners_spec.rb96
1 files changed, 87 insertions, 9 deletions
diff --git a/spec/features/admin/admin_runners_spec.rb b/spec/features/admin/admin_runners_spec.rb
index 5623e47eadf..d44cea47a9f 100644
--- a/spec/features/admin/admin_runners_spec.rb
+++ b/spec/features/admin/admin_runners_spec.rb
@@ -12,13 +12,11 @@ describe "Admin Runners" do
let(:pipeline) { create(:ci_pipeline) }
context "when there are runners" do
- before do
+ it 'has all necessary texts' do
runner = FactoryBot.create(:ci_runner, contacted_at: Time.now)
FactoryBot.create(:ci_build, pipeline: pipeline, runner_id: runner.id)
visit admin_runners_path
- end
- it 'has all necessary texts' do
expect(page).to have_text "Setup a shared Runner manually"
expect(page).to have_text "Runners currently online: 1"
end
@@ -27,25 +25,105 @@ describe "Admin Runners" do
before do
FactoryBot.create :ci_runner, description: 'runner-foo'
FactoryBot.create :ci_runner, description: 'runner-bar'
+
+ visit admin_runners_path
end
it 'shows correct runner when description matches' do
- search_form = find('#runners-search')
- search_form.fill_in 'search', with: 'runner-foo'
- search_form.click_button 'Search'
+ within '#runners-search' do
+ fill_in 'search', with: 'runner-foo'
+ click_button 'Search'
+ end
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
- search_form = find('#runners-search')
- search_form.fill_in 'search', with: 'runner-baz'
- search_form.click_button 'Search'
+ within '#runners-search' do
+ fill_in 'search', with: 'runner-baz'
+ click_button 'Search'
+ end
expect(page).to have_text 'No runners found'
end
end
+
+ describe 'filter by status', :js 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
+
+ visit admin_runners_path
+
+ expect(page).to have_content 'runner-active'
+ expect(page).to have_content 'runner-paused'
+
+ click_button 'Status'
+ click_link 'Active'
+ expect(page).to have_content 'runner-active'
+ expect(page).not_to have_content 'runner-paused'
+ end
+
+ it 'shows no runner when status does not match' do
+ FactoryBot.create :ci_runner, :online, description: 'runner-active', active: true
+ FactoryBot.create :ci_runner, :online, description: 'runner-paused', active: false
+
+ visit admin_runners_path
+
+ click_button 'Status'
+ click_link 'Offline'
+
+ expect(page).not_to have_content 'runner-active'
+ expect(page).not_to have_content 'runner-paused'
+
+ expect(page).to have_text 'No runners found'
+ 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'
+
+ 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
+
+ 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'
+
+ 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
+ end
end
context "when there are no runners" do