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

Function runJsSurface

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

Source from the content-addressed store, hash-verified

351}
352
353async function runJsSurface() {
354 await measuredStep("JS list includes Android", async () => {
355 assertAndroidListed(await session.list(), androidUDID);
356 });
357 await measuredStep("JS chromeProfile", async () => {
358 const profile = await session.chromeProfile(androidUDID);
359 assertJson(profile, "chromeProfile");
360 });
361 await measuredStep("JS Android tree", async () => {
362 assertRoots(
363 await retryAsync(
364 () =>
365 session.tree(androidUDID, {
366 source: "android-uiautomator",
367 maxDepth: 2,
368 }),
369 "JS Android tree",
370 { attempts: 6, delayMs: 2_000 },
371 ),
372 "JS tree",
373 );
374 });
375 await measuredStep("JS screenshot", async () => {
376 assertPngBuffer(await session.screenshot(androidUDID));
377 });
378 await measuredStep("JS pasteboard behavior", async () => {
379 try {
380 await session.pasteboardSet(androidUDID, "simdeck android js");
381 assert.equal(
382 await session.pasteboardGet(androidUDID),
383 "simdeck android js",
384 );
385 } catch (error) {
386 assertClipboardUnsupported(error);
387 }
388 });
389 await measuredStep("JS app launch and URL", async () => {
390 if (androidLaunchTarget) {
391 try {
392 await session.launch(androidUDID, androidLaunchTarget);
393 } catch (error) {
394 if (
395 requestedAndroidLaunchTarget ||
396 !isAndroidIntentUnavailable(error)
397 ) {
398 throw error;
399 }
400 console.log(
401 `Android image rejected discovered launch target ${androidLaunchTarget}; continuing with URL/home coverage.`,
402 );
403 }
404 }
405 try {
406 await session.openUrl(androidUDID, "https://example.com");
407 } catch (error) {
408 if (!isAndroidIntentUnavailable(error)) {
409 throw error;
410 }

Callers 1

mainFunction · 0.85

Calls 12

assertAndroidListedFunction · 0.85
logMethod · 0.80
keyMethod · 0.80
logsMethod · 0.80
measuredStepFunction · 0.70
assertJsonFunction · 0.70
assertRootsFunction · 0.70
retryAsyncFunction · 0.70
assertPngBufferFunction · 0.70
listMethod · 0.65

Tested by

no test coverage detected