Fixed #29883 -- Added selenium hub support to runtests.py.

This commit is contained in:
Tom Forbes 2018-10-25 18:52:29 +01:00 committed by Tim Graham
parent 5a2dd5ec53
commit d207ac1568
3 changed files with 60 additions and 2 deletions

View file

@ -4,6 +4,7 @@ import atexit
import copy
import os
import shutil
import socket
import subprocess
import sys
import tempfile
@ -436,6 +437,15 @@ if __name__ == "__main__":
'--selenium', action=ActionSelenium, metavar='BROWSERS',
help='A comma-separated list of browsers to run the Selenium tests against.',
)
parser.add_argument(
'--selenium-hub',
help='A URL for a selenium hub instance to use in combination with --selenium.',
)
parser.add_argument(
'--external-host', default=socket.gethostname(),
help='The external host that can be reached by the selenium hub instance when running Selenium '
'tests via Selenium Hub.',
)
parser.add_argument(
'--debug-sql', action='store_true',
help='Turn on the SQL query logger within tests.',
@ -456,6 +466,12 @@ if __name__ == "__main__":
options = parser.parse_args()
using_selenium_hub = options.selenium and options.selenium_hub
if options.selenium_hub and not options.selenium:
parser.error('--selenium-hub and --external-host require --selenium to be used.')
if using_selenium_hub and not options.external_host:
parser.error('--selenium-hub and --external-host must be used together.')
# Allow including a trailing slash on app_labels for tab completion convenience
options.modules = [os.path.normpath(labels) for labels in options.modules]
@ -470,6 +486,9 @@ if __name__ == "__main__":
options.tags = ['selenium']
elif 'selenium' not in options.tags:
options.tags.append('selenium')
if options.selenium_hub:
SeleniumTestCaseBase.selenium_hub = options.selenium_hub
SeleniumTestCaseBase.external_host = options.external_host
SeleniumTestCaseBase.browsers = options.selenium
if options.bisect: