Skip to content

Commit

Permalink
Make it possible to pick browser used for pyodide tests
Browse files Browse the repository at this point in the history
It's now possible to select which browser is used to run the testsuite
by setting the `BROWSER` environment variable e.g.

    BROWSER=firefox python pyodide_testrunner/run.py

If no variable is found, the script will default to use Chrome.
  • Loading branch information
alcarney committed Oct 14, 2022
1 parent d0e7ab5 commit b7373e7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pyodide_testrunner/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@

# Path to the root of the repo.
REPO = pathlib.Path(__file__).parent.parent
BROWSERS = {
"chrome": (webdriver.Chrome, webdriver.ChromeOptions),
"firefox": (webdriver.Firefox, webdriver.FirefoxOptions),
}


def build_wheel() -> str:
Expand Down Expand Up @@ -82,10 +86,12 @@ def main():
print("Running tests...")
try:

options = webdriver.ChromeOptions()
driver_cls, options_cls = BROWSERS[os.environ.get('BROWSER', 'chrome')]

options = options_cls()
options.headless = 'CI' in os.environ

driver = webdriver.Chrome(options=options)
driver = driver_cls(options=options)
driver.get(f'http://localhost:{port}?whl={whl}')

wait = WebDriverWait(driver, 120)
Expand Down

0 comments on commit b7373e7

Please sign in to comment.