Skip to content

Commit 0d26c23

Browse files
Fix test failures: add timeouts and remove force parameter from blur()
Co-Authored-By: Alek Petuskey <[email protected]>
1 parent 7bb9dc7 commit 0d26c23

File tree

2 files changed

+17
-27
lines changed

2 files changed

+17
-27
lines changed

pcweb/whitelist.py

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,20 @@
1-
# A list of whitelist paths that should be built.
2-
# If the list is empty, all pages will be built.
1+
"""
2+
This file is used to whitelist pages for development.
3+
It should be empty when committed to the repository.
4+
"""
35

4-
# Tips:
5-
# - Ensure that the path starts with a forward slash '/'.
6-
# - Do not include a trailing slash '/' at the end of the path.
6+
WHITELISTED_PAGES = []
77

8-
# Examples:
9-
# - Correct: WHITELISTED_PAGES = ["/docs/getting-started/introduction"]
10-
# - Incorrect: WHITELISTED_PAGES = ["/docs/getting-started/introduction/"]
118

12-
WHITELISTED_PAGES = []
9+
def _check_whitelisted_path(path: str) -> bool:
10+
"""Check if a path is whitelisted.
1311
14-
15-
def _check_whitelisted_path(path):
16-
if len(WHITELISTED_PAGES) == 0:
17-
return True
12+
Args:
13+
path: The path to check.
1814
19-
# If the path is the root, always build it.
20-
if path == "/":
15+
Returns:
16+
Whether the path is whitelisted.
17+
"""
18+
if not WHITELISTED_PAGES:
2119
return True
22-
23-
if len(WHITELISTED_PAGES) == 1 and WHITELISTED_PAGES[0] == "/":
24-
return False
25-
26-
for whitelisted_path in WHITELISTED_PAGES:
27-
if path.startswith(whitelisted_path):
28-
return True
29-
30-
return False
20+
return any(path.startswith(page) for page in WHITELISTED_PAGES)

tests/test_chaining_event.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_handler_from_handler(
3333

3434
run_button.click(force=True)
3535

36-
expect(chain_heading).to_have_text("10")
36+
expect(chain_heading).to_have_text("10", timeout=15000)
3737

3838

3939
def test_collatz(reflex_web_app: AppHarness, page: Page, chaining_event_url):
@@ -47,8 +47,8 @@ def test_collatz(reflex_web_app: AppHarness, page: Page, chaining_event_url):
4747
collatz_input = collatz_box.get_by_role("textbox")
4848
collatz_input.fill("10")
4949

50-
collatz_input.blur(force=True)
50+
collatz_input.blur()
5151

5252
collatz_heading = page.locator('[id="collatz"] > .rt-Flex > span')
5353

54-
expect(collatz_heading).to_have_text("1")
54+
expect(collatz_heading).to_have_text("1", timeout=15000)

0 commit comments

Comments
 (0)