diff options
author | Benoit Foucher <benoit@zeroc.com> | 2017-01-04 09:50:56 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2017-01-04 09:50:56 +0100 |
commit | 0ecc553950e170400376b07e3c76c78061a83895 (patch) | |
tree | 350799448594e0095baeb39e4856bbab5212f9bf /scripts/Util.py | |
parent | Fixed BrowserController bug in Util.py (diff) | |
download | ice-0ecc553950e170400376b07e3c76c78061a83895.tar.bz2 ice-0ecc553950e170400376b07e3c76c78061a83895.tar.xz ice-0ecc553950e170400376b07e3c76c78061a83895.zip |
Added workaround for running Safari tests with Jenkins
Diffstat (limited to 'scripts/Util.py')
-rw-r--r-- | scripts/Util.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/Util.py b/scripts/Util.py index 06e9caad221..7ca01fe669b 100644 --- a/scripts/Util.py +++ b/scripts/Util.py @@ -2053,6 +2053,7 @@ class BrowserProcessController(RemoteProcessController): def __init__(self, current): RemoteProcessController.__init__(self, current, "ws -h 127.0.0.1 -p 15002:wss -h 127.0.0.1 -p 15003") self.httpServer = None + self.safariDriver = None try: from selenium import webdriver if not hasattr(webdriver, current.config.browser): @@ -2071,6 +2072,18 @@ class BrowserProcessController(RemoteProcessController): # capabilities["moz:firefoxOptions"]["binary"] = "/Applications/FirefoxNightly.app/Contents/MacOS/firefox-bin" profile = webdriver.FirefoxProfile(os.path.join(toplevel, "scripts", "selenium", "firefox")) self.driver = webdriver.Firefox(firefox_profile=profile) + elif current.config.browser == "Safari" and os.environ.get("USER", "") == "jenkins": + # + # When running with Jenkins in headless mode, we need to manually start the webdriver + # to fill in the requested password. + # + import pexpect + self.safariDriver = pexpect.spawn("/usr/bin/safaridriver", ["-p", "9987"]) + self.safariDriver.expect("Password:") + self.safariDriver.sendline("jenkins") + self.safariDriver.expect("\n") + time.sleep(1) + self.driver = webdriver.Remote("http://localhost:9987", webdriver.DesiredCapabilities.SAFARI) else: self.driver = getattr(webdriver, current.config.browser)() @@ -2113,6 +2126,10 @@ class BrowserProcessController(RemoteProcessController): self.httpServer.terminate() self.httpServer = None + if self.safariDriver: + self.safariDriver.terminate() + self.safariDriver = None + try: self.driver.quit() except: |