Datasets:
Download android/oliexdev-openscale/tests/test_android_structure.py from Qwen/RecreationBench: direct link, hf CLI and curl.
- Browser
- Download file 30.6 kB
-
https://huggingface.co/datasets/Qwen/RecreationBench/resolve/main/android/oliexdev-openscale/tests/test_android_structure.py
- Command line
-
hf download hf://datasets/Qwen/RecreationBench/android/oliexdev-openscale/tests/test_android_structure.py
-
curl -L -o test_android_structure.py https://huggingface.co/datasets/Qwen/RecreationBench/resolve/main/android/oliexdev-openscale/tests/test_android_structure.py
30.6 kB
| """STRUCTURE module for openScale — the GATE + tree-SHAPE deltas. | |
| This lane owns exactly two things: | |
| 1. The gate: the app launches and its top-level Overview surface exists | |
| (main container + the drawer/nav host "Open menu"). jump_kind="none", depth 0. | |
| 2. Tree-SHAPE deltas: an interaction changes the *shape* of the view tree | |
| (node counts / a new region/surface appears), asserted by surface_changed / | |
| a node-count delta — never by content strings, checked-state, values, focus, | |
| or reachability-as-content (those belong to other lanes). | |
| A new surface appearing is itself a tree-SHAPE change, so surface-crossing | |
| records here are jump_kind="transition" (not "reach"): every test relaunches the | |
| app for isolation, and a "reach" that includes a relaunch is not honest | |
| navigation. depth>=1 claims are backed by file-local and_enter_* helpers. | |
| Every test opens its own entry point via restart_app()/clear_data(); nothing | |
| depends on a previous test. VLM budget for this file: 8 vlm_assert records, | |
| spent on genuinely visual LAYOUT facts that a blank screen would fail. | |
| """ | |
| import os, sys | |
| sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) | |
| from android_testgen_kit import * # noqa: F403,F401 | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| # Shared navigation helpers. Each one performs a real navigation AND calls | |
| # and_enter(...) so that any depth>=1 claim is backed for the depth auditor. | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| def _create_user(): | |
| """From a virgin Overview ("No User Active"), create a minimal user so the | |
| core UI (New Measurement etc.) becomes reachable. Returns True on success. | |
| Follows the recon recipe: type Name + Height=180 into the first two | |
| EditTexts sorted by y, then tap the top-right Save Button directly (no | |
| hide_keyboard(), which would BACK out of the form and lose the entry).""" | |
| au = find_node_ci(ui(), "Add User") | |
| if not au: | |
| return False | |
| tap_node(au); settle("tap") | |
| ets = sorted(find_by_class(ui(), "EditText"), | |
| key=lambda n: n.get("_bounds", [0, 0, 0, 0])[1]) | |
| if len(ets) < 2: | |
| return False | |
| type_text(ets[0], "Tester") | |
| ets = sorted(find_by_class(ui(), "EditText"), | |
| key=lambda n: n.get("_bounds", [0, 0, 0, 0])[1]) | |
| type_text(ets[1], "180") | |
| # Save = the single clickable Button in the top-right of the TopAppBar | |
| # (has no content-desc on the User form), located by position. | |
| nodes = ui() | |
| save = [n for n in nodes | |
| if n.get("_bounds") and n["_bounds"][0] > 800 and n["_bounds"][1] < 300 | |
| and n.get("clickable") == "true"] | |
| if not save: | |
| return False | |
| tap_node(save[0]); settle("tap"); settle("tap") | |
| return find_node_ci(ui(), "Add Measurement") is not None | |
| def _set_dialog_value(val): | |
| """PROVEN-RELIABLE numeric entry (recon recipe, used verbatim). A | |
| NumberInputDialog must already be open. Clears the appended default, then | |
| types one char at a time. Returns the field's resulting text so the caller | |
| can verify it == str(val).""" | |
| c = find_node_ci(ui(), "Clear") | |
| if c: | |
| tap_node(c); settle("keyboard") | |
| ets = find_by_class(ui(), "EditText") | |
| if not ets: | |
| return "" | |
| tap_node(ets[0]); settle("keyboard"); settle("keyboard") | |
| for ch in str(val): | |
| adb_shell("input", "text", ch); settle("text") | |
| settle("text") | |
| ets = find_by_class(ui(), "EditText") | |
| return ets[0].get("text", "") if ets else "" | |
| def and_enter_measurement(): | |
| """Overview (user exists) → New Measurement. Backs depth>=1.""" | |
| add = find_node(ui(), content_desc="Add new measurement") | |
| if not add: | |
| return False | |
| tap_node(add); settle("tap"); settle("tap") | |
| ok = find_node(ui(), content_desc="Save measurement") is not None | |
| if ok: | |
| and_enter("measurement") | |
| return ok | |
| def and_enter_settings(): | |
| """Overview → (drawer) → Settings. Backs depth>=1.""" | |
| om = find_node(ui(), content_desc="Open menu") | |
| if not om: | |
| return False | |
| tap_node(om); settle("tap") | |
| st = find_node_ci(ui(), "Settings") | |
| if not st: | |
| return False | |
| tap_node(st); settle("tap"); settle("tap") | |
| ok = find_node(ui(), text="Settings") is not None | |
| if ok: | |
| and_enter("settings") | |
| return ok | |
| def and_enter_charts(): | |
| """Overview → (drawer) → Charts. Backs depth>=1.""" | |
| om = find_node(ui(), content_desc="Open menu") | |
| if not om: | |
| return False | |
| tap_node(om); settle("tap") | |
| ch = find_node_ci(ui(), "Charts") | |
| if not ch: | |
| return False | |
| tap_node(ch); settle("tap"); settle("tap") | |
| ok = find_node(ui(), text="Charts") is not None | |
| if ok: | |
| and_enter("charts") | |
| return ok | |
| def and_enter_edit_dialog(): | |
| """New Measurement → tap "Edit Weight" → NumberInputDialog. Backs depth>=2 | |
| (caller must already be on New Measurement, i.e. one and_enter deep).""" | |
| ew = find_node(ui(), content_desc="Edit Weight") | |
| if not ew: | |
| return False | |
| tap_node(ew); settle("tap"); settle("tap") | |
| ok = find_node_ci(ui(), "Clear") is not None | |
| if ok: | |
| and_enter("edit_dialog") | |
| return ok | |
| def _save_weight_measurement(val="80"): | |
| """From New Measurement (already open): set Weight=val via the reliable | |
| recipe and confirm with OK — which CLOSES the dialog itself (no Back), so we | |
| remain on New Measurement — then tap Save. openScale's Save auto-navigates | |
| back to Overview. Returns True iff the field held the value AND a populated | |
| Overview (per-entry Edit/Delete controls) is showing.""" | |
| ew = find_node(ui(), content_desc="Edit Weight") | |
| if not ew: | |
| return False | |
| tap_node(ew); settle("tap"); settle("tap") | |
| if find_node_ci(ui(), "Clear") is None: | |
| return False | |
| got = _set_dialog_value(val) | |
| ok = find_node_ci(ui(), "OK") | |
| if ok: | |
| tap_node(ok); settle("tap") # OK dismisses the dialog | |
| save = find_node(ui(), content_desc="Save measurement") | |
| if not save or got != str(val): # value not held -> no value row | |
| return False | |
| tap_node(save); settle("tap"); settle("tap") | |
| nodes = ui() | |
| return any(n.get("content-desc", "").startswith("Edit measurement from ") | |
| for n in nodes) | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| # (1) THE GATE — the only legitimate jump_kind="none" existence records. | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| def test_gate_launch(): | |
| """App launches and reaches the foreground with a real view tree.""" | |
| and_reset_depth() | |
| clear_data() | |
| restart_app() | |
| fg = wait_for_foreground() | |
| nodes = ui() | |
| # A live Compose surface always has a top-level container + several Views. | |
| container = bool(find_by_class(nodes, "FrameLayout") | |
| or find_by_class(nodes, "ViewGroup")) | |
| ok = bool(fg) and container and len(nodes) >= 5 | |
| record("structure_gate_launch", ok, | |
| "" if ok else "setup_failed: app did not reach the foreground with a view tree", | |
| depth=0, jump_kind="none") | |
| def test_gate_overview_surface(): | |
| """The top-level Overview surface exists: its TopAppBar nav host | |
| ("Open menu") plus the Overview title and the empty-state entry point. | |
| Existence of the app's home surface — the gate. jump_kind="none".""" | |
| and_reset_depth() | |
| clear_data() | |
| restart_app(); wait_for_foreground() | |
| nodes = ui() | |
| nav_host = find_node(nodes, content_desc="Open menu") # drawer host | |
| title = find_node(nodes, text="Overview") # screen title | |
| entry = find_node_ci(nodes, "Add User") # empty-state CTA | |
| ok = bool(nav_host) and bool(title) and bool(entry) | |
| record("structure_gate_overview_surface", ok, | |
| "" if ok else "feature_missing: Overview surface / nav host absent", | |
| depth=0, jump_kind="none") | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| # (2) TREE-SHAPE DELTAS. A new surface appearing == a shape change => transition. | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| def test_drawer_shape_delta(): | |
| """Opening the navigation drawer changes the tree SHAPE materially (a whole | |
| side-sheet of menu Views is added), and closing it restores the shape. | |
| Asserted as a surface delta, not by naming any drawer label. depth=1.""" | |
| and_reset_depth() | |
| clear_data() | |
| restart_app(); wait_for_foreground() | |
| before = and_showing(ui()) | |
| om = find_node(ui(), content_desc="Open menu") | |
| if not om: | |
| record("structure_drawer_shape", False, | |
| "feature_missing: no 'Open menu' nav host to open the drawer", | |
| depth=1, jump_kind="transition", | |
| expect="drawer side-sheet Views added, restored on close") | |
| return | |
| tap_node(om); settle("tap") | |
| opened_nodes = ui() | |
| opened = and_showing(opened_nodes) | |
| grew = surface_changed(before, opened) # shape changed materially | |
| and_enter("drawer") | |
| # Reverse: close the drawer and assert the added shape is gone. | |
| close = find_node(opened_nodes, content_desc="Close navigation menu") | |
| restored_gone = False | |
| if close: | |
| tap_node(close); settle("tap") | |
| restored = and_showing(ui()) | |
| restored_gone = surface_changed(opened, restored) | |
| and_back() | |
| ok = grew and restored_gone | |
| record("structure_drawer_shape", ok, | |
| "" if ok else "behavior_wrong: drawer did not add/restore a shape delta", | |
| depth=1, jump_kind="transition", | |
| expect="drawer open adds side-sheet Views (Δ>=2); close restores shape") | |
| def test_settings_row_count(): | |
| """The Settings screen is a menu list whose ROW COUNT is a shape fact: | |
| the seven top-level setting rows are present, and reaching Settings adds the | |
| 'General' row that was not on Overview (surface shape change). depth=1, | |
| backed by and_enter_settings.""" | |
| and_reset_depth() | |
| clear_data() | |
| restart_app(); wait_for_foreground() | |
| before = and_showing(ui()) | |
| if not and_enter_settings(): | |
| record("structure_settings_row_count", False, | |
| "setup_failed: could not navigate to Settings", | |
| depth=1, jump_kind="transition", | |
| expect="Settings list has 7 rows; 'General' row newly appeared") | |
| return | |
| after_nodes = ui() | |
| after = and_showing(after_nodes) | |
| appeared = surface_changed(before, after) and find_node_ci(after_nodes, "General") | |
| rows = ["General", "User", "Measurement Types", "Bluetooth", | |
| "Chart", "Data Management", "About"] | |
| n_rows = sum(1 for r in rows if find_node_ci(after_nodes, r)) | |
| ok = bool(appeared) and n_rows == 7 | |
| record("structure_settings_row_count", ok, | |
| "" if ok else f"behavior_wrong: expected 7 setting rows, saw {n_rows}", | |
| depth=1, jump_kind="transition", | |
| expect="Settings list has 7 rows (General..About); surface shape changed") | |
| def test_new_measurement_row_count(): | |
| """The New Measurement screen is a LONG vertical list of metric rows; its | |
| editable-row COUNT is a shape fact (nodes whose content-desc starts with | |
| "Edit " number nine, "Increase " nine). Requires a user, then navigates | |
| Overview→New Measurement (and_enter_measurement backs depth=1).""" | |
| and_reset_depth() | |
| clear_data() | |
| restart_app(); wait_for_foreground() | |
| if not _create_user(): | |
| record("structure_new_measurement_rows", False, | |
| "setup_failed: could not create the prerequisite user", | |
| depth=1, jump_kind="transition", | |
| expect="New Measurement list has 9 'Edit X' + 9 'Increase X' rows") | |
| return | |
| before = and_showing(ui()) | |
| if not and_enter_measurement(): | |
| record("structure_new_measurement_rows", False, | |
| "setup_failed: could not open New Measurement", | |
| depth=1, jump_kind="transition", | |
| expect="New Measurement list has 9 'Edit X' + 9 'Increase X' rows") | |
| return | |
| nodes = ui() | |
| after = and_showing(nodes) | |
| grew = surface_changed(before, after) | |
| edit_rows = [n for n in nodes if n.get("content-desc", "").startswith("Edit ")] | |
| inc_rows = [n for n in nodes if n.get("content-desc", "").startswith("Increase ")] | |
| ok = grew and len(edit_rows) == 9 and len(inc_rows) == 9 | |
| record("structure_new_measurement_rows", ok, | |
| "" if ok else f"behavior_wrong: expected 9 Edit + 9 Increase rows, " | |
| f"saw {len(edit_rows)} / {len(inc_rows)}", | |
| depth=1, jump_kind="transition", | |
| expect="New Measurement list has 9 'Edit X' + 9 'Increase X' metric rows") | |
| def test_edit_dialog_shape_delta(): | |
| """Opening the Edit-Weight NumberInputDialog changes tree SHAPE: an EditText | |
| (0→1) plus the Clear/Cancel/OK button layer appear; cancelling restores the | |
| shape (EditText back to 0). depth=2 (Overview→New Measurement→dialog), | |
| backed by and_enter_measurement + and_enter_edit_dialog.""" | |
| and_reset_depth() | |
| clear_data() | |
| restart_app(); wait_for_foreground() | |
| if not _create_user() or not and_enter_measurement(): | |
| record("structure_edit_dialog_shape", False, | |
| "setup_failed: could not reach New Measurement", | |
| depth=2, jump_kind="transition", | |
| expect="dialog adds EditText 0->1 + Clear/Cancel/OK; cancel restores") | |
| return | |
| before_nodes = ui() | |
| before = and_showing(before_nodes) | |
| et_before = len(find_by_class(before_nodes, "EditText")) | |
| if not and_enter_edit_dialog(): | |
| record("structure_edit_dialog_shape", False, | |
| "feature_missing: Edit Weight did not open a NumberInputDialog", | |
| depth=2, jump_kind="transition", | |
| expect="dialog adds EditText 0->1 + Clear/Cancel/OK; cancel restores") | |
| return | |
| dlg_nodes = ui() | |
| dlg = and_showing(dlg_nodes) | |
| et_dlg = len(find_by_class(dlg_nodes, "EditText")) | |
| buttons_appeared = all(find_node_ci(dlg_nodes, b) for b in ("Clear", "Cancel", "OK")) | |
| grew = surface_changed(before, dlg) and et_dlg == et_before + 1 and buttons_appeared | |
| # Reverse: Cancel closes the dialog and removes the added shape. | |
| restored_ok = False | |
| cancel = find_node_ci(dlg_nodes, "Cancel") | |
| if cancel: | |
| tap_node(cancel); settle("tap") | |
| r_nodes = ui() | |
| restored_ok = (len(find_by_class(r_nodes, "EditText")) == et_before | |
| and find_node_ci(r_nodes, "Clear") is None) | |
| and_back() | |
| ok = grew and restored_ok | |
| record("structure_edit_dialog_shape", ok, | |
| "" if ok else "behavior_wrong: dialog shape delta / restore not observed", | |
| depth=2, jump_kind="transition", | |
| expect="Edit Weight: EditText 0->1 + Clear/Cancel/OK appear; Cancel restores") | |
| def test_charts_surface(): | |
| """Charts is a distinct top-level surface: navigating to it makes the Charts | |
| title + its 'Time range' / 'Filter chart data' controls appear (a surface | |
| shape change) while the Overview empty-state entry disappears. depth=1 | |
| (and_enter_charts).""" | |
| and_reset_depth() | |
| clear_data() | |
| restart_app(); wait_for_foreground() | |
| before = and_showing(ui()) | |
| if not and_enter_charts(): | |
| record("structure_charts_surface", False, | |
| "setup_failed: could not navigate to Charts", | |
| depth=1, jump_kind="transition", | |
| expect="Charts surface appears (title + chart controls)") | |
| return | |
| nodes = ui() | |
| after = and_showing(nodes) | |
| grew = surface_changed(before, after) | |
| controls = bool(find_node(nodes, content_desc="Time range icon") | |
| or find_node(nodes, content_desc="Filter chart data")) | |
| title = bool(find_node(nodes, text="Charts")) | |
| ok = grew and controls and title | |
| record("structure_charts_surface", ok, | |
| "" if ok else "behavior_wrong: Charts surface / its controls did not appear", | |
| depth=1, jump_kind="transition", | |
| expect="Charts title + chart controls appeared; surface shape changed") | |
| def test_overview_populated_shape(): | |
| """Empty→populated Overview is a shape delta: after creating the first | |
| measurement the empty-state card ("No Measurements Yet") is replaced by an | |
| entry card region that adds per-entry edit/delete controls. Asserted as a | |
| surface delta plus the new per-entry controls appearing (a shape fact, not | |
| the value text). depth=1 (created a measurement via and_enter_measurement). | |
| NOTE: openScale's Save auto-navigates back to Overview — do NOT press Back.""" | |
| and_reset_depth() | |
| clear_data() | |
| restart_app(); wait_for_foreground() | |
| if not _create_user(): | |
| record("structure_overview_populated_shape", False, | |
| "setup_failed: could not create the prerequisite user", | |
| depth=1, jump_kind="transition", | |
| expect="empty Overview -> populated entry card (edit/delete controls appear)") | |
| return | |
| empty = and_showing(ui()) # "No Measurements Yet" state | |
| had_empty = find_node_ci(ui(), "Add Measurement") is not None | |
| if not and_enter_measurement(): | |
| record("structure_overview_populated_shape", False, | |
| "setup_failed: could not open New Measurement", | |
| depth=1, jump_kind="transition", | |
| expect="empty Overview -> populated entry card (edit/delete controls appear)") | |
| return | |
| save = find_node(ui(), content_desc="Save measurement") | |
| if not save: | |
| record("structure_overview_populated_shape", False, | |
| "feature_missing: no 'Save measurement' action", | |
| depth=1, jump_kind="transition", | |
| expect="empty Overview -> populated entry card (edit/delete controls appear)") | |
| return | |
| tap_node(save); settle("tap"); settle("tap") # lands on Overview automatically | |
| pop_nodes = ui() | |
| populated = and_showing(pop_nodes) | |
| grew = surface_changed(empty, populated) | |
| # A populated Overview adds per-entry controls; match by content-desc PREFIX | |
| # so no date literal is baked in (shape fact, not content). | |
| entry_ctrls = [n for n in pop_nodes | |
| if n.get("content-desc", "").startswith("Edit measurement from ") | |
| or n.get("content-desc", "").startswith("Delete measurement from ")] | |
| empty_gone = find_node_ci(pop_nodes, "Add Measurement") is None | |
| ok = had_empty and grew and len(entry_ctrls) >= 1 and empty_gone | |
| record("structure_overview_populated_shape", ok, | |
| "" if ok else "behavior_wrong: empty->populated Overview shape delta not observed", | |
| depth=1, jump_kind="transition", | |
| expect="empty-state card replaced by entry card; per-entry edit/delete controls appear") | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| # (3) VLM — 8 records on genuinely visual LAYOUT facts (spatial arrangement is | |
| # unreadable from the dump). Each asks about a SPECIFIC rendered property a | |
| # blank/dead screen would fail; expect="YES". Surface-crossing VLM records | |
| # are jump_kind="transition" and backed by and_enter_* helpers. Setup-failed | |
| # fallbacks carry an expect so no transition record is left without one. | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| def test_gate_card_layout_vlm(): | |
| """Overview empty state renders a single centered rounded card with an icon | |
| above stacked text and a filled pill button — a specific layout.""" | |
| and_reset_depth() | |
| clear_data() | |
| restart_app(); wait_for_foreground() | |
| vlm_assert("structure_gate_card", | |
| "Is there a single rounded card centered in the middle of the " | |
| "screen containing an icon above two lines of text and a filled " | |
| "pill-shaped button near its bottom?", | |
| RESULTS_DIR, expect="YES", depth=0, jump_kind="none", tag="layout") | |
| def test_drawer_sidesheet_position_vlm(): | |
| """The drawer is a side sheet anchored to the LEFT edge, with a colored | |
| header/logo at top and a vertical stack of menu items below it, while the | |
| right part of the screen is dimmed.""" | |
| and_reset_depth() | |
| clear_data() | |
| restart_app(); wait_for_foreground() | |
| om = find_node(ui(), content_desc="Open menu") | |
| tap_node(om); settle("tap") | |
| and_enter("drawer") | |
| vlm_assert("structure_drawer_sidesheet", | |
| "Is a navigation drawer panel occupying the LEFT side of the " | |
| "screen, with a colored header at the top and a vertical list of " | |
| "menu items below it, while the right edge of the screen is dimmed?", | |
| RESULTS_DIR, expect="YES", depth=1, jump_kind="transition", tag="position") | |
| def test_new_measurement_list_layout_vlm(): | |
| """New Measurement shows a vertical list of labelled rows, each with a | |
| circular colored icon at the left edge — a distinctive layout.""" | |
| and_reset_depth() | |
| clear_data() | |
| restart_app(); wait_for_foreground() | |
| if not (_create_user() and and_enter_measurement()): | |
| record("structure_measure_list_vlm", False, | |
| "setup_failed: could not reach New Measurement for VLM", | |
| depth=1, jump_kind="transition", tag="layout", | |
| expect="New Measurement vertical row list with left circular icons") | |
| return | |
| vlm_assert("structure_measure_list", | |
| "Is this a vertically scrolling list where each row has a " | |
| "circular colored icon at its left edge followed by a metric " | |
| "label, stacked one row per metric?", | |
| RESULTS_DIR, expect="YES", depth=1, jump_kind="transition", tag="layout") | |
| def test_new_measurement_icon_shape_vlm(): | |
| """Each metric row's leading icon is a filled CIRCLE (round colored badge), | |
| not a square or bare glyph — a shape fact.""" | |
| and_reset_depth() | |
| clear_data() | |
| restart_app(); wait_for_foreground() | |
| if not (_create_user() and and_enter_measurement()): | |
| record("structure_measure_icon_vlm", False, | |
| "setup_failed: could not reach New Measurement for VLM", | |
| depth=1, jump_kind="transition", tag="shape", | |
| expect="metric rows have round colored leading icons") | |
| return | |
| vlm_assert("structure_measure_icon", | |
| "At the left edge of the metric rows, are the icons round " | |
| "(circular) colored badges rather than square tiles or plain " | |
| "black glyphs with no background?", | |
| RESULTS_DIR, expect="YES", depth=1, jump_kind="transition", tag="shape") | |
| def test_new_measurement_steppers_position_vlm(): | |
| """Editable metric rows show up/down stepper arrows and a pencil edit icon | |
| aligned to the RIGHT edge of each row — a position fact.""" | |
| and_reset_depth() | |
| clear_data() | |
| restart_app(); wait_for_foreground() | |
| if not (_create_user() and and_enter_measurement()): | |
| record("structure_measure_steppers_vlm", False, | |
| "setup_failed: could not reach New Measurement for VLM", | |
| depth=1, jump_kind="transition", tag="position", | |
| expect="right-aligned up/down steppers + pencil per metric row") | |
| return | |
| vlm_assert("structure_measure_steppers", | |
| "On the right-hand side of the metric rows, are there stacked " | |
| "up and down arrow buttons next to a pencil (edit) icon, aligned " | |
| "to the right edge of each row?", | |
| RESULTS_DIR, expect="YES", depth=1, jump_kind="transition", tag="position") | |
| def test_settings_list_layout_vlm(): | |
| """Settings renders a single-column vertical list of menu rows, each a | |
| leading glyph icon followed by its label, evenly spaced top-to-bottom.""" | |
| and_reset_depth() | |
| clear_data() | |
| restart_app(); wait_for_foreground() | |
| if not and_enter_settings(): | |
| record("structure_settings_list_vlm", False, | |
| "setup_failed: could not reach Settings for VLM", | |
| depth=1, jump_kind="transition", tag="layout", | |
| expect="Settings single-column icon+label row list") | |
| return | |
| vlm_assert("structure_settings_list", | |
| "Is this a single-column vertical list of menu rows, each row an " | |
| "icon on the left followed by a text label, stacked and evenly " | |
| "spaced down the screen?", | |
| RESULTS_DIR, expect="YES", depth=1, jump_kind="transition", tag="layout") | |
| def test_charts_graph_area_vlm(): | |
| """The Charts screen renders a graph/plot area (canvas — never in the view | |
| tree). A blank screen or a plain list would fail this. shape fact.""" | |
| and_reset_depth() | |
| clear_data() | |
| restart_app(); wait_for_foreground() | |
| if not (_create_user() and and_enter_measurement()): | |
| record("structure_chart_area_vlm", False, | |
| "setup_failed: could not create data for Charts VLM", | |
| depth=1, jump_kind="transition", tag="shape", | |
| expect="Charts screen shows a chart/graph plotting area") | |
| return | |
| # Save a measurement so the chart has a datapoint, then open Charts. | |
| save = find_node(ui(), content_desc="Save measurement") | |
| if save: | |
| tap_node(save); settle("tap"); settle("tap") # lands back on Overview | |
| and_reset_depth() | |
| if not and_enter_charts(): | |
| record("structure_chart_area_vlm", False, | |
| "setup_failed: could not reach Charts for VLM", | |
| depth=1, jump_kind="transition", tag="shape", | |
| expect="Charts screen shows a chart/graph plotting area") | |
| return | |
| vlm_assert("structure_chart_area", | |
| "Below the top toolbar, is there a chart/graph plotting area " | |
| "(with an axis line or gridlines / plotted region) rather than " | |
| "only text rows or an empty blank space?", | |
| RESULTS_DIR, expect="YES", depth=1, jump_kind="transition", tag="shape") | |
| def test_overview_entry_card_layout_vlm(): | |
| """A populated Overview groups one measurement into a rounded entry card: | |
| a date heading at top with trash+pencil icons on the right, and metric rows | |
| (circular icon + label + value) below — a specific grouped layout. A Weight | |
| value is entered first so the card actually renders value rows.""" | |
| and_reset_depth() | |
| clear_data() | |
| restart_app(); wait_for_foreground() | |
| if not (_create_user() and and_enter_measurement()): | |
| record("structure_entry_card_vlm", False, | |
| "setup_failed: could not reach New Measurement for VLM", | |
| depth=1, jump_kind="transition", tag="layout", | |
| expect="populated Overview entry card groups date + value rows") | |
| return | |
| if not _save_weight_measurement("80"): | |
| record("structure_entry_card_vlm", False, | |
| "setup_failed: could not save a valued measurement for the card VLM", | |
| depth=1, jump_kind="transition", tag="layout", | |
| expect="populated Overview entry card groups date + value rows") | |
| return | |
| vlm_assert("structure_entry_card", | |
| "Is there a rounded card that groups a date heading at its top " | |
| "(with small trash and pencil icons on the top-right) above one " | |
| "or more metric rows, each row a circular icon with a label on " | |
| "the left and a value on the right?", | |
| RESULTS_DIR, expect="YES", depth=1, jump_kind="transition", tag="layout") | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| TESTS = [ | |
| test_gate_launch, | |
| test_gate_overview_surface, | |
| test_drawer_shape_delta, | |
| test_settings_row_count, | |
| test_new_measurement_row_count, | |
| test_edit_dialog_shape_delta, | |
| test_charts_surface, | |
| test_overview_populated_shape, | |
| test_gate_card_layout_vlm, | |
| test_drawer_sidesheet_position_vlm, | |
| test_new_measurement_list_layout_vlm, | |
| test_new_measurement_icon_shape_vlm, | |
| test_new_measurement_steppers_position_vlm, | |
| test_settings_list_layout_vlm, | |
| test_charts_graph_area_vlm, | |
| test_overview_entry_card_layout_vlm, | |
| ] | |
| if __name__ == "__main__": | |
| run_suite(TESTS, "structure") | |