diff options
Diffstat (limited to 'qa/qa/runtime/browser.rb')
-rw-r--r-- | qa/qa/runtime/browser.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/qa/qa/runtime/browser.rb b/qa/qa/runtime/browser.rb index 9aaf57e8d83..b706d6565d2 100644 --- a/qa/qa/runtime/browser.rb +++ b/qa/qa/runtime/browser.rb @@ -70,6 +70,13 @@ module QA options.add_argument("disable-gpu") end + # Use the same profile on QA runs if CHROME_REUSE_PROFILE is true. + # Useful to speed up local QA. + if QA::Runtime::Env.reuse_chrome_profile? + qa_profile_dir = ::File.expand_path('../../tmp/qa-profile', __dir__) + options.add_argument("user-data-dir=#{qa_profile_dir}") + end + # Disable /dev/shm use in CI. See https://gitlab.com/gitlab-org/gitlab-ee/issues/4252 options.add_argument("disable-dev-shm-usage") if QA::Runtime::Env.running_in_ci? @@ -117,6 +124,15 @@ module QA def perform(&block) visit(url) + if QA::Runtime::Env.qa_cookies + browser = Capybara.current_session.driver.browser + QA::Runtime::Env.qa_cookies.each do |cookie| + name, value = cookie.split("=") + value ||= "" + browser.manage.add_cookie name: name, value: value + end + end + yield.tap { clear! } if block_given? end |