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

Function ensureFixtureForeground

scripts/integration/cli.mjs:896–1003  ·  view source on GitHub ↗
(label, options = {})

Source from the content-addressed store, hash-verified

894}
895
896async function ensureFixtureForeground(label, options = {}) {
897 const recoveryCount = options.recoveryCount ?? 0;
898 const maxRecoveries = options.maxLaunchRecoveries ?? 1;
899 let launchError = null;
900 let launchVerifyError = null;
901 try {
902 await retrySimdeckJson(
903 cliArgs(["launch", simulatorUDID, fixtureBundleId]),
904 label,
905 {
906 attempts: options.launchAttempts ?? 1,
907 delayMs: options.launchDelayMs ?? 5_000,
908 timeoutMs: options.launchTimeoutMs ?? 180_000,
909 },
910 );
911 } catch (error) {
912 launchError = error;
913 logStep(`${label}: launch command reported ${summarizeError(error)}`);
914 }
915
916 try {
917 return await verifyUi(label, {
918 expectFixture: true,
919 attempts: options.verifyAttempts ?? (launchError === null ? 10 : 2),
920 delayMs: options.verifyDelayMs ?? 1_000,
921 waitTimeoutMs:
922 options.waitTimeoutMs ?? (launchError === null ? 10_000 : 1_000),
923 });
924 } catch (verifyError) {
925 launchVerifyError = verifyError;
926 if (
927 shouldRecycleSimulatorForFixtureLaunch({
928 launchError,
929 verifyError: launchVerifyError,
930 recoveryCount,
931 maxRecoveries,
932 })
933 ) {
934 return recycleFixtureLaunchAndRetry(label, {
935 ...options,
936 reason: activationRecoveryReason({ launchError }),
937 });
938 }
939 logStep(`${label}: opening fixture URL after launch verification failed`);
940 }
941
942 let urlError = null;
943 try {
944 await retrySimdeckJson(
945 cliArgs(["open-url", simulatorUDID, fixtureUrl]),
946 `${label} fixture URL fallback`,
947 {
948 attempts: 2,
949 delayMs: 2_000,
950 timeoutMs: 180_000,
951 },
952 );
953 return await verifyUi(label, {

Callers 3

mainFunction · 0.85
runCliControlsFunction · 0.85

Calls 8

activationRecoveryReasonFunction · 0.90
cliArgsFunction · 0.85
logStepFunction · 0.85
summarizeErrorFunction · 0.85
verifyUiFunction · 0.85
retrySimdeckJsonFunction · 0.70

Tested by

no test coverage detected