|
| 1 | +import os |
1 | 2 | from typing import Any
|
2 | 3 |
|
3 | 4 | from reactpy import Ref, component, html, use_location
|
4 | 5 | from reactpy.testing import DisplayFixture
|
5 | 6 |
|
6 | 7 | from reactpy_router import browser_router, link, route, use_params, use_search_params
|
7 | 8 |
|
| 9 | +GITHUB_ACTIONS = os.getenv("GITHUB_ACTIONS", "").lower() == "true" |
| 10 | +CLICK_DELAY = 250 if GITHUB_ACTIONS else 25 # Delay in miliseconds. |
| 11 | + |
8 | 12 |
|
9 | 13 | async def test_simple_router(display: DisplayFixture):
|
10 | 14 | def make_location_check(path, *routes):
|
@@ -92,7 +96,7 @@ def sample():
|
92 | 96 |
|
93 | 97 | for link_selector in ["#root", "#a", "#b", "#c"]:
|
94 | 98 | lnk = await display.page.wait_for_selector(link_selector)
|
95 |
| - await lnk.click() |
| 99 | + await lnk.click(delay=CLICK_DELAY) |
96 | 100 |
|
97 | 101 | await display.page.wait_for_selector("#default")
|
98 | 102 |
|
@@ -171,7 +175,7 @@ def sample():
|
171 | 175 |
|
172 | 176 | for link_selector in ["#root", "#a", "#b", "#c"]:
|
173 | 177 | lnk = await display.page.wait_for_selector(link_selector)
|
174 |
| - await lnk.click() |
| 178 | + await lnk.click(delay=CLICK_DELAY) |
175 | 179 |
|
176 | 180 | await display.page.wait_for_selector("#default")
|
177 | 181 |
|
@@ -206,7 +210,7 @@ def sample():
|
206 | 210 |
|
207 | 211 | for link_selector in ["#root", "#a", "#b", "#c", "#d", "#e", "#f"]:
|
208 | 212 | lnk = await display.page.wait_for_selector(link_selector)
|
209 |
| - await lnk.click() |
| 213 | + await lnk.click(delay=CLICK_DELAY) |
210 | 214 |
|
211 | 215 | await display.page.wait_for_selector("#default")
|
212 | 216 |
|
@@ -249,7 +253,7 @@ def sample():
|
249 | 253 | await display.show(sample)
|
250 | 254 | await display.page.wait_for_selector("#root")
|
251 | 255 | lnk = await display.page.wait_for_selector("#root")
|
252 |
| - await lnk.click() |
| 256 | + await lnk.click(delay=CLICK_DELAY) |
253 | 257 | await display.page.wait_for_selector("#success")
|
254 | 258 |
|
255 | 259 |
|
|
0 commit comments