diff --git a/Makefile b/Makefile index 2cf33647..d6058a11 100644 --- a/Makefile +++ b/Makefile @@ -135,19 +135,19 @@ test-setup: test: test-setup ## Run tests - cd $(CURDIR)/python; pytest --driver Remote --host $(SELENIUM_HUB_HOST) --port $(SELENIUM_HUB_PORT) --capability browserName chrome \ + cd $(CURDIR)/python; pytest --driver Remote --host $(SELENIUM_HUB_HOST) --selenium-port $(SELENIUM_HUB_PORT) --capability browserName chrome \ --base-url $(PYTEST_BASE_URL) --needle-baseline-dir $(CURDIR)/docs/assets/img/screenshots --needle-output-dir test-results/screenshots \ -k $(PYTEST_K) -m $(TEST_MARKERS) --html=test-results/report.html --self-contained-html test-all: test-setup ## Run all tests - cd $(CURDIR)/python; pytest --driver Remote --host $(SELENIUM_HUB_HOST) --port $(SELENIUM_HUB_PORT) --capability browserName chrome \ + cd $(CURDIR)/python; pytest --driver Remote --host $(SELENIUM_HUB_HOST) --selenium-port $(SELENIUM_HUB_PORT) --capability browserName chrome \ --base-url $(PYTEST_BASE_URL) --needle-baseline-dir $(CURDIR)/docs/assets/img/screenshots --needle-output-dir test-results/screenshots \ -k $(PYTEST_K) --html=test-results/report.html --self-contained-html test-baselines: ## Create test baselines - cd $(CURDIR)/python; pytest --driver Remote --host $(SELENIUM_HUB_HOST) --port $(SELENIUM_HUB_PORT) --capability browserName chrome \ + cd $(CURDIR)/python; pytest --driver Remote --host $(SELENIUM_HUB_HOST) --selenium-port $(SELENIUM_HUB_PORT) --capability browserName chrome \ --base-url $(PYTEST_BASE_URL) --needle-save-baseline --needle-baseline-dir $(CURDIR)/docs/assets/img/screenshots \ -s -k $(PYTEST_K) diff --git a/environment.yml b/environment.yml index b4cd8e02..1699796e 100644 --- a/environment.yml +++ b/environment.yml @@ -22,6 +22,7 @@ dependencies: - voila>=0.2.0,<0.3 - nbconvert>=6.0.0,<7 - nbclient>=0.4.0 + - jupyter_server>=1.1.0 - illusionist>=0.2.0 - jupyter-flex>=0.6.4 - pytest-html diff --git a/python/jupyter_flex/tests/test_examples.py b/python/jupyter_flex/tests/test_examples.py index 87e3a00d..52a2eb90 100644 --- a/python/jupyter_flex/tests/test_examples.py +++ b/python/jupyter_flex/tests/test_examples.py @@ -12,7 +12,7 @@ def myselenium(selenium): return selenium -def test_example_site(needle, myselenium): +def test_example_site(needle, myselenium, base_url): target_url = "http://example.com/" needle.driver.get(target_url) @@ -32,7 +32,7 @@ def test_voila(needle, myselenium, base_url, name, path): target_url = "{0}/{1}".format(base_url, path) needle.driver.get(target_url) - # Wait for page components to render + # Wait for dashboard to render time.sleep(2) # Take an element screen diff @@ -46,7 +46,7 @@ def test_apps(needle, myselenium, base_url, nb_name): target_url = "{0}/voila/render/{1}.ipynb".format(base_url, nb_name) needle.driver.get(target_url) - # Wait for dashboard components to render + # Wait for dashboard to render time.sleep(10) # Take an element screen diff @@ -58,7 +58,7 @@ def test_customize(needle, myselenium, base_url, nb_name): target_url = "{0}/voila/render/customize/{1}.ipynb".format(base_url, nb_name) needle.driver.get(target_url) - # Wait for dashboard components to render + # Wait for dashboard to render time.sleep(5) # Take an element screen diff @@ -70,7 +70,7 @@ def test_demos(needle, myselenium, base_url, nb_name): target_url = "{0}/voila/render/demos/{1}.ipynb".format(base_url, nb_name) needle.driver.get(target_url) - # Wait for dashboard components to render + # Wait for dashboard to render time.sleep(5) # Take an element screen diff @@ -84,7 +84,7 @@ def test_getting_started(needle, myselenium, base_url, nb_name): target_url = "{0}/voila/render/getting-started/{1}.ipynb".format(base_url, nb_name) needle.driver.get(target_url) - # Wait for dashboard components to render + # Wait for dashboard to render time.sleep(5) # Take an element screen diff @@ -98,7 +98,7 @@ def test_illusionist(needle, myselenium, base_url, nb_name): target_url = "{0}/voila/render/illusionist/{1}.ipynb".format(base_url, nb_name) needle.driver.get(target_url) - # Wait for dashboard components to render + # Wait for dashboard to render time.sleep(5) # Take an element screen diff @@ -129,7 +129,7 @@ def test_layouts(needle, myselenium, base_url, nb_name): target_url = "{0}/voila/render/layouts/{1}.ipynb".format(base_url, nb_name) needle.driver.get(target_url) - # Wait for dashboard components to render + # Wait for dashboard to render time.sleep(5) # Take an element screen diff @@ -154,7 +154,7 @@ def test_plots(needle, myselenium, base_url, nb_name): target_url = "{0}/voila/render/plots/{1}.ipynb".format(base_url, nb_name) needle.driver.get(target_url) - # Wait for dashboard components to render + # Wait for dashboard to render time.sleep(5) # Take an element screen diff @@ -176,7 +176,7 @@ def test_widgets(needle, myselenium, base_url, nb_name): target_url = "{0}/voila/render/widgets/{1}.ipynb".format(base_url, nb_name) needle.driver.get(target_url) - # Wait for dashboard components to render + # Wait for dashboard to render time.sleep(10) # Take an element screen diff diff --git a/python/pyproject.toml b/python/pyproject.toml index 3751cd91..84e9a888 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -1,6 +1,15 @@ [build-system] requires = ["setuptools>=42", "setuptools_scm[toml]>=3.4", "wheel"] +[tool.pytest.ini_options] +norecursedirs = ".git,dist,build,env,venv" +addopts = "jupyter_flex/tests --cov=jupyter_flex --cov-report term-missing" +markers = [ + "selenium: requires selenium (deselect with '-m \"not selenium\"')" +] +pytest_plugin = ["jupyter_server.pytest_plugin"] + + [tool.coverage.run] parallel = true branch = true diff --git a/python/requirements-package.txt b/python/requirements-package.txt index 0226d31c..c69b56c0 100644 --- a/python/requirements-package.txt +++ b/python/requirements-package.txt @@ -1,3 +1,4 @@ voila>=0.2.0,<0.3 nbconvert>=6.0.7,<7 nbclient>=0.4.0 +jupyter_server>=1.1.0 diff --git a/python/requirements.txt b/python/requirements.txt index 325587ed..4c0760c2 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -14,6 +14,7 @@ pytest-cov voila>=0.2.0,<0.3 nbconvert>=6.0.0,<7 nbclient>=0.4.0 +jupyter_server>=1.1.0 illusionist>=0.2.0 jupyter-flex>=0.6.4 pytest-html diff --git a/python/setup.cfg b/python/setup.cfg index 119768cb..977e821e 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -5,10 +5,3 @@ ignore = E203, E501, W503 select = C,E,F,W,B,B950 paths = .,jupyter_flex exclude = .git,dist,build,env,venv,*.egg*,node_modules - -[tool:pytest] -norecursedirs = .git,dist,build,env,venv -strict = true -addopts = jupyter_flex/tests --cov=jupyter_flex --cov-report term-missing -markers = - selenium: requires selenium (deselect with '-m "not selenium"')