summaryrefslogtreecommitdiff
path: root/spec/features/incidents/user_filters_incidents_by_status_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-21 07:08:36 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-21 07:08:36 +0000
commit48aff82709769b098321c738f3444b9bdaa694c6 (patch)
treee00c7c43e2d9b603a5a6af576b1685e400410dee /spec/features/incidents/user_filters_incidents_by_status_spec.rb
parent879f5329ee916a948223f8f43d77fba4da6cd028 (diff)
downloadgitlab-ce-48aff82709769b098321c738f3444b9bdaa694c6.tar.gz
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'spec/features/incidents/user_filters_incidents_by_status_spec.rb')
-rw-r--r--spec/features/incidents/user_filters_incidents_by_status_spec.rb59
1 files changed, 59 insertions, 0 deletions
diff --git a/spec/features/incidents/user_filters_incidents_by_status_spec.rb b/spec/features/incidents/user_filters_incidents_by_status_spec.rb
new file mode 100644
index 00000000000..661c737141b
--- /dev/null
+++ b/spec/features/incidents/user_filters_incidents_by_status_spec.rb
@@ -0,0 +1,59 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'User filters Incident Management table by status', :js do
+ let_it_be(:project) { create(:project) }
+ let_it_be(:developer) { create(:user) }
+
+ before_all do
+ project.add_developer(developer)
+
+ create_list(:incident, 2, project: project, state: 'opened')
+ create(:incident, project: project, state: 'closed')
+ end
+
+ before do
+ sign_in(developer)
+
+ visit project_incidents_path(project)
+ wait_for_requests
+ end
+
+ context 'when a developer displays the incident list they can filter the table by an incident status' do
+ def the_page_shows_the_nav_text_with_correct_count
+ expect(page).to have_selector('.gl-table')
+ expect(page).to have_content('All 3')
+ expect(page).to have_content('Open 2')
+ expect(page).to have_content('Closed 1')
+ end
+
+ it 'shows the incident table items with incident status of Open by default' do
+ expect(find('.gl-tab-nav-item-active')).to have_content('Open 2')
+ expect(all('tbody tr').count).to be(2)
+
+ the_page_shows_the_nav_text_with_correct_count
+ end
+
+ it 'shows the incident table items with incident status of Closed' do
+ find('.gl-tab-nav-item', text: 'Closed').click
+ wait_for_requests
+
+ expect(find('.gl-tab-nav-item-active')).to have_content('Closed 1')
+ expect(all('tbody tr').count).to be(1)
+
+ the_page_shows_the_nav_text_with_correct_count
+ end
+
+ it 'shows the incident table items with all status' do
+ find('.gl-tab-nav-item', text: 'All').click
+ wait_for_requests
+
+ expect(find('.gl-tab-nav-item-active')).to have_content('All 3')
+ expect(all('[data-testid="incident-assignees"]').count).to be(3)
+ expect(all('tbody tr').count).to be(3)
+
+ the_page_shows_the_nav_text_with_correct_count
+ end
+ end
+end