Welcome to mirror list, hosted at ThFree Co, Russian Federation.

user_filters_alerts_by_status_spec.rb « alert_management « features « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c3dab05550e19402f9c50d1dadebb7aee0b10fac (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'User filters Alert Management table by status', :js, feature_category: :incident_management do
  let_it_be(:project) { create(:project) }
  let_it_be(:developer) { create(:user) }
  let_it_be(:alert1, reload: true) { create(:alert_management_alert, :triggered, project: project) }
  let_it_be(:alert2, reload: true) { create(:alert_management_alert, :acknowledged, project: project) }
  let_it_be(:alert3, reload: true) { create(:alert_management_alert, :acknowledged, project: project) }

  before_all do
    project.add_developer(developer)
  end

  before do
    sign_in(developer)

    visit project_alert_management_index_path(project)
    wait_for_requests
  end

  context 'when a developer displays the alert list and the alert service is enabled they can filter the table by an alert status' do
    it 'shows the alert table items with alert status of Open by default' do
      expect(page).to have_selector('.gl-table')
      expect(page).to have_content('Open 3')
    end

    it 'shows the alert table items with alert status of Acknowledged' do
      find('.gl-tab-nav-item', text: 'Acknowledged').click

      expect(page).to have_selector('.gl-tab-nav-item-active')
      expect(find('.gl-tab-nav-item-active')).to have_content('Acknowledged 2')
      expect(all('.dropdown-menu-selectable').count).to be(2)
    end

    it 'shows the alert table items with alert status of Triggered' do
      find('.gl-tab-nav-item', text: 'Triggered').click
      wait_for_requests

      expect(page).to have_selector('.gl-tab-nav-item-active')
      expect(find('.gl-tab-nav-item-active')).to have_content('Triggered 1')
      expect(all('.dropdown-menu-selectable').count).to be(1)
    end

    it 'shows the an empty table for a status with no alerts' do
      find('.gl-tab-nav-item', text: 'Resolved').click
      wait_for_requests

      expect(page).to have_selector('.gl-tab-nav-item-active')
      expect(find('.gl-tab-nav-item-active')).to have_content('Resolved 0')
      expect(page).to have_content('No alerts to display.')
    end
  end
end