Commit 61265d9b authored by Peter Leitzen's avatar Peter Leitzen Committed by Mark Lapierre

Add end-to-end test showing Cluster health graphs

This test may take some time as we install Kubernetes, Prometheus and
wait for the "Cluster health" graphs to appear.
parent 078de582
- return unless show_cluster_health_graphs?
%section.settings.no-animate.expanded.cluster-health-graphs#cluster-health
%section.settings.no-animate.expanded.cluster-health-graphs.qa-cluster-health-section#cluster-health
%h4= s_('ClusterIntegration|Cluster health')
- if @cluster&.application_prometheus_available?
......
......@@ -21,6 +21,10 @@ module QA
element :save_domain
end
view 'ee/app/views/projects/clusters/_prometheus_graphs.html.haml' do
element :cluster_health_section
end
def install!(application_name)
within(".js-cluster-application-row-#{application_name}") do
page.has_button?('Install', wait: 30)
......@@ -51,6 +55,30 @@ module QA
def save_domain
click_element :save_domain
end
def wait_for_cluster_health
wait(max: 120, interval: 3, reload: true) do
has_cluster_health_graphs?
end
end
def has_cluster_health_title?
within_cluster_health_section do
has_text?('Cluster health')
end
end
def has_cluster_health_graphs?
within_cluster_health_section do
has_text?('CPU Usage')
end
end
def within_cluster_health_section
within_element :cluster_health_section do
yield
end
end
end
end
end
......
# frozen_string_literal: true
module QA
context 'Monitor' do
describe 'Cluster health graphs', :orchestrated, :kubernetes do
before do
@cluster = Service::KubernetesCluster.new.create!
end
after do
@cluster&.remove!
end
it 'installs Kubernetes and Prometheus' do
login
create_project
create_kubernetes_cluster
verify_cluster_health_graphs
end
private
def login
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_credentials)
end
def create_project
@project = Resource::Project.fabricate_via_api! do |p|
p.name = 'cluster-health'
p.description = 'Cluster health'
end
end
def create_kubernetes_cluster
Resource::KubernetesCluster.fabricate_via_browser_ui! do |c|
c.project = @project
c.cluster = @cluster
c.install_helm_tiller = true
c.install_prometheus = true
end
end
def verify_cluster_health_graphs
Page::Project::Operations::Kubernetes::Show.perform do |cluster|
cluster.refresh
expect(cluster).to have_cluster_health_title
cluster.wait_for_cluster_health
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