Commit 21b49639 authored by Enrique Alcantara's avatar Enrique Alcantara

Update cluster info page feature tests

Update selectors and test assertions of the
cluster info page feature specs to reflect the
new tabs structure.
parent 8eb0cf62
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
%section.settings.no-animate{ class: ('expanded' if expanded) } %section.settings.no-animate{ class: ('expanded' if expanded) }
.settings-header .settings-header
%h4= s_('ClusterIntegration|Provider details') %h4= s_('ClusterIntegration|Provider details')
%button.btn.js-settings-toggle{ type: 'button' }
= expanded ? _('Collapse') : _('Expand')
%p= s_('ClusterIntegration|See and edit the details for your Kubernetes cluster') %p= s_('ClusterIntegration|See and edit the details for your Kubernetes cluster')
.settings-content .settings-content
= render 'provider_details_form', cluster: @cluster, platform: @cluster.platform_kubernetes, update_cluster_url_path: clusterable.cluster_path(@cluster) = render 'provider_details_form', cluster: @cluster, platform: @cluster.platform_kubernetes, update_cluster_url_path: clusterable.cluster_path(@cluster)
= form_for @cluster, url: clusterable.cluster_path(@cluster), as: :cluster, html: { class: 'cluster_integration_form' } do |field| = form_for @cluster, url: clusterable.cluster_path(@cluster), as: :cluster, html: { class: 'js-cluster-integration-form' } do |field|
= form_errors(@cluster) = form_errors(@cluster)
.form-group .form-group
.d-flex.align-items-center .d-flex.align-items-center
......
...@@ -22,15 +22,20 @@ describe 'Cluster Health board', :js, :use_clean_rails_memory_store_caching, :si ...@@ -22,15 +22,20 @@ describe 'Cluster Health board', :js, :use_clean_rails_memory_store_caching, :si
it 'shows cluster board section within the page' do it 'shows cluster board section within the page' do
visit cluster_path visit cluster_path
expect(page).to have_text('Cluster health') expect(page).to have_text('Health')
expect(page).to have_css('#cluster-health')
click_link 'Health'
expect(page).to have_css('.cluster-health-graphs')
end end
context 'no prometheus installed' do context 'no prometheus installed' do
it 'shows install prometheus message' do it 'shows install prometheus message' do
visit cluster_path visit cluster_path
expect(page).to have_text('you must first install Prometheus below') click_link 'Health'
expect(page).to have_text('you must first install Prometheus in the Applications tab')
end end
end end
...@@ -47,6 +52,9 @@ describe 'Cluster Health board', :js, :use_clean_rails_memory_store_caching, :si ...@@ -47,6 +52,9 @@ describe 'Cluster Health board', :js, :use_clean_rails_memory_store_caching, :si
it 'shows container and waiting for data message' do it 'shows container and waiting for data message' do
visit cluster_path visit cluster_path
click_link 'Health'
wait_for_requests wait_for_requests
expect(page).to have_css('.prometheus-graphs') expect(page).to have_css('.prometheus-graphs')
...@@ -61,6 +69,9 @@ describe 'Cluster Health board', :js, :use_clean_rails_memory_store_caching, :si ...@@ -61,6 +69,9 @@ describe 'Cluster Health board', :js, :use_clean_rails_memory_store_caching, :si
it 'renders charts' do it 'renders charts' do
visit cluster_path visit cluster_path
click_link 'Health'
wait_for_requests wait_for_requests
expect(page).to have_css('.prometheus-graphs') expect(page).to have_css('.prometheus-graphs')
......
...@@ -52,7 +52,7 @@ describe 'EE Clusters', :js do ...@@ -52,7 +52,7 @@ describe 'EE Clusters', :js do
before do before do
click_link 'default-cluster' click_link 'default-cluster'
fill_in 'cluster_environment_scope', with: 'production/*' fill_in 'cluster_environment_scope', with: 'production/*'
within '.cluster_integration_form' do within '.js-cluster-integration-form' do
click_button 'Save changes' click_button 'Save changes'
end end
end end
...@@ -135,7 +135,7 @@ describe 'EE Clusters', :js do ...@@ -135,7 +135,7 @@ describe 'EE Clusters', :js do
end end
it 'user sees a cluster details page' do it 'user sees a cluster details page' do
expect(page).to have_content('Enable or disable GitLab\'s connection to your Kubernetes cluster.') expect(page).to have_content('GitLab Integration')
expect(page.find_field('cluster[environment_scope]').value).to eq('staging/*') expect(page.find_field('cluster[environment_scope]').value).to eq('staging/*')
end end
end end
...@@ -144,7 +144,7 @@ describe 'EE Clusters', :js do ...@@ -144,7 +144,7 @@ describe 'EE Clusters', :js do
before do before do
click_link 'default-cluster' click_link 'default-cluster'
fill_in 'cluster_environment_scope', with: 'production/*' fill_in 'cluster_environment_scope', with: 'production/*'
within ".cluster_integration_form" do within ".js-cluster-integration-form" do
click_button 'Save changes' click_button 'Save changes'
end end
end end
......
...@@ -25,8 +25,8 @@ describe 'clusters/clusters/show' do ...@@ -25,8 +25,8 @@ describe 'clusters/clusters/show' do
it 'displays the Cluster health section' do it 'displays the Cluster health section' do
render render
expect(rendered).to have_selector('#cluster-health') expect(rendered).to have_selector('#cluster-health-tab')
expect(rendered).to have_content('Cluster health') expect(rendered).to have_content('Health')
end end
end end
......
...@@ -9,9 +9,13 @@ module QA ...@@ -9,9 +9,13 @@ module QA
module Show module Show
def self.prepended(page) def self.prepended(page)
page.module_eval do page.module_eval do
view 'ee/app/views/projects/clusters/_prometheus_graphs.html.haml' do view 'ee/app/views/clusters/clusters/_health.html.haml' do
element :cluster_health_section element :cluster_health_section
end end
view 'ee/app/views/clusters/clusters/_health_tab.html.haml' do
element :health, required: true
end
end end
end end
...@@ -21,10 +25,9 @@ module QA ...@@ -21,10 +25,9 @@ module QA
end end
end end
def has_cluster_health_title? def open_health
within_cluster_health_section do has_element?(:health, wait: 30)
has_text?('Cluster health') click_element :health
end
end end
def has_cluster_health_graphs? def has_cluster_health_graphs?
......
...@@ -10,17 +10,35 @@ module QA ...@@ -10,17 +10,35 @@ module QA
element :ingress_ip_address, 'id="ingress-endpoint"' # rubocop:disable QA/ElementWithPattern element :ingress_ip_address, 'id="ingress-endpoint"' # rubocop:disable QA/ElementWithPattern
end end
view 'app/views/clusters/clusters/_form.html.haml' do view 'app/views/clusters/clusters/_gitlab_integration_form.html.haml' do
element :integration_status_toggle, required: true element :integration_status_toggle, required: true
element :base_domain_field, required: true element :base_domain_field, required: true
element :save_changes_button, required: true element :save_changes_button, required: true
end end
view 'app/views/clusters/clusters/_details_tab.html.haml' do
element :details, required: true
end
view 'app/views/clusters/clusters/_applications_tab.html.haml' do
element :applications, required: true
end
view 'app/assets/javascripts/clusters/components/application_row.vue' do view 'app/assets/javascripts/clusters/components/application_row.vue' do
element :install_button element :install_button
element :uninstall_button element :uninstall_button
end end
def open_details
has_element?(:details, wait: 30)
click_element :details
end
def open_applications
has_element?(:applications, wait: 30)
click_element :applications
end
def install!(application_name) def install!(application_name)
within_element(application_name) do within_element(application_name) do
has_element?(:install_button, application: application_name, wait: 30) has_element?(:install_button, application: application_name, wait: 30)
......
...@@ -38,6 +38,9 @@ module QA ...@@ -38,6 +38,9 @@ module QA
# We must wait a few seconds for permissions to be set up correctly for new cluster # We must wait a few seconds for permissions to be set up correctly for new cluster
sleep 10 sleep 10
# Open applications tab
show.open_applications
# Helm must be installed before everything else # Helm must be installed before everything else
show.install!(:helm) show.install!(:helm)
show.await_installed(:helm) show.await_installed(:helm)
...@@ -52,6 +55,8 @@ module QA ...@@ -52,6 +55,8 @@ module QA
if @install_ingress if @install_ingress
populate(:ingress_ip) populate(:ingress_ip)
show.open_details
show.set_domain("#{ingress_ip}.nip.io") show.set_domain("#{ingress_ip}.nip.io")
show.save_domain show.save_domain
end end
......
...@@ -42,7 +42,7 @@ module QA ...@@ -42,7 +42,7 @@ module QA
def verify_cluster_health_graphs def verify_cluster_health_graphs
Page::Project::Operations::Kubernetes::Show.perform do |cluster| Page::Project::Operations::Kubernetes::Show.perform do |cluster|
cluster.refresh cluster.refresh
expect(cluster).to have_cluster_health_title cluster.open_health
cluster.wait_for_cluster_health cluster.wait_for_cluster_health
end end
......
...@@ -17,7 +17,7 @@ describe 'Clusterable > Show page' do ...@@ -17,7 +17,7 @@ describe 'Clusterable > Show page' do
it 'allow the user to set domain' do it 'allow the user to set domain' do
visit cluster_path visit cluster_path
within '#cluster-integration' do within '.js-cluster-integration-form' do
fill_in('cluster_base_domain', with: 'test.com') fill_in('cluster_base_domain', with: 'test.com')
click_on 'Save changes' click_on 'Save changes'
end end
...@@ -34,7 +34,7 @@ describe 'Clusterable > Show page' do ...@@ -34,7 +34,7 @@ describe 'Clusterable > Show page' do
end end
it 'shows help text with the domain as an alternative to custom domain' do it 'shows help text with the domain as an alternative to custom domain' do
within '#cluster-integration' do within '.js-cluster-integration-form' do
expect(find(cluster_ingress_help_text_selector)).not_to match_css(hide_modifier_selector) expect(find(cluster_ingress_help_text_selector)).not_to match_css(hide_modifier_selector)
end end
end end
...@@ -44,7 +44,7 @@ describe 'Clusterable > Show page' do ...@@ -44,7 +44,7 @@ describe 'Clusterable > Show page' do
it 'alternative to custom domain is not shown' do it 'alternative to custom domain is not shown' do
visit cluster_path visit cluster_path
within '#cluster-integration' do within '.js-cluster-integration-form' do
expect(find(cluster_ingress_help_text_selector)).to match_css(hide_modifier_selector) expect(find(cluster_ingress_help_text_selector)).to match_css(hide_modifier_selector)
end end
end end
...@@ -63,7 +63,7 @@ describe 'Clusterable > Show page' do ...@@ -63,7 +63,7 @@ describe 'Clusterable > Show page' do
end end
it 'is not able to edit the name, API url, CA certificate nor token' do it 'is not able to edit the name, API url, CA certificate nor token' do
within('#js-cluster-details') do within('.js-provider-details') do
cluster_name_field = find('.cluster-name') cluster_name_field = find('.cluster-name')
api_url_field = find('#cluster_platform_kubernetes_attributes_api_url') api_url_field = find('#cluster_platform_kubernetes_attributes_api_url')
ca_certificate_field = find('#cluster_platform_kubernetes_attributes_ca_cert') ca_certificate_field = find('#cluster_platform_kubernetes_attributes_ca_cert')
...@@ -77,6 +77,8 @@ describe 'Clusterable > Show page' do ...@@ -77,6 +77,8 @@ describe 'Clusterable > Show page' do
end end
it 'displays GKE information' do it 'displays GKE information' do
click_link 'Advanced Settings'
within('#advanced-settings-section') do within('#advanced-settings-section') do
expect(page).to have_content('Google Kubernetes Engine') expect(page).to have_content('Google Kubernetes Engine')
expect(page).to have_content('Manage your Kubernetes cluster by visiting') expect(page).to have_content('Manage your Kubernetes cluster by visiting')
...@@ -91,7 +93,7 @@ describe 'Clusterable > Show page' do ...@@ -91,7 +93,7 @@ describe 'Clusterable > Show page' do
end end
it 'is able to edit the name, API url, CA certificate and token' do it 'is able to edit the name, API url, CA certificate and token' do
within('#js-cluster-details') do within('.js-provider-details') do
cluster_name_field = find('#cluster_name') cluster_name_field = find('#cluster_name')
api_url_field = find('#cluster_platform_kubernetes_attributes_api_url') api_url_field = find('#cluster_platform_kubernetes_attributes_api_url')
ca_certificate_field = find('#cluster_platform_kubernetes_attributes_ca_cert') ca_certificate_field = find('#cluster_platform_kubernetes_attributes_ca_cert')
...@@ -105,6 +107,8 @@ describe 'Clusterable > Show page' do ...@@ -105,6 +107,8 @@ describe 'Clusterable > Show page' do
end end
it 'does not display GKE information' do it 'does not display GKE information' do
click_link 'Advanced Settings'
within('#advanced-settings-section') do within('#advanced-settings-section') do
expect(page).not_to have_content('Google Kubernetes Engine') expect(page).not_to have_content('Google Kubernetes Engine')
expect(page).not_to have_content('Manage your Kubernetes cluster by visiting') expect(page).not_to have_content('Manage your Kubernetes cluster by visiting')
......
...@@ -17,6 +17,12 @@ shared_examples "installing applications on a cluster" do ...@@ -17,6 +17,12 @@ shared_examples "installing applications on a cluster" do
context 'when cluster is created' do context 'when cluster is created' do
let(:cluster) { create(:cluster, :provided_by_gcp, *cluster_factory_args) } let(:cluster) { create(:cluster, :provided_by_gcp, *cluster_factory_args) }
before do
page.within('.js-edit-cluster-form') do
click_link 'Applications'
end
end
it 'user can install applications' do it 'user can install applications' do
wait_for_requests wait_for_requests
...@@ -29,6 +35,7 @@ shared_examples "installing applications on a cluster" do ...@@ -29,6 +35,7 @@ shared_examples "installing applications on a cluster" do
context 'when user installs Helm' do context 'when user installs Helm' do
before do before do
allow(ClusterInstallAppWorker).to receive(:perform_async) allow(ClusterInstallAppWorker).to receive(:perform_async)
wait_for_requests
page.within('.js-cluster-application-row-helm') do page.within('.js-cluster-application-row-helm') do
page.find(:css, '.js-cluster-application-install-button').click page.find(:css, '.js-cluster-application-install-button').click
......
...@@ -34,7 +34,7 @@ describe 'User Cluster', :js do ...@@ -34,7 +34,7 @@ describe 'User Cluster', :js do
it 'user sees a cluster details page' do it 'user sees a cluster details page' do
subject subject
expect(page).to have_content('Kubernetes cluster integration') expect(page).to have_content('GitLab Integration')
expect(page.find_field('cluster[name]').value).to eq('dev-cluster') expect(page.find_field('cluster[name]').value).to eq('dev-cluster')
expect(page.find_field('cluster[platform_kubernetes_attributes][api_url]').value) expect(page.find_field('cluster[platform_kubernetes_attributes][api_url]').value)
.to have_content('http://example.com') .to have_content('http://example.com')
...@@ -93,7 +93,7 @@ describe 'User Cluster', :js do ...@@ -93,7 +93,7 @@ describe 'User Cluster', :js do
context 'when user disables the cluster' do context 'when user disables the cluster' do
before do before do
page.find(:css, '.js-cluster-enable-toggle-area .js-project-feature-toggle').click page.find(:css, '.js-cluster-enable-toggle-area .js-project-feature-toggle').click
page.within('#cluster-integration') { click_button 'Save changes' } page.within('.js-cluster-integration-form') { click_button 'Save changes' }
end end
it 'user sees the successful message' do it 'user sees the successful message' do
...@@ -105,7 +105,7 @@ describe 'User Cluster', :js do ...@@ -105,7 +105,7 @@ describe 'User Cluster', :js do
before do before do
fill_in 'cluster_name', with: 'my-dev-cluster' fill_in 'cluster_name', with: 'my-dev-cluster'
fill_in 'cluster_platform_kubernetes_attributes_token', with: 'new-token' fill_in 'cluster_platform_kubernetes_attributes_token', with: 'new-token'
page.within('#js-cluster-details') { click_button 'Save changes' } page.within('.js-provider-details') { click_button 'Save changes' }
end end
it 'user sees the successful message' do it 'user sees the successful message' do
...@@ -117,6 +117,7 @@ describe 'User Cluster', :js do ...@@ -117,6 +117,7 @@ describe 'User Cluster', :js do
context 'when user destroys the cluster' do context 'when user destroys the cluster' do
before do before do
click_link 'Advanced Settings'
click_button 'Remove integration and resources' click_button 'Remove integration and resources'
fill_in 'confirm_cluster_name_input', with: cluster.name fill_in 'confirm_cluster_name_input', with: cluster.name
click_button 'Remove integration' click_button 'Remove integration'
......
...@@ -119,7 +119,7 @@ describe 'Gcp Cluster', :js, :do_not_mock_admin_mode do ...@@ -119,7 +119,7 @@ describe 'Gcp Cluster', :js, :do_not_mock_admin_mode do
context 'when user disables the cluster' do context 'when user disables the cluster' do
before do before do
page.find(:css, '.js-cluster-enable-toggle-area .js-project-feature-toggle').click page.find(:css, '.js-cluster-enable-toggle-area .js-project-feature-toggle').click
page.within('#cluster-integration') { click_button 'Save changes' } page.within('.js-cluster-integration-form') { click_button 'Save changes' }
end end
it 'user sees the successful message' do it 'user sees the successful message' do
...@@ -130,7 +130,7 @@ describe 'Gcp Cluster', :js, :do_not_mock_admin_mode do ...@@ -130,7 +130,7 @@ describe 'Gcp Cluster', :js, :do_not_mock_admin_mode do
context 'when user changes cluster parameters' do context 'when user changes cluster parameters' do
before do before do
fill_in 'cluster_platform_kubernetes_attributes_namespace', with: 'my-namespace' fill_in 'cluster_platform_kubernetes_attributes_namespace', with: 'my-namespace'
page.within('#js-cluster-details') { click_button 'Save changes' } page.within('.js-provider-details') { click_button 'Save changes' }
end end
it 'user sees the successful message' do it 'user sees the successful message' do
...@@ -141,6 +141,7 @@ describe 'Gcp Cluster', :js, :do_not_mock_admin_mode do ...@@ -141,6 +141,7 @@ describe 'Gcp Cluster', :js, :do_not_mock_admin_mode do
context 'when user destroys the cluster' do context 'when user destroys the cluster' do
before do before do
click_link 'Advanced Settings'
click_button 'Remove integration and resources' click_button 'Remove integration and resources'
fill_in 'confirm_cluster_name_input', with: cluster.name fill_in 'confirm_cluster_name_input', with: cluster.name
click_button 'Remove integration' click_button 'Remove integration'
......
...@@ -41,7 +41,7 @@ describe 'User Cluster', :js do ...@@ -41,7 +41,7 @@ describe 'User Cluster', :js do
it 'user sees a cluster details page' do it 'user sees a cluster details page' do
subject subject
expect(page).to have_content('Kubernetes cluster integration') expect(page).to have_content('GitLab Integration')
expect(page.find_field('cluster[name]').value).to eq('dev-cluster') expect(page.find_field('cluster[name]').value).to eq('dev-cluster')
expect(page.find_field('cluster[platform_kubernetes_attributes][api_url]').value) expect(page.find_field('cluster[platform_kubernetes_attributes][api_url]').value)
.to have_content('http://example.com') .to have_content('http://example.com')
...@@ -79,7 +79,7 @@ describe 'User Cluster', :js do ...@@ -79,7 +79,7 @@ describe 'User Cluster', :js do
context 'when user disables the cluster' do context 'when user disables the cluster' do
before do before do
page.find(:css, '.js-cluster-enable-toggle-area .js-project-feature-toggle').click page.find(:css, '.js-cluster-enable-toggle-area .js-project-feature-toggle').click
page.within('#cluster-integration') { click_button 'Save changes' } page.within('.js-cluster-integration-form') { click_button 'Save changes' }
end end
it 'user sees the successful message' do it 'user sees the successful message' do
...@@ -91,7 +91,7 @@ describe 'User Cluster', :js do ...@@ -91,7 +91,7 @@ describe 'User Cluster', :js do
before do before do
fill_in 'cluster_name', with: 'my-dev-cluster' fill_in 'cluster_name', with: 'my-dev-cluster'
fill_in 'cluster_platform_kubernetes_attributes_namespace', with: 'my-namespace' fill_in 'cluster_platform_kubernetes_attributes_namespace', with: 'my-namespace'
page.within('#js-cluster-details') { click_button 'Save changes' } page.within('.js-provider-details') { click_button 'Save changes' }
end end
it 'user sees the successful message' do it 'user sees the successful message' do
...@@ -103,6 +103,7 @@ describe 'User Cluster', :js do ...@@ -103,6 +103,7 @@ describe 'User Cluster', :js do
context 'when user destroys the cluster' do context 'when user destroys the cluster' do
before do before do
click_link 'Advanced Settings'
click_button 'Remove integration and resources' click_button 'Remove integration and resources'
fill_in 'confirm_cluster_name_input', with: cluster.name fill_in 'confirm_cluster_name_input', with: cluster.name
click_button 'Remove integration' click_button 'Remove integration'
......
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