[PATCH] Make browser tests work again

Daniel Axtens dja at axtens.net
Sat Jul 1 14:06:51 AEST 2017


Save us the embarassement of releasing v2 with broken tests.

Signed-off-by: Daniel Axtens <dja at axtens.net>
---
 patchwork/tests/browser.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/patchwork/tests/browser.py b/patchwork/tests/browser.py
index 38413d5130cd..921b5d4af033 100644
--- a/patchwork/tests/browser.py
+++ b/patchwork/tests/browser.py
@@ -30,6 +30,7 @@ from selenium.common.exceptions import (
     TimeoutException)
 from selenium import webdriver
 from selenium.webdriver.support.ui import WebDriverWait
+from selenium.webdriver.chrome.options import Options
 
 
 class Wait(WebDriverWait):
@@ -110,8 +111,15 @@ class SeleniumTestCase(StaticLiveServerTestCase):
         if self.browser == 'firefox':
             self.selenium = webdriver.Firefox()
         if self.browser == 'chrome':
+            chrome_options = Options()
+            # chrome's aggressive sandboxing doesn't work well with
+            # docker so disable the sandbox. We're only looking at our
+            # own site so it should be safe enough
+            chrome_options.add_argument("--no-sandbox")
+            driver = webdriver.Chrome(chrome_options=chrome_options)
             self.selenium = webdriver.Chrome(
-                service_args=['--verbose', '--log-path=selenium.log']
+                service_args=['--verbose', '--log-path=selenium.log'],
+                chrome_options=chrome_options
             )
 
         mkdir(self._SCREENSHOT_DIR)
-- 
2.11.0



More information about the Patchwork mailing list