Merge branch 'jarv/add-qa-cookies' into 'master'

Adds QA_COOKIES option to gitlab-qa

See merge request gitlab-org/gitlab-ce!23416
This commit is contained in:
Rémy Coutable 2018-11-28 16:52:01 +00:00
commit f912e3b1b2
3 changed files with 22 additions and 0 deletions

View File

@ -80,6 +80,15 @@ GITLAB_USERNAME=jsmith GITLAB_PASSWORD=password GITLAB_SANDBOX_NAME=jsmith-qa-sa
All [supported environment variables are here](https://gitlab.com/gitlab-org/gitlab-qa/blob/master/docs/what_tests_can_be_run.md#supported-environment-variables).
### Sending additional cookies
The environment variable `QA_COOKIES` can be set to send additional cookies
on every request. This is necessary on gitlab.com to direct traffic to the
canary fleet. To do this set `QA_COOKIES="gitlab_canary=true"`.
To set multiple cookies, separate them with the `;` character, for example: `QA_COOKIES="cookie1=value;cookie2=value2"`
### Building a Docker image to test
Once you have made changes to the CE/EE repositories, you may want to build a

View File

@ -117,6 +117,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

View File

@ -38,6 +38,10 @@ module QA
ENV['CI'] || ENV['CI_SERVER']
end
def qa_cookies
ENV['QA_COOKIES'] && ENV['QA_COOKIES'].split(';')
end
def signup_disabled?
enabled?(ENV['SIGNUP_DISABLED'], default: false)
end