Skip to content

Commit

Permalink
Bugfix selenium test case if executable can't be found.
Browse files Browse the repository at this point in the history
  • Loading branch information
jedie committed Jun 28, 2018
1 parent db880e5 commit 4f856db
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 16 deletions.
2 changes: 2 additions & 0 deletions README.creole
Expand Up @@ -727,6 +727,8 @@ File renamed: {{{django_tools/unittest_utils/{celery.py => celery_utils.py}}}}
== history

* *dev* - [[https://github.com/jedie/django-tools/compare/v0.40.0...master|compare v0.40.0...master]]
* v0.40.1 - 28.06.2018 - [[https://github.com/jedie/django-tools/compare/v0.40.0...v0.40.1|compare v0.40.0...v0.40.1]]
** Bugfix selenium test case if executable can't be found.
* v0.40.0 - 15.06.2018 - [[https://github.com/jedie/django-tools/compare/v0.39.6...v0.40.0|compare v0.39.6...v0.40.0]]
** NEW: selenium chrome and firefox test cases in {{{django_tools.unittest_utils.selenium_utils}}}
** Fix test project and add {{{run_test_project_dev_server.sh}}} for easy test
Expand Down
37 changes: 22 additions & 15 deletions django_tools/unittest_utils/selenium_utils.py
Expand Up @@ -118,7 +118,8 @@ class SeleniumBaseTestCase(TestCase, StaticLiveServerTestCase):

@classmethod
def tearDownClass(cls):
cls.driver.quit()
if cls.driver is not None:
cls.driver.quit()
super().tearDownClass()

def setUp(self):
Expand Down Expand Up @@ -284,13 +285,16 @@ def setUpClass(cls):
for argument in cls.options:
chrome_options.add_argument(argument)

executable = find_executable(cls.filename, cls.extra_search_paths)

cls.driver = webdriver.Chrome(
chrome_options=chrome_options,
executable_path=str(executable) # Path() instance -> str()
)
cls.driver.implicitly_wait(10)
try:
executable = find_executable(cls.filename, cls.extra_search_paths)
except FileNotFoundError:
cls.driver = None
else:
cls.driver = webdriver.Chrome(
chrome_options=chrome_options,
executable_path=str(executable) # Path() instance -> str()
)
cls.driver.implicitly_wait(10)



Expand Down Expand Up @@ -354,13 +358,16 @@ def setUpClass(cls):
for argument in cls.options:
options.add_argument(argument)

executable = find_executable(cls.filename, cls.extra_search_paths)

cls.driver = webdriver.Firefox(
firefox_options=options,
executable_path=str(executable) # Path() instance -> str()
)
cls.driver.implicitly_wait(10)
try:
executable = find_executable(cls.filename, cls.extra_search_paths)
except FileNotFoundError:
cls.driver = None
else:
cls.driver = webdriver.Firefox(
firefox_options=options,
executable_path=str(executable) # Path() instance -> str()
)
cls.driver.implicitly_wait(10)


def firefox_available(filename=None):
Expand Down
2 changes: 1 addition & 1 deletion django_tools/version.py
@@ -1,3 +1,3 @@
# coding: utf-8

__version__ = "0.40.0"
__version__ = "0.40.1"

0 comments on commit 4f856db

Please sign in to comment.