MCPcopy Index your code
hub / github.com/NativeScript/SimDeck / runCliSurface

Function runCliSurface

scripts/integration/android.mjs:125–351  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

123}
124
125async function runCliSurface() {
126 await measuredStep("CLI list includes Android", () => {
127 assertAndroidListed(simdeckJson(["list"]), androidUDID);
128 });
129 await measuredStep(
130 "CLI boot Android idempotent",
131 () => assertJson(simdeckJson(["boot", androidUDID]), "boot"),
132 { timeoutMs: 180_000 },
133 );
134 await measuredStep("CLI chrome-profile", () => {
135 const profile = simdeckJson(["chrome-profile", androidUDID]);
136 assertJson(profile, "chrome-profile");
137 assert.ok(Number(profile.screenWidth) > 0, "missing Android screenWidth");
138 assert.ok(Number(profile.screenHeight) > 0, "missing Android screenHeight");
139 });
140 const tree = await measuredStep("CLI describe Android tree", async () => {
141 const payload = await retryAsync(
142 () =>
143 simdeckJson([
144 "describe",
145 androidUDID,
146 "--source",
147 "android-uiautomator",
148 "--format",
149 "compact-json",
150 "--max-depth",
151 "2",
152 ]),
153 "CLI describe Android tree",
154 { attempts: 8, delayMs: 2_000 },
155 );
156 assertRoots(payload, "CLI describe");
157 return payload;
158 });
159 await measuredStep("CLI describe Android point", async () => {
160 const point = centerOfFirstRoot(tree);
161 if (!point) {
162 throw new Error("Unable to derive point from Android tree root.");
163 }
164 assertRoots(
165 await retryAsync(
166 () =>
167 simdeckJson([
168 "describe",
169 androidUDID,
170 "--source",
171 "android-uiautomator",
172 "--format",
173 "compact-json",
174 "--point",
175 `${point.x},${point.y}`,
176 "--max-depth",
177 "1",
178 ]),
179 "CLI describe Android point",
180 { attempts: 4, delayMs: 1_000 },
181 ),
182 "CLI point describe",

Callers 1

mainFunction · 0.85

Calls 13

assertAndroidListedFunction · 0.85
centerOfFirstRootFunction · 0.85
runCommandFunction · 0.85
logMethod · 0.80
measuredStepFunction · 0.70
simdeckJsonFunction · 0.70
assertJsonFunction · 0.70
retryAsyncFunction · 0.70
assertRootsFunction · 0.70
assertPngBufferFunction · 0.70

Tested by

no test coverage detected