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

Function main

scripts/integration/webrtc.mjs:60–146  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

58 });
59
60async function main() {
61 if (process.platform !== "darwin") {
62 throw new Error("SimDeck WebRTC integration tests require macOS.");
63 }
64 if (!fs.existsSync(simdeck)) {
65 throw new Error(`Missing ${simdeck}. Run npm run build:cli first.`);
66 }
67
68 const { runtime, deviceType, sdkVersion } = selectIntegrationSimulator({
69 runJson,
70 runText,
71 timeoutMs: coreSimulatorCommandTimeoutMs,
72 });
73 const simulatorName = `SimDeck WebRTC Integration ${Date.now()}`;
74 simulatorUDID = runText("xcrun", [
75 "simctl",
76 "create",
77 simulatorName,
78 deviceType.identifier,
79 runtime.identifier,
80 ]).trim();
81 console.log(
82 `created ${simulatorUDID} (${deviceType.name}, ${runtime.version}; iphonesimulator SDK ${sdkVersion})`,
83 );
84
85 startServer();
86 await waitForHealth();
87 await retrySimdeckJson(["boot", simulatorUDID], "WebRTC boot simulator", {
88 attempts: 3,
89 delayMs: 3_000,
90 timeoutMs: simdeckBootTimeoutMs,
91 });
92 runText("xcrun", ["simctl", "bootstatus", simulatorUDID, "-b"], {
93 timeoutMs: 600_000,
94 });
95
96 const fixture = buildCachedFixtureApp({
97 root,
98 tempRoot,
99 bundleId: fixtureBundleId,
100 urlScheme: fixtureUrlScheme,
101 });
102 await launchFixtureWithRecovery(fixture.appPath);
103
104 const screenshotPath = path.join(tempRoot, "reference.png");
105 await retrySimdeckJson(
106 ["screenshot", simulatorUDID, "--output", screenshotPath],
107 "WebRTC reference screenshot",
108 {
109 attempts: process.env.CI === "true" ? 3 : 2,
110 delayMs: 5_000,
111 timeoutMs: process.env.CI === "true" ? 120_000 : 60_000,
112 },
113 );
114 const { width, height } = pngSize(screenshotPath);
115 console.log(`reference screenshot ${width}x${height}`);
116
117 const viewerUrl = new URL(serverUrl);

Callers 1

webrtc.mjsFile · 0.70

Calls 12

buildCachedFixtureAppFunction · 0.90
pngSizeFunction · 0.85
runNodeScriptFunction · 0.85
logMethod · 0.80
setMethod · 0.80
toStringMethod · 0.80
runTextFunction · 0.70
startServerFunction · 0.70
waitForHealthFunction · 0.70
retrySimdeckJsonFunction · 0.70

Tested by

no test coverage detected