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
This commit is contained in:
parent
a05cef5b56
commit
dbb5324881
5 changed files with 28 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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}")
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue