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
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}")
......
# 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
......
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