FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

test: scroll the flat_list flow to the last row so a fling cannot ove… · pythonnative/pythonnative@77ba07f · GitHub

Repository navigation

Commit 77ba07f

Browse files
committed
test: scroll the flat_list flow to the last row so a fling cannot overshoot it
1 parent 5604e0a commit 77ba07f

2 files changed

Lines changed: 21 additions & 11 deletions

File tree

‎examples/e2e-suite/app/screens/components/flat_list.py‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
"""Demo screen for [`pn.FlatList`][pythonnative.FlatList].
22
3-
Renders a virtualized list of 100 rows. Maestro asserts the first
4-
row, scrolls down, and asserts a row further into the list.
3+
Renders a virtualized list of 40 rows. Maestro asserts the first row,
4+
scrolls to the end, and asserts the last row.
55
66
Because the demo passes a fixed ``item_height`` (with no header,
77
footer, or refresh control), on Android and iOS this list takes the
88
**native** virtualization path: a ``RecyclerView`` / ``UITableView``
99
whose rows are nested PythonNative subtrees mounted on demand. The
1010
scroll assertion therefore exercises native cell recycling end to end.
11+
12+
The flow targets the *last* row because a Maestro fling can travel
13+
several hundred points between visibility polls, skipping clean past
14+
a mid-list row that's only in the accessibility tree while on screen
15+
(rows are recycled natively). The end of the list can't be overshot.
16+
40 rows is still ~5 screenfuls of the list box, so recycling is
17+
genuinely exercised, while keeping the scroll to a handful of swipes.
1118
"""
1219

1320
from __future__ import annotations
@@ -18,8 +25,8 @@
1825

1926
@pn.component
2027
def FlatListDemo() -> pn.Element:
21-
"""Render a virtualized 100-row FlatList with stable row labels."""
22-
items = [{"id": i, "label": f"FlatRow {i + 1}"} for i in range(100)]
28+
"""Render a virtualized 40-row FlatList with stable row labels."""
29+
items = [{"id": i, "label": f"FlatRow {i + 1}"} for i in range(40)]
2330

2431
def render_row(item: dict, _: int) -> pn.Element:
2532
return pn.View(
@@ -47,6 +54,6 @@ def render_row(item: dict, _: int) -> pn.Element:
4754
key_extractor=lambda item, _: str(item["id"]),
4855
style=pn.style(height=400, background_color="#F1F5F9"),
4956
),
50-
hint("Maestro asserts 'FlatRow 1' and (after scroll) 'FlatRow 20'."),
57+
hint("Maestro asserts 'FlatRow 1' and (after scroll) 'FlatRow 40'."),
5158
),
5259
)

‎tests/e2e/flows/components/flat_list.yaml‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,21 @@ appId: ${APP_ID}
1919
CATEGORY: Components
2020
DEMO_TITLE: FlatList
2121
- assertVisible: "FlatRow 1"
22-
# Generous timeout plus a settle pause: every hierarchy poll between
23-
# swipes materializes accessibility cells for the whole list, which is
24-
# slow on the CI simulator, so the default-ish 20 s budget can expire
25-
# after only a few swipes even though scrolling works fine.
22+
# Target the *last* row. Virtualized rows exist in the accessibility
23+
# tree only while on screen, and one Maestro fling can travel several
24+
# hundred points between visibility polls, so a mid-list target (say
25+
# row 20 of 100) can be recycled away between polls and never observed
26+
# -- the scroll then sails to the bottom and times out. The last row
27+
# cannot be overshot. The generous timeout and settle pause absorb the
28+
# slow CI simulator, where each poll re-snapshots the hierarchy.
2629
- scrollUntilVisible:
27-
element: "FlatRow 20"
30+
element: "FlatRow 40"
2831
direction: DOWN
2932
timeout: 45000
3033
waitToSettleTimeoutMs: 500
3134
visibilityPercentage: 100
3235
centerElement: false
33-
- assertVisible: "FlatRow 20"
36+
- assertVisible: "FlatRow 40"
3437
- runFlow:
3538
file: ../../helpers/close_demo.yaml
3639
env:

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL