Datasets:
Download android/patzly-doodle-android/tests/test_android_text.py from Qwen/RecreationBench: direct link, hf CLI and curl.
- Browser
- Download file 33.6 kB
-
https://huggingface.co/datasets/Qwen/RecreationBench/resolve/main/android/patzly-doodle-android/tests/test_android_text.py
- Command line
-
hf download hf://datasets/Qwen/RecreationBench/android/patzly-doodle-android/tests/test_android_text.py
-
curl -L -o test_android_text.py https://huggingface.co/datasets/Qwen/RecreationBench/resolve/main/android/patzly-doodle-android/tests/test_android_text.py
33.6 kB
| #!/usr/bin/env python3 | |
| """TEXT lane — Doodle live-wallpaper customization app. | |
| This lane owns CONTENT STRINGS: dynamic value labels, sheet/menu strings produced | |
| by an action, and app-unique static content strings that appear once a surface is | |
| reached. Every test is TRIGGER -> OBSERVATION of a specific string in a fresh tree. | |
| Ground-truth note (observed on the running original, NOT the recon): | |
| * Home toolbar title is "Doodle"; the info banner paragraph is content. | |
| * Appearance's `text_appearance_colors_description` == "Used by the system's | |
| theming engine"; Other's same-id element reads "Try another look". | |
| * The random-design group has Off / "Daily at 3:00 AM" / "Every 1 hour" and a | |
| "Change time" label that is ALWAYS present (only its enabled bit changes) — so | |
| the random labels are asserted as CONTENT strings, not as a text-reveal. | |
| * Overflow ("More options") yields "Send feedback", "Help", "Share". | |
| * The Changelog sheet body ("6.0.1"/"6.0.0" + bullet lines) DOES reach the view | |
| tree, so those are RULE assertions; the 2 VLM records test rendered LAYOUT | |
| (heading-above-bullets, banner-card-at-top) that the flat dump cannot verify. | |
| uiautomator returns '&' as '&'; every comparison normalizes with html.unescape. | |
| """ | |
| import html | |
| import os | |
| import sys | |
| sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) | |
| from android_testgen_kit import * # noqa: F403,E402 | |
| # ── string helpers ─────────────────────────────────────────────────────────── | |
| def norm(s: str) -> str: | |
| """Unescape entities and casefold-strip for tolerant word comparison.""" | |
| return html.unescape(s or "").strip().casefold() | |
| def all_text(nodes) -> str: | |
| """Every visible text + content-desc, entity-normalized, one blob.""" | |
| parts = [] | |
| for n in nodes: | |
| t = n.get("text", "") | |
| cd = n.get("content-desc", "") | |
| if t: | |
| parts.append(html.unescape(t)) | |
| if cd: | |
| parts.append(html.unescape(cd)) | |
| return " | ".join(parts) | |
| def has_text(nodes, target: str) -> bool: | |
| """True iff some node's text/content-desc EQUALS target (entity-normalized).""" | |
| tgt = norm(target) | |
| for n in nodes: | |
| if norm(n.get("text", "")) == tgt or norm(n.get("content-desc", "")) == tgt: | |
| return True | |
| return False | |
| def has_substr(nodes, target: str) -> bool: | |
| """True iff target (normalized) appears as a substring of the tree blob.""" | |
| return norm(target) in norm(all_text(nodes)) | |
| def id_text_equals(nodes, rid_suffix: str, expected: str) -> bool: | |
| """The node with resource-id ending rid_suffix has text == expected (norm).""" | |
| n = node_by_id(nodes, rid_suffix) | |
| return bool(n) and norm(n.get("text", "")) == norm(expected) | |
| # ── depth-backing navigation helpers (named and_reach_* / and_enter_*) ───────── | |
| def _tap_row(text: str) -> bool: | |
| n = find_node(ui(), text=text) or find_node_ci(ui(), text) | |
| return tap_node(n) if n else False | |
| def and_reach_appearance() -> bool: | |
| """Home -> Appearance. Verified by a surface-UNIQUE element: the colors | |
| description string that only Appearance shows.""" | |
| if not _tap_row("Appearance"): | |
| return False | |
| nodes = ui() | |
| ok = id_text_equals(nodes, "text_appearance_colors_description", | |
| "Used by the system's theming engine") \ | |
| or has_text(nodes, "Night mode") | |
| if ok: | |
| and_enter("appearance") | |
| return ok | |
| def and_reach_parallax() -> bool: | |
| """Home -> Parallax. Verified by the unique 'Swiping' category header.""" | |
| if not _tap_row("Parallax"): | |
| return False | |
| nodes = ui() | |
| ok = has_text(nodes, "Swiping") and has_text(nodes, "Tilting") | |
| if ok: | |
| and_enter("parallax") | |
| return ok | |
| def and_reach_other() -> bool: | |
| """Home -> Other options. Verified by the unique language value row.""" | |
| if not _tap_row("Other options"): | |
| return False | |
| nodes = ui() | |
| ok = node_by_id(nodes, "text_other_language") is not None \ | |
| and has_text(nodes, "App color theme") | |
| if ok: | |
| and_enter("other") | |
| return ok | |
| def and_reach_about() -> bool: | |
| """Home -> About. Verified by the developer name row unique to About.""" | |
| if not _tap_row("About"): | |
| return False | |
| nodes = ui() | |
| ok = has_text(nodes, "Patrick Zedler") and has_text(nodes, "Version") | |
| if ok: | |
| and_enter("about") | |
| return ok | |
| def and_reach_changelog_sheet() -> bool: | |
| """About -> Changelog bottom sheet (depth 2). Verified by the first entry | |
| version string '6.0.1' that only the sheet body shows.""" | |
| if not and_reach_about(): | |
| return False | |
| if not _tap_row("Changelog"): | |
| return False | |
| nodes = ui() | |
| ok = has_text(nodes, "6.0.1") or has_substr(nodes, "New:") | |
| if ok: | |
| and_enter("changelog_sheet") | |
| return ok | |
| def and_reach_colors_sheet() -> bool: | |
| """Appearance -> Colors bottom sheet (depth 2). Taps a clickable color card | |
| inside the colors container; verified by the sheet title.""" | |
| if not and_reach_appearance(): | |
| return False | |
| nodes = ui() | |
| cont = node_by_id(nodes, "linear_appearance_colors_container") | |
| if not cont or "_bounds" not in cont: | |
| return False | |
| cx1, cy1, cx2, cy2 = cont["_bounds"] | |
| card = None | |
| for n in nodes: | |
| b = n.get("_bounds") | |
| if not b or "CardView" not in n.get("class", ""): | |
| continue | |
| if n.get("clickable") != "true": | |
| continue | |
| x1, y1, x2, y2 = b | |
| if y1 >= cy1 - 20 and y2 <= cy2 + 20 and x1 >= cx1 - 20: | |
| card = n | |
| break | |
| if not card or not safe_tap(card): | |
| return False | |
| nodes = ui() | |
| ok = has_text(nodes, "Choose primary color") | |
| if ok: | |
| and_enter("colors_sheet") | |
| return ok | |
| def and_open_overflow(nodes) -> bool: | |
| """Tap the toolbar 'More options' icon (a produced popup, not a surface jump — | |
| no and_enter, this stays depth 0 for the popup-item assertions).""" | |
| n = find_node(nodes, content_desc="More options") | |
| return safe_tap(n) if n else False | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| # HOME / OVERVIEW content strings (depth 0) | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| def test_home_info_banner(): | |
| restart_app() | |
| wait_for_foreground() | |
| banner = ("Colorful live wallpaper with auto dark mode and power-efficient " | |
| "animations. Customize it to your needs!") | |
| ok = has_text(ui(), banner) | |
| record("text_home_info_banner", ok, | |
| "" if ok else "behavior_wrong: home info banner paragraph string not found", | |
| depth=0, jump_kind="none", expect="banner reads '%s'" % banner[:40]) | |
| def test_home_row_titles(): | |
| restart_app() | |
| wait_for_foreground() | |
| nodes = ui() | |
| wanted = ["Appearance", "Parallax", "Shape size", "Other options", "About"] | |
| missing = [w for w in wanted if not has_text(nodes, w)] | |
| ok = not missing | |
| record("text_home_row_titles", ok, | |
| "" if ok else "behavior_wrong: missing home row title(s): %s" % missing, | |
| depth=0, jump_kind="none", | |
| expect="rows Appearance/Parallax/Shape size/Other options/About") | |
| def test_home_row_descriptions(): | |
| restart_app() | |
| wait_for_foreground() | |
| nodes = ui() | |
| # Stored/rendered with '&' -> '&'; has_text normalizes via html.unescape. | |
| wanted = ["Design & color options", "Swipe & tilt effect", | |
| "Scale & zoom effect", "Rendering, language & reset", | |
| "Developer info & more"] | |
| missing = [w for w in wanted if not has_text(nodes, w)] | |
| ok = not missing | |
| record("text_home_row_descriptions", ok, | |
| "" if ok else "behavior_wrong: missing home row description(s): %s" % missing, | |
| depth=0, jump_kind="none", expect="'Design & color options' etc.") | |
| def test_home_banner_buttons(): | |
| restart_app() | |
| wait_for_foreground() | |
| nodes = ui() | |
| ok = has_text(nodes, "Learn more") and has_text(nodes, "Help") | |
| record("text_home_learn_more_help", ok, | |
| "" if ok else "behavior_wrong: banner buttons 'Learn more'/'Help' not found", | |
| depth=0, jump_kind="none", expect="buttons 'Learn more' and 'Help'") | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| # OVERFLOW MENU — strings PRODUCED by opening the popup (transition, depth 0) | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| def test_overflow_send_feedback(): | |
| restart_app() | |
| wait_for_foreground() | |
| absent = not has_text(ui(), "Send feedback") | |
| if not and_open_overflow(ui()): | |
| record("text_overflow_send_feedback", False, | |
| "setup_failed: could not open the overflow (More options) menu", | |
| depth=0, jump_kind="transition", expect="menu item 'Send feedback'") | |
| return | |
| present = has_text(ui(), "Send feedback") | |
| ok = absent and present | |
| record("text_overflow_send_feedback", ok, | |
| "" if ok else "behavior_wrong: 'Send feedback' not produced by overflow menu", | |
| depth=0, jump_kind="transition", expect="menu item 'Send feedback' appears") | |
| def test_overflow_share(): | |
| restart_app() | |
| wait_for_foreground() | |
| absent = not has_text(ui(), "Share") | |
| if not and_open_overflow(ui()): | |
| record("text_overflow_share", False, | |
| "setup_failed: could not open the overflow (More options) menu", | |
| depth=0, jump_kind="transition", expect="menu item 'Share'") | |
| return | |
| present = has_text(ui(), "Share") | |
| ok = absent and present | |
| record("text_overflow_share", ok, | |
| "" if ok else "behavior_wrong: 'Share' not produced by overflow menu", | |
| depth=0, jump_kind="transition", expect="menu item 'Share' appears") | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| # APPEARANCE fragment content strings (depth 1) | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| def test_appearance_headers(): | |
| restart_app() | |
| wait_for_foreground() | |
| before = not has_text(ui(), "Night mode") | |
| if not and_reach_appearance(): | |
| record("text_appearance_category_headers", False, | |
| "setup_failed: could not reach the Appearance fragment", | |
| depth=1, jump_kind="value", expect="headers Design/Variant/Colors/Night mode") | |
| return | |
| nodes = ui() | |
| wanted = ["Design", "Variant", "Colors", "Night mode"] | |
| missing = [w for w in wanted if not has_text(nodes, w)] | |
| ok = before and not missing | |
| record("text_appearance_category_headers", ok, | |
| "" if ok else "behavior_wrong: missing Appearance header(s): %s" % missing, | |
| depth=1, jump_kind="value", | |
| expect="headers Design/Variant/Colors/Night mode present") | |
| def test_appearance_colors_description(): | |
| restart_app() | |
| wait_for_foreground() | |
| target = "Used by the system's theming engine" | |
| before = not has_substr(ui(), target) | |
| if not and_reach_appearance(): | |
| record("text_appearance_colors_description", False, | |
| "setup_failed: could not reach the Appearance fragment", | |
| depth=1, jump_kind="value", expect="'%s'" % target) | |
| return | |
| present = id_text_equals(ui(), "text_appearance_colors_description", target) | |
| ok = before and present | |
| record("text_appearance_colors_description", ok, | |
| "" if ok else "behavior_wrong: colors description not '%s'" % target, | |
| depth=1, jump_kind="value", expect="colors description reads '%s'" % target) | |
| def test_appearance_night_mode_labels(): | |
| restart_app() | |
| wait_for_foreground() | |
| if not and_reach_appearance(): | |
| record("text_appearance_night_mode_labels", False, | |
| "setup_failed: could not reach the Appearance fragment", | |
| depth=1, jump_kind="value", expect="Auto/On/Off night-mode labels") | |
| return | |
| nodes = ui() | |
| labels = { | |
| "button_appearance_night_mode_auto": "Auto", | |
| "button_appearance_night_mode_on": "On", | |
| "button_appearance_night_mode_off": "Off", | |
| } | |
| bad = [rid for rid, txt in labels.items() if not id_text_equals(nodes, rid, txt)] | |
| ok = not bad | |
| record("text_appearance_night_mode_labels", ok, | |
| "" if ok else "behavior_wrong: night-mode label mismatch on %s" % bad, | |
| depth=1, jump_kind="value", expect="night-mode buttons Auto/On/Off") | |
| def test_appearance_random_labels(): | |
| restart_app() | |
| wait_for_foreground() | |
| if not and_reach_appearance(): | |
| record("text_appearance_random_labels", False, | |
| "setup_failed: could not reach the Appearance fragment", | |
| depth=1, jump_kind="value", expect="random-design button labels") | |
| return | |
| # The random group is below the fold; bring the group heading into view. | |
| scroll_into_view("Random wallpaper design") | |
| nodes = ui() | |
| labels = { | |
| "button_appearance_random_off": "Off", | |
| "button_appearance_random_daily": "Daily at 3:00 AM", | |
| "button_appearance_random_interval": "Every 1 hour", | |
| } | |
| bad = [rid for rid, txt in labels.items() if not id_text_equals(nodes, rid, txt)] | |
| ok = not bad | |
| record("text_appearance_random_labels", ok, | |
| "" if ok else "behavior_wrong: random-design label mismatch on %s" % bad, | |
| depth=1, jump_kind="value", | |
| expect="random buttons Off / 'Daily at 3:00 AM' / 'Every 1 hour'") | |
| def test_appearance_random_group_title(): | |
| restart_app() | |
| wait_for_foreground() | |
| before = not has_text(ui(), "Random wallpaper design") | |
| if not and_reach_appearance(): | |
| record("text_appearance_random_group_title", False, | |
| "setup_failed: could not reach the Appearance fragment", | |
| depth=1, jump_kind="value", expect="'Random wallpaper design'") | |
| return | |
| present = scroll_into_view("Random wallpaper design") is not None | |
| ok = before and present | |
| record("text_appearance_random_group_title", ok, | |
| "" if ok else "behavior_wrong: 'Random wallpaper design' title not found", | |
| depth=1, jump_kind="value", expect="group title 'Random wallpaper design'") | |
| def test_appearance_change_time_label(): | |
| restart_app() | |
| wait_for_foreground() | |
| if not and_reach_appearance(): | |
| record("text_appearance_change_time_label", False, | |
| "setup_failed: could not reach the Appearance fragment", | |
| depth=1, jump_kind="value", expect="'Change time' label") | |
| return | |
| scroll_into_view("Random wallpaper design") | |
| present = id_text_equals(ui(), "button_appearance_random_time", "Change time") | |
| record("text_appearance_change_time_label", present, | |
| "" if present else "behavior_wrong: 'Change time' label text not found", | |
| depth=1, jump_kind="value", expect="button label 'Change time'") | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| # COLORS bottom sheet — title PRODUCED by opening the sheet (transition, depth 2) | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| def test_colors_sheet_title(): | |
| restart_app() | |
| wait_for_foreground() | |
| if not and_reach_appearance(): | |
| record("text_colors_sheet_title", False, | |
| "setup_failed: could not reach the Appearance fragment", | |
| depth=1, jump_kind="transition", expect="'Choose primary color'") | |
| return | |
| absent = not has_text(ui(), "Choose primary color") | |
| # reach the sheet (re-navigates Appearance internally is avoided: reuse helper | |
| # that opens the sheet from the CURRENT Appearance surface would double-enter, | |
| # so open the color card here directly). | |
| nodes = ui() | |
| cont = node_by_id(nodes, "linear_appearance_colors_container") | |
| tapped = False | |
| if cont and "_bounds" in cont: | |
| cx1, cy1, cx2, cy2 = cont["_bounds"] | |
| for n in nodes: | |
| b = n.get("_bounds") | |
| if (b and "CardView" in n.get("class", "") | |
| and n.get("clickable") == "true" | |
| and b[1] >= cy1 - 20 and b[3] <= cy2 + 20 and b[0] >= cx1 - 20): | |
| tapped = safe_tap(n) | |
| break | |
| if not tapped: | |
| record("text_colors_sheet_title", False, | |
| "setup_failed: no tappable color card in the colors container", | |
| depth=1, jump_kind="transition", expect="'Choose primary color'") | |
| return | |
| and_enter("colors_sheet") | |
| present = has_text(ui(), "Choose primary color") | |
| ok = absent and present | |
| record("text_colors_sheet_title", ok, | |
| "" if ok else "behavior_wrong: colors sheet title 'Choose primary color' not produced", | |
| depth=2, jump_kind="transition", expect="sheet title 'Choose primary color'") | |
| vlm_assert("text_colors_sheet_title", | |
| "Is the heading text 'Choose primary color' shown centered at the " | |
| "top of a bottom sheet that is overlaid on the lower part of the " | |
| "screen?", RESULTS_DIR, tag="position") | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| # OTHER options fragment — dynamic language VALUE + headers (depth 1) | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| def test_other_language_value(): | |
| restart_app() | |
| wait_for_foreground() | |
| before = node_by_id(ui(), "text_other_language") is None | |
| if not and_reach_other(): | |
| record("text_other_language_value", False, | |
| "setup_failed: could not reach the Other options fragment", | |
| depth=1, jump_kind="value", expect="language value 'Follow system'") | |
| return | |
| present = id_text_equals(ui(), "text_other_language", "Follow system") | |
| ok = before and present | |
| record("text_other_language_value", ok, | |
| "" if ok else "behavior_wrong: language value is not 'Follow system'", | |
| depth=1, jump_kind="value", expect="text_other_language reads 'Follow system'") | |
| def test_other_language_row_label(): | |
| restart_app() | |
| wait_for_foreground() | |
| if not and_reach_other(): | |
| record("text_other_language_row_label", False, | |
| "setup_failed: could not reach the Other options fragment", | |
| depth=1, jump_kind="value", expect="row label 'Language'") | |
| return | |
| ok = has_text(ui(), "Language") | |
| record("text_other_language_row_label", ok, | |
| "" if ok else "behavior_wrong: 'Language' row label not found on Other", | |
| depth=1, jump_kind="value", expect="row label 'Language'") | |
| def test_other_category_headers(): | |
| restart_app() | |
| wait_for_foreground() | |
| before = not has_text(ui(), "App color theme") | |
| if not and_reach_other(): | |
| record("text_other_category_headers", False, | |
| "setup_failed: could not reach the Other options fragment", | |
| depth=1, jump_kind="value", expect="headers 'App color theme'/'Contrast'") | |
| return | |
| nodes = ui() | |
| ok = before and has_text(nodes, "App color theme") and has_text(nodes, "Contrast") | |
| record("text_other_category_headers", ok, | |
| "" if ok else "behavior_wrong: 'App color theme'/'Contrast' headers not found", | |
| depth=1, jump_kind="value", expect="headers 'App color theme' and 'Contrast'") | |
| def test_other_theme_labels(): | |
| restart_app() | |
| wait_for_foreground() | |
| if not and_reach_other(): | |
| record("text_other_theme_labels", False, | |
| "setup_failed: could not reach the Other options fragment", | |
| depth=1, jump_kind="value", expect="theme buttons Auto/Light/Dark") | |
| return | |
| nodes = ui() | |
| labels = { | |
| "button_other_theme_auto": "Auto", | |
| "button_other_theme_light": "Light", | |
| "button_other_theme_dark": "Dark", | |
| } | |
| bad = [rid for rid, txt in labels.items() if not id_text_equals(nodes, rid, txt)] | |
| ok = not bad | |
| record("text_other_theme_labels", ok, | |
| "" if ok else "behavior_wrong: app-color-theme label mismatch on %s" % bad, | |
| depth=1, jump_kind="value", expect="theme buttons Auto/Light/Dark") | |
| def test_other_contrast_labels(): | |
| restart_app() | |
| wait_for_foreground() | |
| if not and_reach_other(): | |
| record("text_other_contrast_labels", False, | |
| "setup_failed: could not reach the Other options fragment", | |
| depth=1, jump_kind="value", expect="contrast buttons Standard/Medium/High") | |
| return | |
| nodes = ui() | |
| labels = { | |
| "button_other_contrast_standard": "Standard", | |
| "button_other_contrast_medium": "Medium", | |
| "button_other_contrast_high": "High", | |
| } | |
| bad = [rid for rid, txt in labels.items() if not id_text_equals(nodes, rid, txt)] | |
| ok = not bad | |
| record("text_other_contrast_labels", ok, | |
| "" if ok else "behavior_wrong: contrast label mismatch on %s" % bad, | |
| depth=1, jump_kind="value", expect="contrast buttons Standard/Medium/High") | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| # PARALLAX fragment — category headers (depth 1) | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| def test_parallax_headers(): | |
| restart_app() | |
| wait_for_foreground() | |
| before = not (has_text(ui(), "Swiping") and has_text(ui(), "Tilting")) | |
| if not and_reach_parallax(): | |
| record("text_parallax_headers", False, | |
| "setup_failed: could not reach the Parallax fragment", | |
| depth=1, jump_kind="value", expect="headers 'Swiping'/'Tilting'") | |
| return | |
| nodes = ui() | |
| ok = before and has_text(nodes, "Swiping") and has_text(nodes, "Tilting") | |
| record("text_parallax_headers", ok, | |
| "" if ok else "behavior_wrong: 'Swiping'/'Tilting' headers not found", | |
| depth=1, jump_kind="value", expect="headers 'Swiping' and 'Tilting'") | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| # ABOUT fragment content strings (depth 1) | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| def test_about_version_label(): | |
| restart_app() | |
| wait_for_foreground() | |
| before = not has_text(ui(), "Version") | |
| if not and_reach_about(): | |
| record("text_about_version_label", False, | |
| "setup_failed: could not reach the About fragment", | |
| depth=1, jump_kind="value", expect="label 'Version'") | |
| return | |
| # Assert the LABEL string only — never the version NUMBER (recreation-unknown). | |
| present = has_text(ui(), "Version") | |
| ok = before and present | |
| record("text_about_version_label", ok, | |
| "" if ok else "behavior_wrong: 'Version' label not found on About", | |
| depth=1, jump_kind="value", expect="label 'Version'") | |
| def test_about_developer_name(): | |
| restart_app() | |
| wait_for_foreground() | |
| before = not has_text(ui(), "Patrick Zedler") | |
| if not and_reach_about(): | |
| record("text_about_developer_name", False, | |
| "setup_failed: could not reach the About fragment", | |
| depth=1, jump_kind="value", expect="developer 'Patrick Zedler'") | |
| return | |
| present = has_text(ui(), "Patrick Zedler") | |
| ok = before and present | |
| record("text_about_developer_name", ok, | |
| "" if ok else "behavior_wrong: developer name 'Patrick Zedler' not found", | |
| depth=1, jump_kind="value", expect="developer value 'Patrick Zedler'") | |
| def test_about_changelog_row(): | |
| restart_app() | |
| wait_for_foreground() | |
| if not and_reach_about(): | |
| record("text_about_changelog_row", False, | |
| "setup_failed: could not reach the About fragment", | |
| depth=1, jump_kind="value", expect="row 'Changelog' / 'What's new?'") | |
| return | |
| nodes = ui() | |
| ok = has_text(nodes, "Changelog") and has_text(nodes, "What's new?") | |
| record("text_about_changelog_row", ok, | |
| "" if ok else "behavior_wrong: Changelog row 'Changelog'/'What's new?' not found", | |
| depth=1, jump_kind="value", expect="row 'Changelog' with 'What's new?'") | |
| def test_about_link_rows(): | |
| restart_app() | |
| wait_for_foreground() | |
| if not and_reach_about(): | |
| record("text_about_link_rows", False, | |
| "setup_failed: could not reach the About fragment", | |
| depth=1, jump_kind="value", expect="rows Google Play/GitHub/Source code") | |
| return | |
| nodes = ui() | |
| wanted = ["Google Play", "GitHub", "Source code", "Transifex", "Privacy policy"] | |
| missing = [w for w in wanted if not has_text(nodes, w)] | |
| ok = not missing | |
| record("text_about_link_rows", ok, | |
| "" if ok else "behavior_wrong: missing About link row(s): %s" % missing, | |
| depth=1, jump_kind="value", | |
| expect="rows Google Play/GitHub/Source code/Transifex/Privacy policy") | |
| def test_about_license_rows(): | |
| restart_app() | |
| wait_for_foreground() | |
| if not and_reach_about(): | |
| record("text_about_license_rows", False, | |
| "setup_failed: could not reach the About fragment", | |
| depth=1, jump_kind="value", expect="license rows Jost* Typeface/Owen Earl") | |
| return | |
| # License rows sit below the fold on some screens; bring one into view. | |
| scroll_into_view("Jost* Typeface") | |
| nodes = ui() | |
| ok = (has_text(nodes, "Jost* Typeface") and has_text(nodes, "Owen Earl") | |
| and has_text(nodes, "Material Components Android")) | |
| record("text_about_license_rows", ok, | |
| "" if ok else "behavior_wrong: open-source license rows not found", | |
| depth=1, jump_kind="value", | |
| expect="'Jost* Typeface'/'Owen Earl'/'Material Components Android'") | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| # CHANGELOG bottom sheet — strings PRODUCED by opening it (transition, depth 2) | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| def test_changelog_sheet_title(): | |
| restart_app() | |
| wait_for_foreground() | |
| absent = not has_text(ui(), "6.0.1") | |
| if not and_reach_changelog_sheet(): | |
| record("text_changelog_sheet_title", False, | |
| "setup_failed: could not open the Changelog bottom sheet", | |
| depth=2, jump_kind="transition", expect="sheet title 'Changelog'") | |
| return | |
| present = has_text(ui(), "Changelog") | |
| ok = present | |
| record("text_changelog_sheet_title", ok, | |
| "" if ok else "behavior_wrong: Changelog sheet title 'Changelog' not produced", | |
| depth=2, jump_kind="transition", expect="sheet title 'Changelog'") | |
| def test_changelog_entry_versions(): | |
| restart_app() | |
| wait_for_foreground() | |
| absent = not (has_text(ui(), "6.0.1") or has_text(ui(), "6.0.0")) | |
| if not and_reach_changelog_sheet(): | |
| record("text_changelog_entry_versions", False, | |
| "setup_failed: could not open the Changelog bottom sheet", | |
| depth=2, jump_kind="transition", expect="entries '6.0.1' and '6.0.0'") | |
| return | |
| nodes = ui() | |
| present = has_text(nodes, "6.0.1") and has_text(nodes, "6.0.0") | |
| ok = absent and present | |
| record("text_changelog_entry_versions", ok, | |
| "" if ok else "behavior_wrong: changelog entries '6.0.1'/'6.0.0' not produced", | |
| depth=2, jump_kind="transition", expect="entry versions '6.0.1' and '6.0.0'") | |
| # VLM: the version acts as a large heading rendered ABOVE its bullet lines — | |
| # a layout property the flat dump text order cannot verify. | |
| vlm_assert("text_changelog_entry_versions", | |
| "In the Changelog bottom sheet, is the version number '6.0.0' shown " | |
| "as a large bold heading positioned above a list of bullet-point " | |
| "lines?", RESULTS_DIR, tag="position") | |
| def test_changelog_entry_bullets(): | |
| restart_app() | |
| wait_for_foreground() | |
| if not and_reach_changelog_sheet(): | |
| record("text_changelog_entry_bullets", False, | |
| "setup_failed: could not open the Changelog bottom sheet", | |
| depth=2, jump_kind="transition", expect="a 'New:'/'Improved:' bullet line") | |
| return | |
| nodes = ui() | |
| # The body lines observed on the original changelog sheet. | |
| ok = (has_substr(nodes, "support for Android 14") | |
| or has_substr(nodes, "dynamic contrast for app themes")) | |
| record("text_changelog_entry_bullets", ok, | |
| "" if ok else "behavior_wrong: changelog bullet body lines not found", | |
| depth=2, jump_kind="transition", | |
| expect="bullet line 'New: support for Android 14 & 15'") | |
| TESTS = [ | |
| test_home_info_banner, | |
| test_home_row_titles, | |
| test_home_row_descriptions, | |
| test_home_banner_buttons, | |
| test_overflow_send_feedback, | |
| test_overflow_share, | |
| test_appearance_headers, | |
| test_appearance_colors_description, | |
| test_appearance_night_mode_labels, | |
| test_appearance_random_labels, | |
| test_appearance_random_group_title, | |
| test_appearance_change_time_label, | |
| test_colors_sheet_title, | |
| test_other_language_value, | |
| test_other_language_row_label, | |
| test_other_category_headers, | |
| test_other_theme_labels, | |
| test_other_contrast_labels, | |
| test_parallax_headers, | |
| test_about_version_label, | |
| test_about_developer_name, | |
| test_about_changelog_row, | |
| test_about_link_rows, | |
| test_about_license_rows, | |
| test_changelog_sheet_title, | |
| test_changelog_entry_versions, | |
| test_changelog_entry_bullets, | |
| ] | |
| if __name__ == "__main__": | |
| run_suite(TESTS, "text") | |