diff options
author | Mark Lapierre <mlapierre@gitlab.com> | 2019-01-24 13:11:52 -0500 |
---|---|---|
committer | Mark Lapierre <mlapierre@gitlab.com> | 2019-01-25 09:07:55 -0500 |
commit | dbb5324881c04d7abb328a7af25b3c72a4991adf (patch) | |
tree | 92fab227ab087a15fdc1e0c336d526de61e9d277 /qa | |
parent | a05cef5b5695136bc8ada2625e500cd114539b2c (diff) | |
download | gitlab-ce-dbb5324881c04d7abb328a7af25b3c72a4991adf.tar.gz |
Fix failing E2E test
Sometimes add_list_delete_branches_spec.rb would not wait after
deleting a branch before checking that the branch was done. It would
fail when the UI was still processing.
This checks that the loading icon is gone before returning from
delete_branch.
It also makes sure credentials are added properly after recent changes
to QA::Git::Repository
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa/page/base.rb | 4 | ||||
-rw-r--r-- | qa/qa/page/project/branches/show.rb | 4 | ||||
-rw-r--r-- | qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb | 1 | ||||
-rw-r--r-- | qa/qa/support/page/logging.rb | 11 | ||||
-rw-r--r-- | qa/spec/page/logging_spec.rb | 10 |
5 files changed, 28 insertions, 2 deletions
diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb index c3c90f254b7..b1f27131207 100644 --- a/qa/qa/page/base.rb +++ b/qa/qa/page/base.rb @@ -128,6 +128,10 @@ module QA page.has_no_text? text end + def finished_loading? + has_no_css?('.fa-spinner', wait: Capybara.default_max_wait_time) + end + def within_element(name) page.within(element_selector_css(name)) do yield diff --git a/qa/qa/page/project/branches/show.rb b/qa/qa/page/project/branches/show.rb index 762a97e2088..922a6ddb086 100644 --- a/qa/qa/page/project/branches/show.rb +++ b/qa/qa/page/project/branches/show.rb @@ -19,10 +19,12 @@ module QA within_element(:all_branches) do within(".js-branch-#{branch_name}") do accept_alert do - find_element(:remove_btn).click + click_element(:remove_btn) end end end + + finished_loading? end def has_branch_title?(branch_title) diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb index 0f0c627d79a..3567ddca1a1 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb @@ -28,6 +28,7 @@ module QA Git::Repository.perform do |repository| repository.uri = project.repository_http_location.uri repository.use_default_credentials + repository.try_add_credentials_to_netrc repository.act do clone diff --git a/qa/qa/support/page/logging.rb b/qa/qa/support/page/logging.rb index e96756642c8..f2cd0194b6b 100644 --- a/qa/qa/support/page/logging.rb +++ b/qa/qa/support/page/logging.rb @@ -112,6 +112,17 @@ module QA found end + def finished_loading? + log('waiting for loading to complete...') + now = Time.now + + loaded = super + + log("loading complete after #{Time.now - now} seconds") + + loaded + end + def within_element(name) log("within element :#{name}") diff --git a/qa/spec/page/logging_spec.rb b/qa/spec/page/logging_spec.rb index 2eb826becea..2666dd3b03b 100644 --- a/qa/spec/page/logging_spec.rb +++ b/qa/spec/page/logging_spec.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require 'capybara/dsl' +require 'logger' describe QA::Support::Page::Logging do include Support::StubENV @@ -8,7 +9,7 @@ describe QA::Support::Page::Logging do let(:page) { double().as_null_object } before do - logger = Logger.new $stdout + logger = ::Logger.new $stdout logger.level = ::Logger::DEBUG QA::Runtime::Logger.logger = logger @@ -95,6 +96,13 @@ describe QA::Support::Page::Logging do .to output(/has_no_text\?\('foo'\) returned true/).to_stdout_from_any_process end + it 'logs finished_loading?' do + expect { subject.finished_loading? } + .to output(/waiting for loading to complete\.\.\./).to_stdout_from_any_process + expect { subject.finished_loading? } + .to output(/loading complete after .* seconds$/).to_stdout_from_any_process + end + it 'logs within_element' do expect { subject.within_element(:element) } .to output(/within element :element/).to_stdout_from_any_process |