Commit 4a7c8e34 authored by svistas's avatar svistas

Fix incident template spec

Prior to this change, the incident test
had to be removed due to investigation on
a new UI integration.

This change fixes the existing test and
also adds a more complete test, including the
incident menu
parent 6eed345b
...@@ -242,6 +242,7 @@ export default { ...@@ -242,6 +242,7 @@ export default {
<gl-button <gl-button
class="gl-my-3 gl-mr-5 create-incident-button" class="gl-my-3 gl-mr-5 create-incident-button"
data-testid="createIncidentBtn" data-testid="createIncidentBtn"
data-qa-selector="create_incident_button"
:loading="redirecting" :loading="redirecting"
:disabled="redirecting" :disabled="redirecting"
category="primary" category="primary"
......
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
- if project_nav_tab?(:incidents) - if project_nav_tab?(:incidents)
= nav_link(controller: :incidents) do = nav_link(controller: :incidents) do
= link_to project_incidents_path(@project), title: _('Incidents') do = link_to project_incidents_path(@project), title: _('Incidents'), data: { qa_selector: 'operations_incidents_link' } do
%span %span
= _('Incidents') = _('Incidents')
......
...@@ -354,6 +354,10 @@ module QA ...@@ -354,6 +354,10 @@ module QA
module Metrics module Metrics
autoload :Show, 'qa/page/project/operations/metrics/show' autoload :Show, 'qa/page/project/operations/metrics/show'
end end
module Incidents
autoload :Index, 'qa/page/project/operations/incidents/index'
end
end end
module Wiki module Wiki
......
...@@ -80,6 +80,10 @@ module QA ...@@ -80,6 +80,10 @@ module QA
select_filter_with_text('Show history only') select_filter_with_text('Show history only')
end end
def has_metrics_unfurled?
has_element?(:prometheus_graph_widgets, wait: 30)
end
private private
def select_filter_with_text(text) def select_filter_with_text(text)
......
# frozen_string_literal: true
module QA
module Page
module Project
module Operations
module Incidents
class Index < Page::Base
view 'app/assets/javascripts/incidents/components/incidents_list.vue' do
element :create_incident_button
end
def create_incident
click_element :create_incident_button
end
end
end
end
end
end
end
...@@ -17,6 +17,7 @@ module QA ...@@ -17,6 +17,7 @@ module QA
element :operations_link element :operations_link
element :operations_environments_link element :operations_environments_link
element :operations_metrics_link element :operations_metrics_link
element :operations_incidents_link
end end
end end
end end
...@@ -45,6 +46,14 @@ module QA ...@@ -45,6 +46,14 @@ module QA
end end
end end
def go_to_operations_incidents
hover_operations do
within_submenu do
click_element(:operations_incidents_link)
end
end
end
private private
def hover_operations def hover_operations
......
...@@ -36,7 +36,7 @@ module QA ...@@ -36,7 +36,7 @@ module QA
end end
end end
it 'creates and sets an incident template' do it 'creates an incident template and opens an incident with template applied' do
create_incident_template create_incident_template
Page::Project::Menu.perform(&:go_to_operations_settings) Page::Project::Menu.perform(&:go_to_operations_settings)
...@@ -48,6 +48,12 @@ module QA ...@@ -48,6 +48,12 @@ module QA
incident_settings.save_incident_settings incident_settings.save_incident_settings
end end
end end
create_incident_issue
Page::Project::Issue::Show.perform do |issue|
expect(issue).to have_metrics_unfurled
end
end end
private private
...@@ -156,6 +162,19 @@ module QA ...@@ -156,6 +162,19 @@ module QA
form.commit_changes form.commit_changes
end end
end end
def create_incident_issue
Page::Project::Menu.perform(&:go_to_operations_incidents)
Page::Project::Operations::Incidents::Index.perform do |incidents_page|
incidents_page.create_incident
end
Page::Project::Issue::New.perform do |new_issue|
new_issue.fill_title('test incident')
new_issue.create_new_issue
end
end
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment