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

Function test_navigation_app

tests/integration/test_navigation.py:60–94  ·  view source on GitHub ↗

Type text after moving cursor. Update text on backend. Args: navigation_app: harness for NavigationApp app

(navigation_app: AppHarness)

Source from the content-addressed store, hash-verified

58
59
60def test_navigation_app(navigation_app: AppHarness):
61 """Type text after moving cursor. Update text on backend.
62
63 Args:
64 navigation_app: harness for NavigationApp app
65 """
66 assert navigation_app.app_instance is not None, "app is not running"
67 driver = navigation_app.frontend()
68
69 ss = SessionStorage(driver)
70 assert AppHarness._poll_for(lambda: ss.get("token") is not None), "token not found"
71
72 internal_link = driver.find_element(By.ID, "internal")
73
74 with poll_for_navigation(driver):
75 internal_link.click()
76 assert urlsplit(driver.current_url).path == "/internal"
77 with poll_for_navigation(driver):
78 driver.back()
79
80 external_link = AppHarness.poll_for_or_raise_timeout(
81 lambda: driver.find_element(By.ID, "external")
82 )
83 external2_link = driver.find_element(By.ID, "external2")
84
85 external_link.click()
86 # Expect a new tab to open
87 AppHarness.expect(lambda: len(driver.window_handles) == 2)
88
89 # Switch back to the main tab
90 driver.switch_to.window(driver.window_handles[0])
91
92 external2_link.click()
93 # Expect another new tab to open
94 AppHarness.expect(lambda: len(driver.window_handles) == 3)

Callers

nothing calls this directly

Calls 7

poll_for_navigationFunction · 0.85
frontendMethod · 0.80
_poll_forMethod · 0.80
expectMethod · 0.80
SessionStorageClass · 0.70
getMethod · 0.45

Tested by

no test coverage detected