Skip to content

Extract capybara max wait time to env var

What does this MR do and why?

Extract capybara max wait time to env var, instead of hardcode value 10 in qa/qa/runtime/browser.rb

# before
      CAPYBARA_MAX_WAIT_TIME = 10
      Chemlab.configure do |config|
          config.browser = Capybara.current_session.driver.browser # reuse Capybara session
          config.libraries = [GitlabHandbook]
          config.base_url = Runtime::Scenario.attributes[:gitlab_address] # reuse GitLab address
          config.hide_banner = true
        end

# after

CAPYBARA_MAX_WAIT_TIME = Env.max_capybara_wait_time

def max_capybara_wait_time
  ENV.fetch('MAX_CAPYBARA_WAIT_TIME', 10).to_i
end

it seems we set max_wait_time to 60 in all places except in browser.rb file, eg

# repeater.rb
module QA
  module Support
    module Repeater
      using Rainbow
      DEFAULT_MAX_WAIT_TIME = 60


# in wait_for_requests.rb
module QA
  module Support
    module WaitForRequests
      module_function

      DEFAULT_MAX_WAIT_TIME = 60

# in capybara.rb
# Give CI some extra time
timeout = ENV['CI'] || ENV['CI_SERVER'] ? 60 : 30
Capybara.default_max_wait_time = timeout

If we set 10 in browser.rb, it will make capybara network timeout sometimes in JH pipeline, eg

        # in qa/qa/scenario/template.rb
        Runtime::Browser.configure! # set max wait time to 10 

        #
        # Perform before hooks, which are different for CE and EE
        #
        QA::Runtime::Release.perform_before_hooks unless QA::Runtime::Env.dry_run
        
        # in qa/qa/ce/strategy.rb
        QA::Support::Retrier.retry_on_exception do
          # it will timeout sometimes in JH pipeline because timeout is 10
          QA::Runtime::Browser.visit(:gitlab, QA::Page::Main::Login)
        end

/cc @daveliu

Edited by MAO Chao

Merge request reports

Loading