Commit 48abf65e authored by Thong Kuah's avatar Thong Kuah

Fix flaky specs failing

- Form value updating mid-way. Use have_field which will wait until
there's a field that matches that value.
- wait for request after clicking install.
parent 9e06bddc
...@@ -110,10 +110,6 @@ RSpec.shared_examples "installing applications for a cluster" do |managed_apps_l ...@@ -110,10 +110,6 @@ RSpec.shared_examples "installing applications for a cluster" do |managed_apps_l
end end
describe 'when user clicks install button' do describe 'when user clicks install button' do
def domainname_form_value
page.find('.js-knative-domainname').value
end
before do before do
allow(ClusterInstallAppWorker).to receive(:perform_async) allow(ClusterInstallAppWorker).to receive(:perform_async)
allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_in) allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_in)
...@@ -138,7 +134,7 @@ RSpec.shared_examples "installing applications for a cluster" do |managed_apps_l ...@@ -138,7 +134,7 @@ RSpec.shared_examples "installing applications for a cluster" do |managed_apps_l
it 'shows status transition' do it 'shows status transition' do
page.within('.js-cluster-application-row-knative') do page.within('.js-cluster-application-row-knative') do
expect(domainname_form_value).to eq('domain.example.org') expect(page).to have_field('Knative Domain Name:', with: 'domain.example.org')
expect(page).to have_css('.js-cluster-application-uninstall-button', exact_text: 'Uninstall') expect(page).to have_css('.js-cluster-application-uninstall-button', exact_text: 'Uninstall')
end end
...@@ -150,7 +146,7 @@ RSpec.shared_examples "installing applications for a cluster" do |managed_apps_l ...@@ -150,7 +146,7 @@ RSpec.shared_examples "installing applications for a cluster" do |managed_apps_l
page.within('.js-cluster-application-row-knative') do page.within('.js-cluster-application-row-knative') do
expect(ClusterPatchAppWorker).to receive(:perform_async) expect(ClusterPatchAppWorker).to receive(:perform_async)
expect(domainname_form_value).to eq('domain.example.org') expect(page).to have_field('Knative Domain Name:', with: 'domain.example.org')
page.find('.js-knative-domainname').set("new.domain.example.org") page.find('.js-knative-domainname').set("new.domain.example.org")
...@@ -158,7 +154,7 @@ RSpec.shared_examples "installing applications for a cluster" do |managed_apps_l ...@@ -158,7 +154,7 @@ RSpec.shared_examples "installing applications for a cluster" do |managed_apps_l
wait_for_requests wait_for_requests
expect(domainname_form_value).to eq('new.domain.example.org') expect(page).to have_field('Knative Domain Name:', with: 'new.domain.example.org')
end end
end end
end end
...@@ -176,6 +172,8 @@ RSpec.shared_examples "installing applications for a cluster" do |managed_apps_l ...@@ -176,6 +172,8 @@ RSpec.shared_examples "installing applications for a cluster" do |managed_apps_l
page.within('.js-cluster-application-row-cert_manager') do page.within('.js-cluster-application-row-cert_manager') do
click_button 'Install' click_button 'Install'
end end
wait_for_requests
end end
it 'shows status transition' do it 'shows status transition' 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