Datasets:
File size: 30,323 Bytes
c1c6a0c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | #!/usr/bin/env python3
"""TEXT lane — QuickTile Settings.
Sole owner of exact-string equality: every test here asserts the EXACT visible
string an interaction PRODUCES (a dialog title/body an action opens, a reveal
label a toggle exposes, a warning a tab swap shows). The discriminating half is
always the CHANGE: the string is ABSENT before the trigger and PRESENT after, so
a hardcoded shell that renders the label at launch cannot pass.
Strings were captured live from the ORIGINAL app's uiautomator dump; each is a
content fact (never a version/build string). Run:
python3 test_android_text.py com.rbn.qtsettings /workspace/testgen/eval
"""
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from android_testgen_kit import * # noqa: F403,E402
# ── helpers ──────────────────────────────────────────────────────────────────
def all_text(nodes):
"""Every non-empty `text` on the surface, pipe-joined (for substring checks)."""
return " | ".join(n.get("text", "") for n in nodes if n.get("text"))
def text_present(nodes, needle):
"""Case-insensitive substring over the joined visible text."""
return needle.strip().lower() in all_text(nodes).lower()
def has_exact_text(nodes, value):
"""A standalone TextView whose `text` EQUALS value (avoids the substring trap
where a title is contained in a trigger's content-desc)."""
v = value.strip()
for n in nodes:
if n.get("text", "").strip() == v:
return True
return False
def open_main_default():
"""Guaranteed clean default surface (pm clear wipes to defaults, then launch)."""
clear_data()
launch_app()
wait_for_foreground()
def and_enter_dialog(trigger_desc="", trigger_text=""):
"""Tap a trigger that opens an overlay dialog, then count one surface.
Backs a declared depth>=1 for dialog-body tests: it is a real member of the
and_enter* family, so the depth audit sees the navigation it was told about.
Returns True when the trigger was found and tapped.
"""
n = None
if trigger_desc:
n = find_node(ui(), content_desc=trigger_desc)
if n is None and trigger_text:
n = find_node(ui(), text=trigger_text) or find_node_ci(ui(), trigger_text)
if n is None or not tap_node(n):
return False
and_enter(trigger_desc or trigger_text)
return True
def and_enter_shortcut_screen():
"""Navigate Main -> Shortcut Actions, counting one surface (backs depth>=1)."""
ic = find_node(ui(), content_desc="Open shortcut settings")
if ic is None or not tap_node(ic):
return False
and_enter("Shortcut Actions")
return True
def open_usb_tab():
"""Swap to the USB Debugging tab (a page swap within S0, depth 0)."""
tab = find_node(ui(), text="USB Debugging")
return bool(tab) and tap_node(tab)
# ══════════════════════════════════════════════════════════════════════════════
# About dialog (D1) — labels an action (Help icon) produces
# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("text_about_features_label",))
def test_about_features_label():
open_main_default()
absent = not text_present(ui(), "Features")
if not and_enter_dialog(trigger_desc="Help / Grant Permission"):
record("text_about_features_label", False,
"setup_failed: Help / Grant Permission icon not found on main surface",
depth=1, jump_kind="value", expect="'Features' header in About dialog")
return
present = has_exact_text(ui(), "Features")
ok = absent and present
record("text_about_features_label", ok,
"" if ok else "behavior_wrong: About dialog did not show the 'Features' header",
depth=1, jump_kind="value", expect="About dialog shows header 'Features'")
@and_test(expects=("text_about_developer_label",))
def test_about_developer_label():
open_main_default()
absent = not text_present(ui(), "Developer")
if not and_enter_dialog(trigger_desc="Help / Grant Permission"):
record("text_about_developer_label", False,
"setup_failed: Help / Grant Permission icon not found on main surface",
depth=1, jump_kind="value", expect="'Developer' header in About dialog")
return
present = has_exact_text(ui(), "Developer")
ok = absent and present
record("text_about_developer_label", ok,
"" if ok else "behavior_wrong: About dialog did not show the 'Developer' header",
depth=1, jump_kind="value", expect="About dialog shows header 'Developer'")
@and_test(expects=("text_about_permission_help_label",))
def test_about_permission_help_label():
open_main_default()
absent = not text_present(ui(), "Permission Setup Help")
if not and_enter_dialog(trigger_desc="Help / Grant Permission"):
record("text_about_permission_help_label", False,
"setup_failed: Help / Grant Permission icon not found on main surface",
depth=1, jump_kind="value", expect="'Permission Setup Help' in About dialog")
return
present = has_exact_text(ui(), "Permission Setup Help")
ok = absent and present
record("text_about_permission_help_label", ok,
"" if ok else "behavior_wrong: About dialog missing 'Permission Setup Help' button",
depth=1, jump_kind="value",
expect="About dialog shows button 'Permission Setup Help'")
@and_test(expects=("text_about_feature_bullet", "text_about_feature_bullet_vlm"))
def test_about_feature_bullet():
# The Features list bullet text — a content fact the About dialog produces.
open_main_default()
bullet = "Private DNS tile with custom hostname support"
absent = not text_present(ui(), bullet)
if not and_enter_dialog(trigger_desc="Help / Grant Permission"):
record("text_about_feature_bullet", False,
"setup_failed: Help / Grant Permission icon not found on main surface",
depth=1, jump_kind="value", expect=f"bullet '{bullet}'")
vlm_assert("text_about_feature_bullet",
"Is there a bulleted 'Features' list in the dialog with an entry "
"about a Private DNS tile with custom hostname support?",
RESULTS_DIR, tag="layout", depth=1)
return
present = text_present(ui(), bullet)
ok = absent and present
record("text_about_feature_bullet", ok,
"" if ok else "behavior_wrong: About Features list missing the DNS-tile bullet",
depth=1, jump_kind="value",
expect=f"About Features list contains '{bullet}'")
# The bulleted block as RENDERED (layout of a multi-line list under 'Features').
vlm_assert("text_about_feature_bullet",
"In this dialog, is there a section headed 'Features' followed by a "
"vertical bulleted list of several short feature lines?",
RESULTS_DIR, tag="layout", depth=1)
@and_test(expects=("text_about_description",))
def test_about_description():
open_main_default()
phrase = "Quick Settings tiles"
absent = not text_present(ui(), phrase)
if not and_enter_dialog(trigger_desc="Help / Grant Permission"):
record("text_about_description", False,
"setup_failed: Help / Grant Permission icon not found on main surface",
depth=1, jump_kind="value", expect=f"description contains '{phrase}'")
return
present = text_present(ui(), phrase)
ok = absent and present
record("text_about_description", ok,
"" if ok else "behavior_wrong: About description missing 'Quick Settings tiles'",
depth=1, jump_kind="value",
expect=f"About dialog description contains '{phrase}'")
# ══════════════════════════════════════════════════════════════════════════════
# DNS Info dialogs (D4) — the TITLE + a body phrase each tap produces
# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("text_dnsinfo_cloudflare_title",))
def test_dnsinfo_cloudflare_title():
open_main_default()
title = "About Cloudflare (1.1.1.1)"
# The trigger content-desc is "Info about Cloudflare (1.1.1.1)" which CONTAINS
# the title, so assert the standalone TextView whose text EQUALS the title.
absent = not has_exact_text(ui(), title)
if not and_enter_dialog(trigger_desc="Info about Cloudflare (1.1.1.1)"):
record("text_dnsinfo_cloudflare_title", False,
"setup_failed: 'Info about Cloudflare (1.1.1.1)' icon not found",
depth=1, jump_kind="value", expect=f"dialog title '{title}'")
return
present = has_exact_text(ui(), title)
ok = absent and present
record("text_dnsinfo_cloudflare_title", ok,
"" if ok else "behavior_wrong: Cloudflare info dialog title is not "
"'About Cloudflare (1.1.1.1)'",
depth=1, jump_kind="value", expect=f"dialog title equals '{title}'")
@and_test(expects=("text_dnsinfo_cloudflare_body",))
def test_dnsinfo_cloudflare_body():
open_main_default()
phrase = "is known for its high speed"
absent = not text_present(ui(), phrase)
if not and_enter_dialog(trigger_desc="Info about Cloudflare (1.1.1.1)"):
record("text_dnsinfo_cloudflare_body", False,
"setup_failed: 'Info about Cloudflare (1.1.1.1)' icon not found",
depth=1, jump_kind="value", expect=f"body contains '{phrase}'")
return
present = text_present(ui(), phrase)
ok = absent and present
record("text_dnsinfo_cloudflare_body", ok,
"" if ok else "behavior_wrong: Cloudflare info body missing 'is known for "
"its high speed'",
depth=1, jump_kind="value", expect=f"Cloudflare info body contains '{phrase}'")
@and_test(expects=("text_dnsinfo_adguard_title",))
def test_dnsinfo_adguard_title():
open_main_default()
title = "About AdGuard DNS"
absent = not has_exact_text(ui(), title)
if not and_enter_dialog(trigger_desc="Info about AdGuard DNS"):
record("text_dnsinfo_adguard_title", False,
"setup_failed: 'Info about AdGuard DNS' icon not found",
depth=1, jump_kind="value", expect=f"dialog title '{title}'")
return
present = has_exact_text(ui(), title)
ok = absent and present
record("text_dnsinfo_adguard_title", ok,
"" if ok else "behavior_wrong: AdGuard info dialog title is not 'About AdGuard DNS'",
depth=1, jump_kind="value", expect=f"dialog title equals '{title}'")
@and_test(expects=("text_dnsinfo_adguard_body",))
def test_dnsinfo_adguard_body():
open_main_default()
phrase = "blocks ads, trackers, and known malicious domains"
absent = not text_present(ui(), phrase)
if not and_enter_dialog(trigger_desc="Info about AdGuard DNS"):
record("text_dnsinfo_adguard_body", False,
"setup_failed: 'Info about AdGuard DNS' icon not found",
depth=1, jump_kind="value", expect=f"body contains '{phrase}'")
return
present = text_present(ui(), phrase)
ok = absent and present
record("text_dnsinfo_adguard_body", ok,
"" if ok else "behavior_wrong: AdGuard info body missing the ad/tracker-blocking phrase",
depth=1, jump_kind="value", expect=f"AdGuard info body contains '{phrase}'")
@and_test(expects=("text_dnsinfo_quad9_title",))
def test_dnsinfo_quad9_title():
open_main_default()
title = "About Quad9 Security"
absent = not has_exact_text(ui(), title)
if not and_enter_dialog(trigger_desc="Info about Quad9 Security"):
record("text_dnsinfo_quad9_title", False,
"setup_failed: 'Info about Quad9 Security' icon not found",
depth=1, jump_kind="value", expect=f"dialog title '{title}'")
return
present = has_exact_text(ui(), title)
ok = absent and present
record("text_dnsinfo_quad9_title", ok,
"" if ok else "behavior_wrong: Quad9 info dialog title is not 'About Quad9 Security'",
depth=1, jump_kind="value", expect=f"dialog title equals '{title}'")
@and_test(expects=("text_dnsinfo_quad9_body",))
def test_dnsinfo_quad9_body():
open_main_default()
phrase = "focuses on security by blocking domains associated with malware"
absent = not text_present(ui(), phrase)
if not and_enter_dialog(trigger_desc="Info about Quad9 Security"):
record("text_dnsinfo_quad9_body", False,
"setup_failed: 'Info about Quad9 Security' icon not found",
depth=1, jump_kind="value", expect=f"body contains '{phrase}'")
return
present = text_present(ui(), phrase)
ok = absent and present
record("text_dnsinfo_quad9_body", ok,
"" if ok else "behavior_wrong: Quad9 info body missing the malware-blocking phrase",
depth=1, jump_kind="value", expect=f"Quad9 info body contains '{phrase}'")
# ══════════════════════════════════════════════════════════════════════════════
# Add Hostname dialog (D2) — title + a field label the button produces
# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("text_add_hostname_title",))
def test_add_hostname_title():
open_main_default()
title = "Add Hostname"
absent = not has_exact_text(ui(), title)
if not and_enter_dialog(trigger_desc="Add Custom Hostname",
trigger_text="Add Custom Hostname"):
record("text_add_hostname_title", False,
"setup_failed: 'Add Custom Hostname' control not found on main surface",
depth=1, jump_kind="value", expect=f"dialog title '{title}'")
return
present = has_exact_text(ui(), title)
ok = absent and present
record("text_add_hostname_title", ok,
"" if ok else "behavior_wrong: Add-hostname dialog title is not 'Add Hostname'",
depth=1, jump_kind="value", expect=f"dialog title equals '{title}'")
@and_test(expects=("text_add_hostname_field_labels",))
def test_add_hostname_field_labels():
open_main_default()
label = "Hostname (e.g., dns.example.com)"
absent = not text_present(ui(), label)
if not and_enter_dialog(trigger_desc="Add Custom Hostname",
trigger_text="Add Custom Hostname"):
record("text_add_hostname_field_labels", False,
"setup_failed: 'Add Custom Hostname' control not found on main surface",
depth=1, jump_kind="value", expect=f"field label '{label}'")
return
nodes = ui()
present = text_present(nodes, label) and text_present(nodes, "Display Name")
ok = absent and present
record("text_add_hostname_field_labels", ok,
"" if ok else "behavior_wrong: Add-hostname dialog missing 'Display Name' / "
"'Hostname (e.g., dns.example.com)' labels",
depth=1, jump_kind="value",
expect=f"dialog shows 'Display Name' and '{label}'")
# ══════════════════════════════════════════════════════════════════════════════
# Network Type Info dialog (D5) — title the Info icon produces (body is opaque)
# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("text_network_info_title",))
def test_network_info_title():
open_main_default()
title = "Network Type Detection"
# Trigger content-desc equals the title too, so assert a standalone TextView.
absent = not has_exact_text(ui(), title)
if not and_enter_dialog(trigger_desc="Network Type Detection"):
record("text_network_info_title", False,
"setup_failed: 'Network Type Detection' info icon not found",
depth=1, jump_kind="value", expect=f"dialog title '{title}'")
return
# A Close button appearing proves the dialog opened (not just the row's icon desc).
nodes = ui()
present = has_exact_text(nodes, title) and text_present(nodes, "Close")
ok = absent and present
record("text_network_info_title", ok,
"" if ok else "behavior_wrong: Network Type info dialog title/Close not shown",
depth=1, jump_kind="value",
expect=f"dialog title equals '{title}' with a Close button")
# ══════════════════════════════════════════════════════════════════════════════
# USB tab warning — the red string the tab swap produces (present USB / absent DNS)
# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("text_usb_warning", "text_usb_warning_vlm"))
def test_usb_warning():
open_main_default()
warn = "Developer options are disabled. USB Debugging cannot be configured."
absent_on_dns = not text_present(ui(), warn)
if not open_usb_tab():
record("text_usb_warning", False,
"setup_failed: 'USB Debugging' tab not found",
depth=0, jump_kind="value", expect=f"USB tab shows '{warn}'")
vlm_assert("text_usb_warning",
"Is a warning message about Developer options being disabled shown "
"in a red/error-coloured style near the top of the content area?",
RESULTS_DIR, tag="color", depth=0)
return
present_on_usb = has_exact_text(ui(), warn)
ok = absent_on_dns and present_on_usb
record("text_usb_warning", ok,
"" if ok else "behavior_wrong: USB tab did not produce the disabled-dev-options warning",
depth=0, jump_kind="value",
expect=f"USB tab shows exactly '{warn}' (absent on DNS tab)")
# The warning as RENDERED — a faithful recreation shows it in a red/error style.
vlm_assert("text_usb_warning",
"Is there a warning line stating that Developer options are disabled and "
"USB Debugging cannot be configured, shown in a red or error-coloured text?",
RESULTS_DIR, tag="color", depth=0)
@and_test(expects=("text_usb_tile_heading_swap",))
def test_usb_tile_heading_swap():
# The tab swap produces the "USB Debugging Tile" heading (absent on DNS tab,
# where the heading is "Private DNS Tile").
open_main_default()
heading = "USB Debugging Tile"
absent_on_dns = not has_exact_text(ui(), heading)
if not open_usb_tab():
record("text_usb_tile_heading_swap", False,
"setup_failed: 'USB Debugging' tab not found",
depth=0, jump_kind="value", expect=f"USB tab heading '{heading}'")
return
present_on_usb = has_exact_text(ui(), heading)
ok = absent_on_dns and present_on_usb
record("text_usb_tile_heading_swap", ok,
"" if ok else "behavior_wrong: USB tab did not show the 'USB Debugging Tile' heading",
depth=0, jump_kind="value",
expect=f"USB tab heading equals '{heading}' (absent on DNS tab)")
# ══════════════════════════════════════════════════════════════════════════════
# Shortcut Actions screen (S1) — title + expanded info-pill paragraph
# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("text_shortcut_screen_title",))
def test_shortcut_screen_title():
open_main_default()
title = "Shortcut Actions"
absent = not has_exact_text(ui(), title)
if not and_enter_shortcut_screen():
record("text_shortcut_screen_title", False,
"setup_failed: 'Open shortcut settings' icon not found on main surface",
depth=1, jump_kind="value", expect=f"screen title '{title}'")
return
present = has_exact_text(ui(), title)
ok = absent and present
record("text_shortcut_screen_title", ok,
"" if ok else "behavior_wrong: Shortcut screen title is not 'Shortcut Actions'",
depth=1, jump_kind="value", expect=f"screen title equals '{title}'")
@and_test(expects=("text_shortcut_pill_expanded", "text_shortcut_pill_expanded_vlm"))
def test_shortcut_pill_expanded():
# Tapping the info pill expands a long explanatory paragraph (AnimatedVisibility).
open_main_default()
phrase = "Choose which actions are exposed as Android app shortcuts"
if not and_enter_shortcut_screen():
record("text_shortcut_pill_expanded", False,
"setup_failed: 'Open shortcut settings' icon not found on main surface",
depth=1, jump_kind="value", expect=f"expanded pill contains '{phrase}'")
vlm_assert("text_shortcut_pill_expanded",
"Below the 'Active shortcuts' pill, is a long multi-paragraph block "
"of explanatory text displayed?",
RESULTS_DIR, tag="layout", depth=1)
return
absent = not text_present(ui(), phrase)
pill = (find_node(ui(), text="Active shortcuts: 0 / 15")
or find_node_ci(ui(), "Active shortcuts: 0 / 15"))
if pill is None or not tap_node(pill):
record("text_shortcut_pill_expanded", False,
"setup_failed: 'Active shortcuts: 0 / 15' pill not found/tappable",
depth=1, jump_kind="value", expect=f"expanded pill contains '{phrase}'")
vlm_assert("text_shortcut_pill_expanded",
"Below the 'Active shortcuts' pill, is a long multi-paragraph block "
"of explanatory text displayed?",
RESULTS_DIR, tag="layout", depth=1)
return
present = text_present(ui(), phrase)
ok = absent and present
record("text_shortcut_pill_expanded", ok,
"" if ok else "behavior_wrong: tapping the pill did not reveal the explanatory paragraph",
depth=1, jump_kind="value",
expect=f"expanded pill text contains '{phrase}'")
# The expanded paragraph as RENDERED (a tall text block appears under the pill).
vlm_assert("text_shortcut_pill_expanded",
"Directly under the 'Active shortcuts' pill near the top, is a long "
"multi-paragraph block of explanatory text now displayed?",
RESULTS_DIR, tag="layout", depth=1)
# ══════════════════════════════════════════════════════════════════════════════
# "Allow disabled shortcuts?" warning dialog (S1) — title + body a toggle produces
# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("text_allow_disabled_warning_title",))
def test_allow_disabled_warning_title():
open_main_default()
title = "Allow disabled shortcuts?"
if not and_enter_shortcut_screen():
record("text_allow_disabled_warning_title", False,
"setup_failed: could not reach the Shortcut Actions screen",
depth=1, jump_kind="value", expect=f"warning title '{title}'")
return
absent = not has_exact_text(ui(), title)
lbl = find_node(ui(), text="Allow disabled pinned shortcuts")
if lbl is None or not tap_node(lbl):
record("text_allow_disabled_warning_title", False,
"setup_failed: 'Allow disabled pinned shortcuts' toggle not found",
depth=1, jump_kind="value", expect=f"warning title '{title}'")
return
present = has_exact_text(ui(), title)
ok = absent and present
record("text_allow_disabled_warning_title", ok,
"" if ok else "behavior_wrong: enabling the toggle did not show the "
"'Allow disabled shortcuts?' warning title",
depth=1, jump_kind="value", expect=f"warning dialog title equals '{title}'")
@and_test(expects=("text_allow_disabled_warning_body",))
def test_allow_disabled_warning_body():
open_main_default()
phrase = "weakens the default safety behavior"
button = "Enable anyway"
if not and_enter_shortcut_screen():
record("text_allow_disabled_warning_body", False,
"setup_failed: could not reach the Shortcut Actions screen",
depth=1, jump_kind="value", expect=f"warning body contains '{phrase}'")
return
absent = not text_present(ui(), phrase)
lbl = find_node(ui(), text="Allow disabled pinned shortcuts")
if lbl is None or not tap_node(lbl):
record("text_allow_disabled_warning_body", False,
"setup_failed: 'Allow disabled pinned shortcuts' toggle not found",
depth=1, jump_kind="value", expect=f"warning body contains '{phrase}'")
return
nodes = ui()
present = text_present(nodes, phrase) and text_present(nodes, button)
ok = absent and present
record("text_allow_disabled_warning_body", ok,
"" if ok else "behavior_wrong: warning dialog body/'Enable anyway' button not shown",
depth=1, jump_kind="value",
expect=f"warning body contains '{phrase}' and button '{button}'")
# ══════════════════════════════════════════════════════════════════════════════
# Conditional reveal labels — produced when a checkbox is toggled ON
# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("text_vpn_mode_reveal",))
def test_vpn_mode_reveal():
open_main_default()
label = "VPN Detection Mode:"
absent = not has_exact_text(ui(), label)
toggle = find_node(ui(), text="Automatically disable DNS on VPN connections")
if toggle is None or not tap_node(toggle):
record("text_vpn_mode_reveal", False,
"setup_failed: VPN toggle label not found on DNS tab",
depth=0, jump_kind="transition", expect=f"reveal label '{label}'")
return
nodes = ui()
present = has_exact_text(nodes, label) and text_present(nodes, "Tile-Only Detection")
ok = absent and present
record("text_vpn_mode_reveal", ok,
"" if ok else "behavior_wrong: toggling VPN option did not reveal 'VPN Detection Mode:'",
depth=0, jump_kind="transition",
expect=f"'{label}' absent before toggle, present after")
@and_test(expects=("text_network_wifi_reveal",))
def test_network_wifi_reveal():
open_main_default()
label = "DNS on WiFi:"
absent = not has_exact_text(ui(), label)
toggle = find_node(ui(), text="Auto-switch DNS based on network type")
if toggle is None or not tap_node(toggle):
record("text_network_wifi_reveal", False,
"setup_failed: network auto-switch toggle label not found on DNS tab",
depth=0, jump_kind="transition", expect=f"reveal label '{label}'")
return
present = has_exact_text(ui(), label)
ok = absent and present
record("text_network_wifi_reveal", ok,
"" if ok else "behavior_wrong: toggling network auto-switch did not reveal 'DNS on WiFi:'",
depth=0, jump_kind="transition",
expect=f"'{label}' absent before toggle, present after")
TESTS = [
test_about_features_label,
test_about_developer_label,
test_about_permission_help_label,
test_about_feature_bullet,
test_about_description,
test_dnsinfo_cloudflare_title,
test_dnsinfo_cloudflare_body,
test_dnsinfo_adguard_title,
test_dnsinfo_adguard_body,
test_dnsinfo_quad9_title,
test_dnsinfo_quad9_body,
test_add_hostname_title,
test_add_hostname_field_labels,
test_network_info_title,
test_usb_warning,
test_usb_tile_heading_swap,
test_shortcut_screen_title,
test_shortcut_pill_expanded,
test_allow_disabled_warning_title,
test_allow_disabled_warning_body,
test_vpn_mode_reveal,
test_network_wifi_reveal,
]
if __name__ == "__main__":
if not device_online():
print("Device offline — cannot run the text lane")
sys.exit(1)
run_suite(TESTS, "text")
|