mirror of
https://github.com/ActivityLauncher/ActivityLauncher.git
synced 2026-10-03 12:16:18 +00:00
test(ci): poll UI dump for pin shortcut dialog before fallback
This commit is contained in:
parent
d6ee97596d
commit
405dfb49b3
1 changed files with 6 additions and 3 deletions
|
|
@ -292,7 +292,8 @@ def test_upgrade_flow():
|
|||
print("Confirming System Pin Shortcut dialog...")
|
||||
pinPattern = re.compile(r'(?i)(add automatically|add to home screen|\badd\b|allow|ok)')
|
||||
clicked_pin = False
|
||||
for attempt in range(5):
|
||||
for attempt in range(10):
|
||||
time.sleep(1)
|
||||
xml = dump_ui()
|
||||
for match in re.finditer(r'<node ([^>]+)>', xml):
|
||||
attr = match.group(1)
|
||||
|
|
@ -302,7 +303,7 @@ def test_upgrade_flow():
|
|||
dm = re.search(r'content-desc="([^"]*)"', attr)
|
||||
if dm: node_text += " " + dm.group(1)
|
||||
|
||||
if pinPattern.search(node_text):
|
||||
if pinPattern.search(node_text) or 'button1' in attr or 'btn_add' in attr:
|
||||
bounds_match = re.search(r'bounds="\[(\d+),(\d+)\]\[(\d+),(\d+)\]"', attr)
|
||||
if bounds_match:
|
||||
x1, y1, x2, y2 = map(int, bounds_match.groups())
|
||||
|
|
@ -315,7 +316,9 @@ def test_upgrade_flow():
|
|||
break
|
||||
if clicked_pin:
|
||||
break
|
||||
print("Retrying pin dialog search / DPAD navigation...")
|
||||
|
||||
if not clicked_pin:
|
||||
print("Fallback pin dialog tap...")
|
||||
adb_shell("input keyevent KEYCODE_DPAD_RIGHT", check=False)
|
||||
adb_shell("input keyevent KEYCODE_ENTER", check=False)
|
||||
time.sleep(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue