reflex/tests/units/test_testing.py
Thomas Brandého 3f538865b5
reorganize all tests in a single top folder (#3981)
* lift node version restraint to allow more recent version if already installed

* add node test for latest version

* change python version

* use purple for debug logs

* update workflow

* add playwright dev dependency

* update workflow

* change test

* oops

* improve test

* update test

* fix tests

* mv units tests to a subfolder

* reorganize tests

* fix install

* update test_state

* revert node changes and only keep new tests organization

* move integration tests in tests/integration

* fix integration workflow

* fix dockerfile workflow

* fix dockerfile workflow 2

* fix shared_state
2024-09-26 01:22:52 +02:00

41 lines
1.0 KiB
Python

"""Unit tests for the included testing tools."""
import pytest
from reflex.constants import IS_WINDOWS
from reflex.testing import AppHarness
@pytest.mark.skip("Slow test that makes network requests.")
def test_app_harness(tmp_path):
"""Ensure that AppHarness can compile and start an app.
Args:
tmp_path: pytest tmp_path fixture
"""
# Skip in Windows CI.
if IS_WINDOWS:
return
def BasicApp():
import reflex as rx
class State(rx.State):
pass
app = rx.App(state=State)
app.add_page(lambda: rx.text("Basic App"), route="/", title="index")
app._compile()
with AppHarness.create(
root=tmp_path,
app_source=BasicApp, # type: ignore
) as harness:
assert harness.app_instance is not None
assert harness.backend is not None
assert harness.frontend_url is not None
assert harness.frontend_process is not None
assert harness.frontend_process.poll() is None
assert harness.frontend_process.poll() is not None