blob: 661c737141bdedc44b4b0c1387d4149bdb93ecba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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
|