Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoão Cunha <j.a.cunha@gmail.com>2019-03-06 15:48:45 +0300
committerJoão Cunha <j.a.cunha@gmail.com>2019-03-06 15:48:45 +0300
commitc08beb5051224dbee52716b0fa9c4dd9fedad5ad (patch)
tree5d89cc3c69ba31c01ec898e811ad7a31cf519e48 /spec/features
parent34d837b575350b98a8d3809556a07473ba7d0d54 (diff)
Don't use sleep in feature specs
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/projects/clusters/applications_spec.rb33
1 files changed, 8 insertions, 25 deletions
diff --git a/spec/features/projects/clusters/applications_spec.rb b/spec/features/projects/clusters/applications_spec.rb
index 3784203a6b4..713e25cdcb2 100644
--- a/spec/features/projects/clusters/applications_spec.rb
+++ b/spec/features/projects/clusters/applications_spec.rb
@@ -31,6 +31,8 @@ describe 'Clusters Applications', :js do
let(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) }
it 'user can install applications' do
+ wait_for_requests
+
page.within('.js-cluster-application-row-helm') do
expect(page.find(:css, '.js-cluster-application-install-button')['disabled']).to be_nil
expect(page).to have_css('.js-cluster-application-install-button', exact_text: 'Install')
@@ -44,6 +46,8 @@ describe 'Clusters Applications', :js do
page.within('.js-cluster-application-row-helm') do
page.find(:css, '.js-cluster-application-install-button').click
end
+
+ wait_for_requests
end
it 'they see status transition' do
@@ -52,8 +56,6 @@ describe 'Clusters Applications', :js do
expect(page.find(:css, '.js-cluster-application-install-button')['disabled']).to eq('true')
expect(page).to have_css('.js-cluster-application-install-button', exact_text: 'Installing')
- wait_until_app_created!('helm')
-
Clusters::Cluster.last.application_helm.make_installing!
# FE starts polling and update the buttons to "Installing"
@@ -113,7 +115,7 @@ describe 'Clusters Applications', :js do
click_button 'Install'
- wait_until_app_created!('knative')
+ wait_for_requests
expect(page).to have_css('.js-cluster-application-install-button', exact_text: 'Installing')
@@ -143,7 +145,7 @@ describe 'Clusters Applications', :js do
click_button 'Save changes'
- wait_until_app_updated!(cluster.application_knative)
+ wait_for_requests
expect(domainname_form_value).to eq('new.domain.example.org')
end
@@ -202,6 +204,8 @@ describe 'Clusters Applications', :js do
page.within('.js-cluster-application-row-ingress') do
expect(page).to have_css('.js-cluster-application-install-button:not([disabled])')
page.find(:css, '.js-cluster-application-install-button').click
+
+ wait_for_requests
end
end
@@ -238,25 +242,4 @@ describe 'Clusters Applications', :js do
end
end
end
-
- def wait_until_app_created!(app)
- retries = 0
-
- while Clusters::Cluster.last.send("application_#{app}").nil?
- raise "Timed out waiting for #{app} application to be created in DB" if (retries += 1) > 3
-
- sleep(1)
- end
- end
-
- def wait_until_app_updated!(app)
- retries = 0
- updated_at = app.updated_at
-
- while updated_at == app.reload.updated_at
- raise "Timed out waiting for #{app} application to be created in DB" if (retries += 1) > 3
-
- sleep(1)
- end
- end
end