Skip to content

Commit

Permalink
add unit tests for simple argument checks
Browse files Browse the repository at this point in the history
  • Loading branch information
byron committed Sep 3, 2019
1 parent 4489e51 commit af86268
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions tests/unit/test_browser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import pytest
from dash.testing.browser import Browser
from dash.testing.consts import SELENIUM_GRID_DEFAULT


@pytest.mark.parametrize("browser_type", ("Chrome", "Firefox"))
def test_browser_smoke(browser_type, tmpdir):

browser = Browser(
browser=browser_type,
remote=False,
remote_url=SELENIUM_GRID_DEFAULT,
headless=True,
options=None,
download_path=tmpdir.mkdir("download").strpath,
percy_finalize=True,
)
assert browser.driver.name == browser_type.lower()


def test_browser_use_remote_webdriver(tmpdir):
# test creation with remote=True
with pytest.raises(Exception):
Browser(
browser="Chrome",
remote=True,
remote_url=SELENIUM_GRID_DEFAULT,
headless=True,
options=None,
download_path=tmpdir.mkdir("download").strpath,
percy_finalize=True,
)

# test creation with remote_url other than default
with pytest.raises(Exception):
Browser(
browser="Chrome",
remote=False,
remote_url="http://token@any.selenium.grid:3333",
headless=True,
options=None,
download_path=tmpdir.mkdir("download").strpath,
percy_finalize=True,
)

0 comments on commit af86268

Please sign in to comment.