diff options
Diffstat (limited to 'qa/qa/factory/resource/fork.rb')
-rw-r--r-- | qa/qa/factory/resource/fork.rb | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/qa/qa/factory/resource/fork.rb b/qa/qa/factory/resource/fork.rb index 01969c31438..92050eaba2a 100644 --- a/qa/qa/factory/resource/fork.rb +++ b/qa/qa/factory/resource/fork.rb @@ -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| |