@momo-kits/native-kits 0.169.13-beta.4-debug → 0.169.13-debug
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +1 -4
- package/compose/build.gradle.kts +1 -5
- package/compose/compose.podspec +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +12 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +11 -3
- package/gradle/libs.versions.toml +0 -2
- package/gradle.properties +1 -1
- package/ios/Navigation/BottomTab/BottomTabBar.swift +14 -4
- package/ios/native-kits.podspec +1 -1
- package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +16 -3
- package/package.json +1 -1
- package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiActionsTest.kt +0 -647
- package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiExprTest.kt +0 -1411
- package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiHostTest.kt +0 -130
- package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiKitArgsTest.kt +0 -524
- package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiKitNodesTest.kt +0 -559
- package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiRenderPlanTest.kt +0 -741
- package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiRenderReuseTest.kt +0 -221
- package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiRendererPropsTest.kt +0 -270
- package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiStylePlanTest.kt +0 -849
- package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiStyleTest.kt +0 -212
- package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiTrackingTest.kt +0 -239
- package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiViewTest.kt +0 -252
- package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiActions.kt +0 -154
- package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiExpr.kt +0 -1038
- package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiKitNodes.kt +0 -848
- package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiLog.kt +0 -47
- package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiModel.kt +0 -39
- package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiPropsRenderer.kt +0 -463
- package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiRenderer.kt +0 -1146
- package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiStyle.kt +0 -667
- package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiTracking.kt +0 -240
- package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiValidate.kt +0 -185
- package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiView.kt +0 -200
- package/scripts/sdui-visual/README.md +0 -64
- package/scripts/sdui-visual/diff.py +0 -65
- package/scripts/sdui-visual/drive.py +0 -234
- package/scripts/sdui-visual/plan.json +0 -713
- package/scripts/sdui-visual/run.sh +0 -92
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
# SDUI visual regression
|
|
2
|
-
|
|
3
|
-
Checks that a change to the SDUI renderer (`compose/src/commonMain/kotlin/vn/momo/kits/sdui/`) does not change how anything looks.
|
|
4
|
-
|
|
5
|
-
The script opens every SDUI spec of the sample app on an Android emulator. It screenshots every page and the state after each recorded tap or swipe, then compares each image pixel by pixel with a baseline taken before the change.
|
|
6
|
-
|
|
7
|
-
Unit tests (`./gradlew :compose:testDebugUnitTest`) check the renderer's decisions. This script checks what actually ends up on screen.
|
|
8
|
-
|
|
9
|
-
## Usage
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
# 1. BEFORE changing code: capture the baseline
|
|
13
|
-
# (--twice captures it twice to learn noise such as the keyboard suggestion strip; about 2x longer)
|
|
14
|
-
scripts/sdui-visual/run.sh baseline --twice
|
|
15
|
-
|
|
16
|
-
# 2. change the code
|
|
17
|
-
|
|
18
|
-
# 3. capture again and compare
|
|
19
|
-
scripts/sdui-visual/run.sh check
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
`check` exits with:
|
|
23
|
-
- **0** when every image matches the baseline;
|
|
24
|
-
- **1** otherwise, with the differing pixels marked red under `build/sdui-visual/diff/`.
|
|
25
|
-
|
|
26
|
-
All output goes to `build/sdui-visual/`, which git ignores. Screenshots are never committed.
|
|
27
|
-
|
|
28
|
-
## Requirements
|
|
29
|
-
|
|
30
|
-
- `adb`, the Android emulator, and [uv](https://docs.astral.sh/uv/). Pillow is pulled in by `uv run`.
|
|
31
|
-
- AVD `momo_api36`, or another one set with `SDUI_AVD=<name>`.
|
|
32
|
-
- If a device is already attached, the script uses it. Otherwise it boots the AVD headless and shuts it down at the end.
|
|
33
|
-
|
|
34
|
-
The script prepares the device so that only app changes show up in the images:
|
|
35
|
-
- it turns animations off;
|
|
36
|
-
- it freezes the status bar (clock, battery, network) with demo mode;
|
|
37
|
-
- the diff also ignores the top 110 px.
|
|
38
|
-
|
|
39
|
-
A run covers about 55 specs and 151 images and takes 30–40 minutes. Run it before committing a renderer change or before a release, not on every edit.
|
|
40
|
-
|
|
41
|
-
## Files
|
|
42
|
-
|
|
43
|
-
| File | What it does |
|
|
44
|
-
|---|---|
|
|
45
|
-
| `run.sh` | the whole flow: boot, prepare, install the sample, capture, diff, shut down |
|
|
46
|
-
| `drive.py` | drives the app with adb and `uiautomator dump`. The spec list is read from `sample/shared/src/commonMain/kotlin/screens/SduiUsage.kt`, so new specs are picked up automatically |
|
|
47
|
-
| `plan.json` | recorded page counts and tap/swipe coordinates for each spec, replayed exactly on every run |
|
|
48
|
-
| `diff.py` | pixel diff with the status bar ignored. `--noise <dir>` masks pixels that already differed between two baseline runs |
|
|
49
|
-
|
|
50
|
-
## When to re-record `plan.json`
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
scripts/sdui-visual/run.sh record
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Re-record in these cases:
|
|
57
|
-
- **You use a different AVD.** Tap coordinates depend on screen size and density.
|
|
58
|
-
- **A spec's layout moved its tappable elements.**
|
|
59
|
-
- **You want a new spec to get tap states.**
|
|
60
|
-
- A spec missing from the plan is discovered on the fly: its pages are captured, and for specs in `TAPPABLE` (`drive.py`) so are its tap states.
|
|
61
|
-
- That discovery is not saved, so the taps can differ between runs until you re-record.
|
|
62
|
-
- Input specs are skipped because they need typing.
|
|
63
|
-
|
|
64
|
-
`record` also writes a fresh baseline. Run it on code you trust, before making the change.
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# File: scripts/sdui-visual/diff.py
|
|
2
|
-
# Created At: 2026-11-10 15:30:00 +07:00
|
|
3
|
-
# Created By: AI
|
|
4
|
-
# AI Agent: Claude Code
|
|
5
|
-
# Model: claude-opus-5-5
|
|
6
|
-
"""Pixel-diff two capture folders. usage: diff.py <a> <b> <diffdir> [--noise <baseline2 dir>]
|
|
7
|
-
Status bar (top 110 px, demo-mode clock is fixed but kept out anyway) is excluded. With --noise, pixels that differed
|
|
8
|
-
between the two baseline runs of the same image are masked (inherent noise: animations, image loading)."""
|
|
9
|
-
import json, os, sys
|
|
10
|
-
from PIL import Image, ImageChops
|
|
11
|
-
|
|
12
|
-
STATUS = 110
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def load(p):
|
|
16
|
-
return Image.open(p).convert("RGB")
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def mask_of(a, b):
|
|
20
|
-
d = ImageChops.difference(a, b).convert("L").point(lambda v: 255 if v else 0)
|
|
21
|
-
return d
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def main():
|
|
25
|
-
a, b, out = sys.argv[1:4]
|
|
26
|
-
noise_dir = sys.argv[sys.argv.index("--noise") + 1] if "--noise" in sys.argv else None
|
|
27
|
-
os.makedirs(out, exist_ok=True)
|
|
28
|
-
rows = []
|
|
29
|
-
names = sorted(set(os.listdir(a)) | set(os.listdir(b)))
|
|
30
|
-
for n in names:
|
|
31
|
-
if not n.endswith(".png"):
|
|
32
|
-
continue
|
|
33
|
-
if n not in os.listdir(a) or n not in os.listdir(b):
|
|
34
|
-
rows.append((n, "MISSING", -1, -1, -1)); continue
|
|
35
|
-
ia, ib = load(f"{a}/{n}"), load(f"{b}/{n}")
|
|
36
|
-
if ia.size != ib.size:
|
|
37
|
-
rows.append((n, "SIZE", -1, -1, -1)); continue
|
|
38
|
-
w, h = ia.size
|
|
39
|
-
d = mask_of(ia, ib)
|
|
40
|
-
d.paste(0, (0, 0, w, STATUS))
|
|
41
|
-
raw = d.width * d.height - d.histogram()[0]
|
|
42
|
-
masked = raw
|
|
43
|
-
if noise_dir and os.path.exists(f"{noise_dir}/{n}"):
|
|
44
|
-
nz = mask_of(ia, load(f"{noise_dir}/{n}"))
|
|
45
|
-
keep = ImageChops.subtract(d, nz)
|
|
46
|
-
masked = keep.width * keep.height - keep.histogram()[0]
|
|
47
|
-
else:
|
|
48
|
-
keep = d
|
|
49
|
-
total = w * (h - STATUS)
|
|
50
|
-
if raw:
|
|
51
|
-
vis = ib.copy()
|
|
52
|
-
red = Image.new("RGB", ib.size, (255, 0, 0))
|
|
53
|
-
vis.paste(red, (0, 0), keep if masked else d)
|
|
54
|
-
vis.save(f"{out}/{n}")
|
|
55
|
-
rows.append((n, "OK", raw, masked, 100.0 * masked / total))
|
|
56
|
-
zero = sum(1 for r in rows if r[1] == "OK" and r[3] == 0)
|
|
57
|
-
for r in rows:
|
|
58
|
-
if r[1] != "OK" or r[2]:
|
|
59
|
-
print(f"{r[0]:40s} {r[1]:7s} raw={r[2]} beyond_noise={r[3]} ({r[4]:.4f}%)")
|
|
60
|
-
print(f"images={len(rows)} zero_beyond_noise={zero} raw_zero={sum(1 for r in rows if r[1]=='OK' and r[2]==0)}")
|
|
61
|
-
json.dump(rows, open(f"{out}/summary.json", "w"), indent=0)
|
|
62
|
-
sys.exit(0 if zero == len(rows) else 1)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
main()
|
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
# File: scripts/sdui-visual/drive.py
|
|
2
|
-
# Created At: 2026-11-10 15:30:00 +07:00
|
|
3
|
-
# Created By: AI
|
|
4
|
-
# AI Agent: Claude Code
|
|
5
|
-
# Model: claude-opus-5-5
|
|
6
|
-
"""Drive the sample app: open every bundled SDUI spec, capture pages + interaction states.
|
|
7
|
-
|
|
8
|
-
usage: drive.py <outdir> [--plan plan.json] [--record plan.json] [--only a,b]
|
|
9
|
-
--record: discover page counts + tap coordinates and save them (baseline run)
|
|
10
|
-
--plan: replay exactly the page counts + taps from a recorded plan
|
|
11
|
-
(a spec missing from the plan is discovered on the fly, not saved)
|
|
12
|
-
"""
|
|
13
|
-
import io, json, re, subprocess, sys, time, os
|
|
14
|
-
from PIL import Image, ImageChops
|
|
15
|
-
|
|
16
|
-
PKG = "com.myapplication.MyApplication"
|
|
17
|
-
ACT = "com.myapplication.MainActivity"
|
|
18
|
-
USAGE_KT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..",
|
|
19
|
-
"sample/shared/src/commonMain/kotlin/screens/SduiUsage.kt")
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def spec_list(name):
|
|
23
|
-
"""A spec list (GALLERY / BLOCKS / SHOWCASE) exactly as the sample app shows it, read from SduiUsage.kt."""
|
|
24
|
-
src = open(USAGE_KT, encoding="utf-8").read()
|
|
25
|
-
m = re.search(r"val " + name + r" = listOf\(([^)]*)\)", src)
|
|
26
|
-
if not m:
|
|
27
|
-
raise SystemExit(f"{name} list not found in {USAGE_KT}")
|
|
28
|
-
return re.findall(r'"([^"]+)"', m.group(1))
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
# same order as the app's list screen
|
|
32
|
-
ALL = spec_list("SHOWCASE") + spec_list("BLOCKS") + spec_list("GALLERY")
|
|
33
|
-
# specs with state-changing actions (setState) that can be driven by taps (inputs need typing: skipped)
|
|
34
|
-
TAPPABLE = ["button", "carousel", "check-box", "chip", "collapse", "icon-button", "information", "popup-notify", "popup-promotion",
|
|
35
|
-
"radio", "rating", "slider", "stepper", "steps", "suggest-action", "swipe", "switch", "tab-view", "title",
|
|
36
|
-
"touchable-opacity", "uploader", "community", "paylater_benefits", "paylater_history"]
|
|
37
|
-
MAX_TAPS = 4
|
|
38
|
-
SETTLE = 3.0
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def sh(*a, capture=True):
|
|
42
|
-
return subprocess.run(["adb", *a], capture_output=capture, check=False).stdout
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
def shot():
|
|
46
|
-
return Image.open(io.BytesIO(sh("exec-out", "screencap", "-p"))).convert("RGB")
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def dump():
|
|
50
|
-
for _ in range(3):
|
|
51
|
-
sh("shell", "uiautomator", "dump", "/sdcard/ui.xml")
|
|
52
|
-
x = sh("shell", "cat", "/sdcard/ui.xml").decode("utf-8", "replace")
|
|
53
|
-
if "<hierarchy" in x:
|
|
54
|
-
return x
|
|
55
|
-
time.sleep(0.5)
|
|
56
|
-
return ""
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
NODE = re.compile(r'<node [^>]*>')
|
|
60
|
-
def nodes(xml):
|
|
61
|
-
out = []
|
|
62
|
-
for m in NODE.finditer(xml):
|
|
63
|
-
s = m.group(0)
|
|
64
|
-
g = lambda k: (re.search(k + r'="([^"]*)"', s) or [None, ""])[1]
|
|
65
|
-
b = re.match(r'\[(\d+),(\d+)\]\[(\d+),(\d+)\]', g("bounds"))
|
|
66
|
-
if not b:
|
|
67
|
-
continue
|
|
68
|
-
x1, y1, x2, y2 = map(int, b.groups())
|
|
69
|
-
out.append(dict(text=g("text"), desc=g("content-desc"), clickable=g("clickable") == "true", b=(x1, y1, x2, y2)))
|
|
70
|
-
return out
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
def tap(x, y):
|
|
74
|
-
sh("shell", "input", "tap", str(x), str(y))
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
def swipe_up(dist=1000, dur=1200):
|
|
78
|
-
sh("shell", "input", "swipe", "540", "1900", "540", str(1900 - dist), str(dur))
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
def swipe_down(dist=1000, dur=300):
|
|
82
|
-
sh("shell", "input", "swipe", "540", "700", "540", str(700 + dist), str(dur))
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
def find_text(name, tries=14, up=True):
|
|
86
|
-
for _ in range(tries):
|
|
87
|
-
for n in nodes(dump()):
|
|
88
|
-
if n["text"] == name and 250 < (n["b"][1] + n["b"][3]) // 2 < 2250:
|
|
89
|
-
return n
|
|
90
|
-
if up:
|
|
91
|
-
swipe_up(700, 600)
|
|
92
|
-
else:
|
|
93
|
-
swipe_down(1500, 300)
|
|
94
|
-
time.sleep(0.6)
|
|
95
|
-
return None
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
def launch_to_list():
|
|
99
|
-
sh("shell", "am", "force-stop", PKG)
|
|
100
|
-
sh("shell", "am", "start", "-n", f"{PKG}/{ACT}")
|
|
101
|
-
time.sleep(4)
|
|
102
|
-
n = find_text("SDUI", tries=25)
|
|
103
|
-
if not n:
|
|
104
|
-
raise SystemExit("SDUI entry not found")
|
|
105
|
-
x1, y1, x2, y2 = n["b"]
|
|
106
|
-
tap((x1 + x2) // 2, (y1 + y2) // 2)
|
|
107
|
-
time.sleep(2)
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
def to_top():
|
|
111
|
-
for _ in range(6):
|
|
112
|
-
swipe_down(1600, 200)
|
|
113
|
-
time.sleep(0.8)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
def open_spec(name):
|
|
117
|
-
to_top()
|
|
118
|
-
n = find_text(name, tries=14)
|
|
119
|
-
if not n:
|
|
120
|
-
raise RuntimeError(f"spec {name} not found in list")
|
|
121
|
-
x1, y1, x2, y2 = n["b"]
|
|
122
|
-
tap((x1 + x2) // 2, (y1 + y2) // 2)
|
|
123
|
-
time.sleep(SETTLE)
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
def back():
|
|
127
|
-
sh("shell", "input", "keyevent", "4")
|
|
128
|
-
time.sleep(1.2)
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
EXTRA = {
|
|
132
|
-
"carousel": [["hswipe", 900, 543, 150, 400], ["hswipe", 900, 543, 150, 400]],
|
|
133
|
-
"slider": [["hswipe", 257, 463, 500, 800]],
|
|
134
|
-
"swipe": [["hswipe", 900, 520, 300, 800], ["hswipe", 200, 770, 800, 800]],
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
def act(a):
|
|
139
|
-
if a[0] == "tap":
|
|
140
|
-
tap(a[1], a[2])
|
|
141
|
-
elif a[0] == "scroll":
|
|
142
|
-
swipe_up(); time.sleep(0.3)
|
|
143
|
-
elif a[0] == "hswipe":
|
|
144
|
-
sh("shell", "input", "swipe", str(a[1]), str(a[2]), str(a[3]), str(a[2]), str(a[4]))
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
def same(a, b):
|
|
148
|
-
return ImageChops.difference(a, b).getbbox() is None
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
def run(outdir, plan, record_path, only):
|
|
152
|
-
os.makedirs(outdir, exist_ok=True)
|
|
153
|
-
launch_to_list()
|
|
154
|
-
new_plan = {}
|
|
155
|
-
for name in ALL:
|
|
156
|
-
if only and name not in only:
|
|
157
|
-
continue
|
|
158
|
-
entry = (plan or {}).get(name)
|
|
159
|
-
t0 = time.time()
|
|
160
|
-
# ---- pages
|
|
161
|
-
open_spec(name)
|
|
162
|
-
pages = []
|
|
163
|
-
img = shot(); img.save(f"{outdir}/{name}-p0.png"); pages.append(img)
|
|
164
|
-
if entry is not None:
|
|
165
|
-
for p in range(1, entry["pages"]):
|
|
166
|
-
swipe_up(); time.sleep(1.5)
|
|
167
|
-
img = shot(); img.save(f"{outdir}/{name}-p{p}.png")
|
|
168
|
-
else:
|
|
169
|
-
for p in range(1, 10):
|
|
170
|
-
swipe_up(); time.sleep(1.5)
|
|
171
|
-
img = shot()
|
|
172
|
-
if same(img, pages[-1]):
|
|
173
|
-
break
|
|
174
|
-
img.save(f"{outdir}/{name}-p{p}.png"); pages.append(img)
|
|
175
|
-
npages = entry["pages"] if entry is not None else len(pages)
|
|
176
|
-
back()
|
|
177
|
-
# ---- interaction states
|
|
178
|
-
taps = []
|
|
179
|
-
if name in TAPPABLE:
|
|
180
|
-
open_spec(name)
|
|
181
|
-
if entry is not None:
|
|
182
|
-
taps = entry["taps"]
|
|
183
|
-
for k, a in enumerate(taps):
|
|
184
|
-
act(a)
|
|
185
|
-
if a[0] == "scroll":
|
|
186
|
-
if k + 1 < len(taps) and taps[k + 1][0] != "scroll":
|
|
187
|
-
time.sleep(1.5)
|
|
188
|
-
continue
|
|
189
|
-
time.sleep(1.8)
|
|
190
|
-
shot().save(f"{outdir}/{name}-tap{k}.png")
|
|
191
|
-
else:
|
|
192
|
-
k = 0
|
|
193
|
-
for pg in range(npages if npages > 1 else 1):
|
|
194
|
-
if pg > 0 and pg != npages - 1:
|
|
195
|
-
continue
|
|
196
|
-
if pg > 0:
|
|
197
|
-
for _ in range(npages - 1):
|
|
198
|
-
a = ["scroll"]; act(a); taps.append(a)
|
|
199
|
-
time.sleep(1.5)
|
|
200
|
-
seen = set(); n_here = 0
|
|
201
|
-
for n in [n for n in nodes(dump()) if n["clickable"] and n["b"][1] > 300 and n["b"][3] < 2250]:
|
|
202
|
-
c = ((n["b"][0] + n["b"][2]) // 2, (n["b"][1] + n["b"][3]) // 2)
|
|
203
|
-
if c in seen:
|
|
204
|
-
continue
|
|
205
|
-
seen.add(c)
|
|
206
|
-
a = ["tap", c[0], c[1]]; act(a); taps.append(a); time.sleep(1.8)
|
|
207
|
-
shot().save(f"{outdir}/{name}-tap{len(taps) - 1}.png")
|
|
208
|
-
n_here += 1
|
|
209
|
-
if n_here >= MAX_TAPS:
|
|
210
|
-
break
|
|
211
|
-
for a in EXTRA.get(name, []):
|
|
212
|
-
act(a); taps.append(a); time.sleep(1.8)
|
|
213
|
-
shot().save(f"{outdir}/{name}-tap{len(taps) - 1}.png")
|
|
214
|
-
back()
|
|
215
|
-
# a tap may have opened a popup / modal: make sure we are back on the list
|
|
216
|
-
if not find_text(name, tries=1):
|
|
217
|
-
back()
|
|
218
|
-
new_plan[name] = {"pages": npages, "taps": taps}
|
|
219
|
-
print(f"{name}: pages={npages} taps={len(taps)} ({time.time() - t0:.1f}s)", flush=True)
|
|
220
|
-
if record_path:
|
|
221
|
-
json.dump(new_plan, open(record_path, "w"), indent=1)
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
if __name__ == "__main__":
|
|
225
|
-
args = sys.argv[1:]
|
|
226
|
-
out = args[0]
|
|
227
|
-
plan = rec = None; only = None
|
|
228
|
-
if "--plan" in args:
|
|
229
|
-
plan = json.load(open(args[args.index("--plan") + 1]))
|
|
230
|
-
if "--record" in args:
|
|
231
|
-
rec = args[args.index("--record") + 1]
|
|
232
|
-
if "--only" in args:
|
|
233
|
-
only = set(args[args.index("--only") + 1].split(","))
|
|
234
|
-
run(out, plan, rec, only)
|