MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / runRestControls

Function runRestControls

scripts/integration/cli.mjs:628–703  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

626}
627
628async function runRestControls() {
629 await measuredStep(
630 "REST simulator list",
631 async () => {
632 const simulators = await httpJson("GET", "/api/simulators");
633 if (
634 !simulators.simulators?.some(
635 (simulator) => simulator.udid === simulatorUDID,
636 )
637 ) {
638 throw new Error("REST simulator list did not include temp simulator");
639 }
640 },
641 { phase: phaseSetup },
642 );
643 await measuredStep(
644 "REST accessibility-tree",
645 async () => {
646 assertRoots(
647 await httpJson(
648 "GET",
649 `/api/simulators/${simulatorUDID}/accessibility-tree?source=native-ax&maxDepth=1`,
650 ),
651 "REST accessibility-tree",
652 );
653 },
654 { phase: phaseSetup },
655 );
656 await measuredStep(
657 "REST accessibility-tree interactive",
658 async () => {
659 const fullTree = await httpJson(
660 "GET",
661 `/api/simulators/${simulatorUDID}/accessibility-tree?source=native-ax&maxDepth=8`,
662 );
663 const tree = await httpJson(
664 "GET",
665 `/api/simulators/${simulatorUDID}/accessibility-tree?source=native-ax&maxDepth=8&interactiveOnly=true`,
666 );
667 assertRoots(tree, "REST accessibility-tree interactive");
668 if (tree.interactiveOnly !== true) {
669 throw new Error("interactive tree did not report interactiveOnly=true");
670 }
671 const fullCount = countAccessibilityNodes(fullTree);
672 const interactiveCount = countAccessibilityNodes(tree);
673 if (interactiveCount <= 0 || interactiveCount > fullCount) {
674 throw new Error(
675 `interactive tree node count ${interactiveCount} was not a pruned subset of full count ${fullCount}`,
676 );
677 }
678 },
679 { phase: phaseSetup },
680 );
681 await measuredStep(
682 "REST chrome-profile",
683 async () => {
684 assertJson(
685 await httpJson(

Callers 1

mainFunction · 0.85

Calls 7

countAccessibilityNodesFunction · 0.85
httpBufferFunction · 0.85
measuredStepFunction · 0.70
httpJsonFunction · 0.70
assertRootsFunction · 0.70
assertJsonFunction · 0.70
assertPngBufferFunction · 0.70

Tested by

no test coverage detected