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

Function verifyUiWithDescribe

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

Source from the content-addressed store, hash-verified

1152}
1153
1154async function verifyUiWithDescribe(label, options = {}) {
1155 const attempts = options.attempts ?? (options.expectFixture ? 8 : 3);
1156 const delayMs = options.delayMs ?? (options.expectFixture ? 3_000 : 1_000);
1157 let lastSnapshot = "";
1158 for (let attempt = 1; attempt <= attempts; attempt += 1) {
1159 try {
1160 let snapshot = await retrySimdeckText(
1161 describeUiVerificationArgs(),
1162 `${label} describe`,
1163 {
1164 attempts: 1,
1165 timeoutMs: 90_000,
1166 maxElapsedMs: options.describeMaxElapsedMs ?? describeUiBudgetMs,
1167 },
1168 );
1169 snapshot = await resolveKnownSystemPrompts(snapshot, label);
1170 lastSnapshot = snapshot;
1171 logStep(`ui after ${label}: ${summarizeUi(snapshot)}`);
1172 const fixtureOk = !options.expectFixture || fixtureReady(snapshot);
1173 const textOk =
1174 !options.expectText || snapshot.includes(options.expectText);
1175 if (fixtureOk && textOk) {
1176 return snapshot;
1177 }
1178 } catch (error) {
1179 lastSnapshot = error?.message ?? String(error);
1180 logStep(`ui after ${label}: describe failed, retrying`);
1181 }
1182 if (attempt < attempts) {
1183 await sleep(delayMs);
1184 }
1185 }
1186 throw new Error(
1187 `${label} did not reach expected UI after ${attempts} UI checks:\n${lastSnapshot}`,
1188 );
1189}
1190
1191async function queryUi(label, body) {
1192 return retryHttpJson(

Callers 1

verifyUiFunction · 0.85

Calls 7

retrySimdeckTextFunction · 0.85
logStepFunction · 0.85
summarizeUiFunction · 0.85
fixtureReadyFunction · 0.85
sleepFunction · 0.70

Tested by

no test coverage detected