[PATCH] Make browser tests work again

Daniel Axtens dja at axtens.net
Tue Jul 4 08:38:50 AEST 2017


Stephen Finucane <stephen at that.guru> writes:

> On Sat, 2017-07-01 at 14:06 +1000, Daniel Axtens wrote:
>> 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)
>
> Is this line supposed to be here? It does the same thing as the line below
> minus the service_args, and isn't used anywhere.

Ah oops, no - sorry - copy-paste mishap.

Good catch!

Regards,
Daniel

>
>>              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)


More information about the Patchwork mailing list