Merge branch '51316-qa-fix-transient-fork-spec-failure' into 'master'
Troubleshoot "Transient failure in qa/specs/features/project/fork_project_spec.rb" See merge request gitlab-org/gitlab-ce!21858
This commit is contained in:
commit
57c27b7c01
3 changed files with 44 additions and 4 deletions
|
@ -13,8 +13,43 @@ module QA
|
|||
|
||||
product(:user) { |factory| factory.user }
|
||||
|
||||
def visit_project_with_retry
|
||||
# The user intermittently fails to stay signed in after visiting the
|
||||
# project page. The new user is registered and then signs in and a
|
||||
# screenshot shows that signing in was successful. Then the project
|
||||
# page is visited but a screenshot shows the user is no longer signed
|
||||
# in. It's difficult to reproduce locally but GDK logs don't seem to
|
||||
# show anything unexpected. This method attempts to work around the
|
||||
# problem and capture data to help troubleshoot.
|
||||
|
||||
Capybara::Screenshot.screenshot_and_save_page
|
||||
|
||||
start = Time.now
|
||||
|
||||
while Time.now - start < 20
|
||||
push.project.visit!
|
||||
|
||||
puts "Visited project page"
|
||||
Capybara::Screenshot.screenshot_and_save_page
|
||||
|
||||
return if Page::Menu::Main.act { has_personal_area?(wait: 0) }
|
||||
|
||||
puts "Not signed in. Attempting to sign in again."
|
||||
Capybara::Screenshot.screenshot_and_save_page
|
||||
|
||||
Page::Menu::Main.act { sign_out }
|
||||
|
||||
Page::Main::Login.perform do |login|
|
||||
login.sign_in_using_credentials(user)
|
||||
end
|
||||
end
|
||||
|
||||
raise "Failed to load project page and stay logged in"
|
||||
end
|
||||
|
||||
def fabricate!
|
||||
push.project.visit!
|
||||
visit_project_with_retry
|
||||
|
||||
Page::Project::Show.act { fork_project }
|
||||
|
||||
Page::Project::Fork::New.perform do |fork_new|
|
||||
|
|
|
@ -19,7 +19,7 @@ module QA
|
|||
fill_in :new_user_password, with: user.password
|
||||
click_button 'Register'
|
||||
|
||||
Page::Menu::Main.act { has_personal_area? }
|
||||
Page::Menu::Main.act { assert_has_personal_area }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -61,8 +61,13 @@ module QA
|
|||
end
|
||||
|
||||
def has_personal_area?(wait: Capybara.default_max_wait_time)
|
||||
# No need to wait, either we're logged-in, or not.
|
||||
using_wait_time(wait) { page.has_selector?('.qa-user-avatar') }
|
||||
using_wait_time(wait) do
|
||||
page.has_selector?(element_selector_css(:user_avatar))
|
||||
end
|
||||
end
|
||||
|
||||
def assert_has_personal_area
|
||||
raise "Failed to sign in" unless has_personal_area?
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Reference in a new issue