Merge "Use headless option for cors functional test runner"

This commit is contained in:
Zuul 2021-03-18 06:48:47 +00:00 committed by Gerrit Code Review
commit 1fad8c2ed5
2 changed files with 12 additions and 2 deletions

View File

@ -180,9 +180,19 @@ def run(args, url):
browsers = list(ALL_BROWSERS) if 'all' in args.browsers else args.browsers
ran_one = False
for browser_name in browsers:
kwargs = {}
try:
options = getattr(
selenium.webdriver, browser_name.title() + 'Options')()
options.headless = True
kwargs['options'] = options
except AttributeError:
# not all browser types have Options class
pass
driver = getattr(selenium.webdriver, browser_name.title())
try:
browser = driver()
browser = driver(**kwargs)
except Exception as e:
if not ('needs to be in PATH' in str(e) or
'SafariDriver was not found' in str(e)):

View File

@ -9,7 +9,7 @@
- name: Run CORS tests
shell: >
xvfb-run python
python
{{ ansible_env.HOME }}/{{ zuul.project.src_dir }}/test/cors/main.py
--output {{ ansible_env.HOME }}/cors-test-results.txt
all