debian-mirror-gitlab/spec/features/issues/incident_issue_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

101 lines
3.3 KiB
Ruby
Raw Normal View History

2020-11-24 15:15:51 +05:30
# frozen_string_literal: true
require 'spec_helper'
2023-03-04 22:38:38 +05:30
RSpec.describe 'Incident Detail', :js, feature_category: :team_planning do
2021-09-30 23:02:18 +05:30
let_it_be(:project) { create(:project, :public) }
let_it_be(:payload) do
{
'title' => 'Alert title',
'start_time' => '2020-04-27T10:10:22.265949279Z',
'custom' => {
'alert' => {
'fields' => %w[one two]
}
},
'yet' => {
'another' => 73
}
}
end
let_it_be(:user) { create(:user) }
let_it_be(:started_at) { Time.now.rfc3339 }
let_it_be(:alert) { create(:alert_management_alert, project: project, payload: payload, started_at: started_at) }
let_it_be(:incident) { create(:incident, project: project, description: 'hello', alert_management_alert: alert) }
2020-11-24 15:15:51 +05:30
context 'when user displays the incident' do
2021-09-30 23:02:18 +05:30
before do
project.add_developer(user)
sign_in(user)
2020-11-24 15:15:51 +05:30
2023-04-23 21:23:45 +05:30
visit incident_project_issues_path(project, incident)
2020-11-24 15:15:51 +05:30
wait_for_requests
2021-09-30 23:02:18 +05:30
end
2020-11-24 15:15:51 +05:30
2021-09-30 23:02:18 +05:30
it 'shows incident and alert data' do
2020-11-24 15:15:51 +05:30
page.within('.issuable-details') do
incident_tabs = find('[data-testid="incident-tabs"]')
2021-09-30 23:02:18 +05:30
aggregate_failures 'shows title and Summary tab' do
2022-05-07 20:08:51 +05:30
expect(find('h1')).to have_content(incident.title)
2021-09-30 23:02:18 +05:30
expect(incident_tabs).to have_content('Summary')
expect(incident_tabs).to have_content(incident.description)
end
aggregate_failures 'shows the incident highlight bar' do
expect(incident_tabs).to have_content('Alert events: 1')
expect(incident_tabs).to have_content('Original alert: #1')
end
2022-08-27 11:52:29 +05:30
aggregate_failures 'when on summary tab (default tab)' do
2022-06-21 17:19:12 +05:30
hidden_items = find_all('.js-issue-widgets')
2023-06-20 00:43:36 +05:30
# Description footer + Linked Issues/MRs + comment box + emoji block
expect(hidden_items.count).to eq(4)
2022-06-21 17:19:12 +05:30
expect(hidden_items).to all(be_visible)
2022-08-27 11:52:29 +05:30
edit_button = find_all('[aria-label="Edit title and description"]')
expect(edit_button).to all(be_visible)
2022-06-21 17:19:12 +05:30
end
2022-07-23 23:45:48 +05:30
2022-08-27 11:52:29 +05:30
aggregate_failures 'shows the Alert details tab' do
click_link 'Alert details'
2022-07-23 23:45:48 +05:30
2022-08-27 11:52:29 +05:30
expect(incident_tabs).to have_content('"title": "Alert title"')
expect(incident_tabs).to have_content('"yet.another": 73')
2022-07-23 23:45:48 +05:30
2022-08-27 11:52:29 +05:30
# does not show the linked issues and notes/comment components' do
2022-11-25 23:54:43 +05:30
hidden_items = find_all('.js-issue-widgets', wait: false)
2022-07-23 23:45:48 +05:30
# Linked Issues/MRs and comment box are hidden on page
expect(hidden_items.count).to eq(0)
2022-08-27 11:52:29 +05:30
# does not show the edit title and description button
2022-11-25 23:54:43 +05:30
edit_button = find_all('[aria-label="Edit title and description"]', wait: false)
2022-08-27 11:52:29 +05:30
expect(edit_button.count).to eq(0)
2022-07-23 23:45:48 +05:30
end
end
end
context 'when on timeline events tab from issue route' do
before do
visit project_issue_path(project, incident)
wait_for_requests
2022-11-25 23:54:43 +05:30
2022-07-23 23:45:48 +05:30
click_link 'Timeline'
2022-11-25 23:54:43 +05:30
wait_for_requests
2022-07-23 23:45:48 +05:30
end
2022-08-27 11:52:29 +05:30
it 'does not show the linked issues and notes/comment components' do
2022-07-23 23:45:48 +05:30
page.within('.issuable-details') do
2022-11-25 23:54:43 +05:30
hidden_items = find_all('.js-issue-widgets', wait: false)
2022-07-23 23:45:48 +05:30
# Linked Issues/MRs and comment box are hidden on page
expect(hidden_items.count).to eq(0)
end
end
end
2020-11-24 15:15:51 +05:30
end
end