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

Function verifyUi

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

Source from the content-addressed store, hash-verified

1113}
1114
1115async function verifyUi(label, options = {}) {
1116 if (!serverProcess) {
1117 return verifyUiWithDescribe(label, options);
1118 }
1119
1120 const attempts = options.attempts ?? (options.expectFixture ? 8 : 3);
1121 const delayMs = options.delayMs ?? (options.expectFixture ? 1_000 : 500);
1122 let lastError = "";
1123 for (let attempt = 1; attempt <= attempts; attempt += 1) {
1124 try {
1125 await resolveKnownSystemPromptsWithQueries(label);
1126 if (options.expectFixture) {
1127 await waitForUiElement(label, { id: "fixture.continue" }, options);
1128 await queryUi(label, {
1129 selector: { id: "fixture.message" },
1130 limit: 1,
1131 maxDepth: options.maxDepth ?? 3,
1132 });
1133 }
1134 if (options.expectText) {
1135 await waitForUiText(label, options.expectText, options);
1136 }
1137 if (!options.expectFixture && !options.expectText) {
1138 await queryUi(label, { limit: 1, maxDepth: 2 });
1139 }
1140 logStep(`ui after ${label}: ${summarizeUiCheck(options)}`);
1141 return "";
1142 } catch (error) {
1143 lastError = error?.message ?? String(error);
1144 if (attempt < attempts) {
1145 await sleep(delayMs);
1146 }
1147 }
1148 }
1149 throw new Error(
1150 `${label} did not reach expected UI after ${attempts} UI checks:\n${lastError}`,
1151 );
1152}
1153
1154async function verifyUiWithDescribe(label, options = {}) {
1155 const attempts = options.attempts ?? (options.expectFixture ? 8 : 3);

Callers 3

cliStepFunction · 0.85
ensureFixtureForegroundFunction · 0.85
httpStepFunction · 0.85

Calls 8

verifyUiWithDescribeFunction · 0.85
waitForUiElementFunction · 0.85
queryUiFunction · 0.85
waitForUiTextFunction · 0.85
logStepFunction · 0.85
summarizeUiCheckFunction · 0.85
sleepFunction · 0.70

Tested by

no test coverage detected