Commit 50d9cc6d authored by Filipa Lacerda's avatar Filipa Lacerda

Fix broken tests

parent e89fad52
...@@ -2,17 +2,16 @@ ...@@ -2,17 +2,16 @@
.fade-left= icon("angle-left") .fade-left= icon("angle-left")
.fade-right= icon("angle-right") .fade-right= icon("angle-right")
%ul.nav-links.scrolling-tabs %ul.nav-links.scrolling-tabs
%li{ class: ('active' if @scope == 'enabled') }> %li{ class: ('active' if @scope == 'active') }>
= link_to project_clusters_path(@project, scope: :enabled), class: "js-active-tab" do = link_to project_clusters_path(@project, scope: :active), class: "js-active-tab" do
= s_("ClusterIntegration|Active") = s_("ClusterIntegration|Active")
%span.badge= @active_count %span.badge= @active_count
%li{ class: ('active' if @scope == 'inactive') }>
%li{ class: ('active' if @scope == 'disabled') }> = link_to project_clusters_path(@project, scope: :inactive), class: "js-inactive-tab" do
= link_to project_clusters_path(@project, scope: :disabled), class: "js-inactive-tab #{'active' if @scope == 'disabled'}" do
= s_("ClusterIntegration|Inactive") = s_("ClusterIntegration|Inactive")
%span.badge= @inactive_count %span.badge= @inactive_count
%li{ class: ('active' if @scope.nil? || @scope == 'all') }> %li{ class: ('active' if @scope.nil? || @scope == 'all') }>
= link_to project_clusters_path(@project, scope: :all), class: "js-all-tab #{'active' if @scope == 'all' || @scope.nil?}" do = link_to project_clusters_path(@project), class: "js-all-tab" do
= s_("ClusterIntegration|All") = s_("ClusterIntegration|All")
%span.badge= @all_count %span.badge= @all_count
.pull-right.nav-bar-right .pull-right.nav-bar-right
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
- page_title "Clusters" - page_title "Clusters"
.clusters-container .clusters-container
- if @clusters.empty? && @scope == 'all' - if @clusters.empty? && (@scope.nil? || @scope == 'all')
= render "empty_state" = render "empty_state"
- elsif @clusters.empty? && @scope != 'all' - elsif @clusters.empty? && (!@scope.nil? || @scope != 'all')
= render "tabs" = render "tabs"
.prepend-top-20.text-center .prepend-top-20.text-center
= s_("ClusterIntegration|There are no clusters to show") = s_("ClusterIntegration|There are no clusters to show")
......
...@@ -24,11 +24,12 @@ feature 'Clusters', :js do ...@@ -24,11 +24,12 @@ feature 'Clusters', :js do
visit project_clusters_path(project) visit project_clusters_path(project)
end end
it 'user sees empty state' do it 'sees empty state' do
expect(page).to have_link('Add cluster') expect(page).to have_link('Add cluster')
expect(page).to have_selector('.empty-state')
end end
context 'when user opens opens create on gke page' do context 'when user opens create on gke page' do
before do before do
click_link 'Add cluster' click_link 'Add cluster'
click_link 'Create on GKE' click_link 'Create on GKE'
...@@ -95,6 +96,7 @@ feature 'Clusters', :js do ...@@ -95,6 +96,7 @@ feature 'Clusters', :js do
end end
it 'user sees a table with one cluster' do it 'user sees a table with one cluster' do
# One is the header row, the other the cluster row
expect(page).to have_selector('.gl-responsive-table-row', count: 2) expect(page).to have_selector('.gl-responsive-table-row', count: 2)
end end
...@@ -120,19 +122,29 @@ feature 'Clusters', :js do ...@@ -120,19 +122,29 @@ feature 'Clusters', :js do
context 'with sucessfull request' do context 'with sucessfull request' do
it 'user sees updated cluster' do it 'user sees updated cluster' do
page.find('.js-toggle-cluster-list').click
wait_for_requests
expect(page).not_to have_selector('.is-checked')
end end
end end
context 'with failed request' do context 'with failed request' do
it 'user sees not update cluster and error message' do it 'user sees not update cluster and error message' do
# Cluster was disabled in the last test
page.find('.js-toggle-cluster-list').click
Clusters::Cluster.last.provider.make_errored!('Something wrong!')
expect(page).not_to have_selector('.js-toggle-cluster-list.is-checked')
end end
end end
end end
context 'when user clicks on a cluster' do context 'when user clicks on a cluster' do
before do before do
# TODO: Replace with Click on cluster after frontend implements list click_link cluster.name
visit project_cluster_path(project, cluster)
end end
it 'user sees an cluster details page' do it 'user sees an cluster details page' do
......
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