mirror of https://github.com/pyodide/pyodide.git
Add browser attribute in selenium fixture
This commit is contained in:
parent
7553ab4bfe
commit
16ff5aaeef
|
@ -74,6 +74,9 @@ class SeleniumWrapper:
|
|||
|
||||
|
||||
class FirefoxWrapper(SeleniumWrapper):
|
||||
|
||||
browser = 'firefox'
|
||||
|
||||
def get_driver(self):
|
||||
from selenium.webdriver import Firefox
|
||||
from selenium.webdriver.firefox.options import Options
|
||||
|
@ -89,6 +92,9 @@ class FirefoxWrapper(SeleniumWrapper):
|
|||
|
||||
|
||||
class ChromeWrapper(SeleniumWrapper):
|
||||
|
||||
browser = 'chrome'
|
||||
|
||||
def get_driver(self):
|
||||
from selenium.webdriver import Chrome
|
||||
from selenium.webdriver.chrome.options import Options
|
||||
|
|
|
@ -27,8 +27,8 @@ def registered_packages_meta():
|
|||
for name in packages}
|
||||
|
||||
|
||||
UNSUPPORTED_PACKAGES = {'ChromeWrapper': ['pandas'],
|
||||
'FirefoxWrapper': []}
|
||||
UNSUPPORTED_PACKAGES = {'chrome': ['pandas'],
|
||||
'firefox': []}
|
||||
|
||||
|
||||
@pytest.mark.parametrize('name', registered_packages())
|
||||
|
@ -36,12 +36,10 @@ def test_import(name, selenium_standalone):
|
|||
# check that we can parse the meta.yaml
|
||||
meta = common.parse_package(PKG_DIR / name / 'meta.yaml')
|
||||
|
||||
if name in UNSUPPORTED_PACKAGES[selenium_standalone.__class__.__name__]:
|
||||
if name in UNSUPPORTED_PACKAGES[selenium_standalone.browser]:
|
||||
pytest.xfail(
|
||||
'{} fails to load and is not supported on {}.'
|
||||
.format(name,
|
||||
selenium_standalone.__class__.__name__
|
||||
.replace('Wrapper', '')))
|
||||
'{} fails to load and is not supported on {}.'
|
||||
.format(name, selenium_standalone.browser))
|
||||
|
||||
for import_name in meta.get('test', {}).get('imports', []):
|
||||
selenium_standalone.load_package(name)
|
||||
|
|
|
@ -2,7 +2,7 @@ import pytest
|
|||
|
||||
|
||||
def test_pandas(selenium, request):
|
||||
if 'chrome' in selenium.__class__.__name__.lower():
|
||||
if selenium.browser == 'chrome':
|
||||
request.applymarker(pytest.mark.xfail(
|
||||
run=False, reason='chrome not supported'))
|
||||
selenium.load_package("pandas")
|
||||
|
@ -10,7 +10,7 @@ def test_pandas(selenium, request):
|
|||
|
||||
|
||||
def test_extra_import(selenium, request):
|
||||
if 'chrome' in selenium.__class__.__name__.lower():
|
||||
if selenium.brower == 'chrome':
|
||||
request.applymarker(pytest.mark.xfail(
|
||||
run=False, reason='chrome not supported'))
|
||||
|
||||
|
|
Loading…
Reference in New Issue