From 96e569ac37140baa643cfa14bf270c3fa388d2e2 Mon Sep 17 00:00:00 2001 From: Sebastien Jourdain Date: Fri, 16 Jun 2023 16:14:18 -0600 Subject: [PATCH] fix(vue-vtk-js): Update vtk.js --- .github/workflows/test_and_release.yml | 4 ++-- examples/validation/PyVistaDynaLUT.py | 5 ++++- examples/validation/PyVistaLookupTable.py | 5 ++++- tests/conftest.py | 25 +++++++++++++++++++++++ tests/requirements.txt | 5 +++++ tests/test_remote_rendering.py | 11 ++++++++++ 6 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 tests/conftest.py create mode 100644 tests/test_remote_rendering.py diff --git a/.github/workflows/test_and_release.yml b/.github/workflows/test_and_release.yml index 2d8499e..3cfe1f9 100644 --- a/.github/workflows/test_and_release.yml +++ b/.github/workflows/test_and_release.yml @@ -62,7 +62,7 @@ jobs: pip install -r tests/requirements.txt # Run the tests with coverage so we get a coverage report too pip install coverage - coverage run --source . -m pytest . + coverage run --source . -m pytest . --browser=firefox # Print the coverage report coverage report -m @@ -83,7 +83,7 @@ jobs: - name: Install trame-vtk.js run: | mkdir -p ./trame_vtk/modules/common/serve - curl https://unpkg.com/vue-vtk-js@3.1.5 -Lo ./trame_vtk/modules/common/serve/trame-vtk.js + curl https://unpkg.com/vue-vtk-js@3.1.6 -Lo ./trame_vtk/modules/common/serve/trame-vtk.js - name: Python Semantic Release uses: relekang/python-semantic-release@master diff --git a/examples/validation/PyVistaDynaLUT.py b/examples/validation/PyVistaDynaLUT.py index a275e62..fa0c5ea 100644 --- a/examples/validation/PyVistaDynaLUT.py +++ b/examples/validation/PyVistaDynaLUT.py @@ -7,9 +7,12 @@ from pyvista import examples from pyvista.trame.ui import plotter_ui +# Just for using this script in testing +from trame_client.utils.testing import enable_testing + pv.OFF_SCREEN = True -server = get_server() +server = enable_testing(get_server()) state, ctrl = server.state, server.controller state.trame__title = "PyVista UI Template" diff --git a/examples/validation/PyVistaLookupTable.py b/examples/validation/PyVistaLookupTable.py index 8e226cc..2e48d4a 100644 --- a/examples/validation/PyVistaLookupTable.py +++ b/examples/validation/PyVistaLookupTable.py @@ -5,7 +5,10 @@ from trame.ui.vuetify import SinglePageLayout from trame.widgets import vuetify, vtk as vtk_widgets -server = get_server() +# Just for using this script in testing +from trame_client.utils.testing import enable_testing + +server = enable_testing(get_server()) state, ctrl = server.state, server.controller state.trame__title = "PyVista Lookup Table N Colors" diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..eb539e9 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,25 @@ +import pytest +from pathlib import Path +from trame_client.utils.testing import FixtureHelper + +ROOT_PATH = Path(__file__).parent.parent.absolute() +HELPER = FixtureHelper(ROOT_PATH) + + +@pytest.fixture() +def baseline_image(): + HELPER.remove_page_urls() + yield + HELPER.remove_page_urls() + + +@pytest.fixture +def server(xprocess, server_path): + name, Starter, Monitor = HELPER.get_xprocess_args(server_path) + + # ensure process is running and return its logfile + logfile = xprocess.ensure(name, Starter) + yield Monitor(logfile[1]) + + # clean up whole process tree afterwards + xprocess.getinfo(name).terminate() diff --git a/tests/requirements.txt b/tests/requirements.txt index e079f8a..4439c6c 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1 +1,6 @@ pytest +seleniumbase +pytest-xprocess +trame +pyvista +trame-client>=2.9.2 \ No newline at end of file diff --git a/tests/test_remote_rendering.py b/tests/test_remote_rendering.py new file mode 100644 index 0000000..55293c8 --- /dev/null +++ b/tests/test_remote_rendering.py @@ -0,0 +1,11 @@ +import pytest +from seleniumbase import SB + + +@pytest.mark.parametrize("server_path", ["examples/validation/PyVistaLookupTable.py"]) +def test_reactivity(server, baseline_image): + with SB() as sb: + url = f"http://localhost:{server.port}/" + sb.open(url) + sb.sleep(1) # Wait for geometry to arrive + sb.check_window(name="init", level=3)