From 82ab463eabc9092185f08eede3a0b14ab994d368 Mon Sep 17 00:00:00 2001 From: Taka Date: Mon, 14 Mar 2022 20:23:34 +1100 Subject: [PATCH] Use different backend webdriver's when running the test suite. --- conftest.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/conftest.py b/conftest.py index 3575f8d..5cde0ef 100644 --- a/conftest.py +++ b/conftest.py @@ -171,6 +171,17 @@ def _make_webapp(): addr = "{}:{}".format( mo.group(1), port_no ) app.control_tests = ControlTests( addr ) + # NOTE: We set the back-end webdriver to be the of the same type (Firefox or Chrome) as the browser + # being used to drive the tests, which, strictly speaking, doesn't make sense, since the two things + # don't have anything to do with each other. However, this is a convenient way to switch the backend + # webdriver's and exercise both of them. The webdriver binary must be on the path, but if it's not, + # we won't have even got this far, since it needs to be there to drive the browser. + # NOTE: This will have no effect if we're talking to a remote server, but we can live with that. + if _pytest_options.webdriver == "firefox": + app.config[ "WEBDRIVER_PATH" ] = "geckodriver" + elif _pytest_options.webdriver == "chrome": + app.config[ "WEBDRIVER_PATH" ] = "chromedriver" + return app # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -