Commit c73bf13d authored by Mark Lapierre's avatar Mark Lapierre

Merge branch 'qa-fix-branches-spec' into 'master'

Fix transient failure in add_list_delete_branches_spec.rb

Closes gitlab-org/quality/nightly#62

See merge request gitlab-org/gitlab-ce!24644
parents 2b8f1943 dbb53248
...@@ -128,6 +128,10 @@ module QA ...@@ -128,6 +128,10 @@ module QA
page.has_no_text? text page.has_no_text? text
end end
def finished_loading?
has_no_css?('.fa-spinner', wait: Capybara.default_max_wait_time)
end
def within_element(name) def within_element(name)
page.within(element_selector_css(name)) do page.within(element_selector_css(name)) do
yield yield
......
...@@ -19,10 +19,12 @@ module QA ...@@ -19,10 +19,12 @@ module QA
within_element(:all_branches) do within_element(:all_branches) do
within(".js-branch-#{branch_name}") do within(".js-branch-#{branch_name}") do
accept_alert do accept_alert do
find_element(:remove_btn).click click_element(:remove_btn)
end end
end end
end end
finished_loading?
end end
def has_branch_title?(branch_title) def has_branch_title?(branch_title)
......
...@@ -28,6 +28,7 @@ module QA ...@@ -28,6 +28,7 @@ module QA
Git::Repository.perform do |repository| Git::Repository.perform do |repository|
repository.uri = project.repository_http_location.uri repository.uri = project.repository_http_location.uri
repository.use_default_credentials repository.use_default_credentials
repository.try_add_credentials_to_netrc
repository.act do repository.act do
clone clone
......
...@@ -112,6 +112,17 @@ module QA ...@@ -112,6 +112,17 @@ module QA
found found
end 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) def within_element(name)
log("within element :#{name}") log("within element :#{name}")
......
# frozen_string_literal: true # frozen_string_literal: true
require 'capybara/dsl' require 'capybara/dsl'
require 'logger'
describe QA::Support::Page::Logging do describe QA::Support::Page::Logging do
include Support::StubENV include Support::StubENV
...@@ -8,7 +9,7 @@ describe QA::Support::Page::Logging do ...@@ -8,7 +9,7 @@ describe QA::Support::Page::Logging do
let(:page) { double().as_null_object } let(:page) { double().as_null_object }
before do before do
logger = Logger.new $stdout logger = ::Logger.new $stdout
logger.level = ::Logger::DEBUG logger.level = ::Logger::DEBUG
QA::Runtime::Logger.logger = logger QA::Runtime::Logger.logger = logger
...@@ -95,6 +96,13 @@ describe QA::Support::Page::Logging do ...@@ -95,6 +96,13 @@ describe QA::Support::Page::Logging do
.to output(/has_no_text\?\('foo'\) returned true/).to_stdout_from_any_process .to output(/has_no_text\?\('foo'\) returned true/).to_stdout_from_any_process
end 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 it 'logs within_element' do
expect { subject.within_element(:element) } expect { subject.within_element(:element) }
.to output(/within element :element/).to_stdout_from_any_process .to output(/within element :element/).to_stdout_from_any_process
......
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