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 {
<gl-button
class="gl-my-3 gl-mr-5 create-incident-button"
data-testid="createIncidentBtn"
data-qa-selector="create_incident_button"
:loading="redirecting"
:disabled="redirecting"
category="primary"
......
......@@ -236,7 +236,7 @@
- if project_nav_tab?(:incidents)
= 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
= _('Incidents')
......
......@@ -354,6 +354,10 @@ module QA
module Metrics
autoload :Show, 'qa/page/project/operations/metrics/show'
end
module Incidents
autoload :Index, 'qa/page/project/operations/incidents/index'
end
end
module Wiki
......
......@@ -80,6 +80,10 @@ module QA
select_filter_with_text('Show history only')
end
def has_metrics_unfurled?
has_element?(:prometheus_graph_widgets, wait: 30)
end
private
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
element :operations_link
element :operations_environments_link
element :operations_metrics_link
element :operations_incidents_link
end
end
end
......@@ -45,6 +46,14 @@ module QA
end
end
def go_to_operations_incidents
hover_operations do
within_submenu do
click_element(:operations_incidents_link)
end
end
end
private
def hover_operations
......
......@@ -36,7 +36,7 @@ module QA
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
Page::Project::Menu.perform(&:go_to_operations_settings)
......@@ -48,6 +48,12 @@ module QA
incident_settings.save_incident_settings
end
end
create_incident_issue
Page::Project::Issue::Show.perform do |issue|
expect(issue).to have_metrics_unfurled
end
end
private
......@@ -156,6 +162,19 @@ module QA
form.commit_changes
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
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