MCPcopy
hub / github.com/reflex-dev/reflex / test_get_state

Function test_get_state

tests/integration/test_background_task.py:371–397  ·  view source on GitHub ↗

Test that get_state returns a state bound to the correct StateProxy. Args: background_task: harness for BackgroundTask app. driver: WebDriver instance. token: The token for the connected client.

(
    background_task: AppHarness,
    driver: WebDriver,
    token: str,
)

Source from the content-addressed store, hash-verified

369
370
371def test_get_state(
372 background_task: AppHarness,
373 driver: WebDriver,
374 token: str,
375):
376 """Test that get_state returns a state bound to the correct StateProxy.
377
378 Args:
379 background_task: harness for BackgroundTask app.
380 driver: WebDriver instance.
381 token: The token for the connected client.
382 """
383 assert background_task.app_instance is not None
384
385 # get a reference to all buttons
386 other_state_button = driver.find_element(By.ID, "increment-from-other-state")
387 increment_button = driver.find_element(By.ID, "increment")
388
389 # get a reference to the counter
390 counter = driver.find_element(By.ID, "counter")
391 AppHarness.expect(lambda: counter.text == "0", timeout=5)
392
393 other_state_button.click()
394 AppHarness.expect(lambda: counter.text == "12", timeout=5)
395
396 increment_button.click()
397 AppHarness.expect(lambda: counter.text == "13", timeout=5)
398
399
400def test_yield_in_async_with_self(

Callers

nothing calls this directly

Calls 1

expectMethod · 0.80

Tested by

no test coverage detected