(snapshot, label)
| 1336 | } |
| 1337 | |
| 1338 | async function resolveKnownSystemPrompts(snapshot, label) { |
| 1339 | if ( |
| 1340 | !looksLikeOpenUrlPrompt(snapshot) && |
| 1341 | !looksLikeKeyboardTipPrompt(snapshot) |
| 1342 | ) { |
| 1343 | return snapshot; |
| 1344 | } |
| 1345 | const promptKind = looksLikeOpenUrlPrompt(snapshot) |
| 1346 | ? "open-url" |
| 1347 | : "keyboard-tip"; |
| 1348 | logStep(`handling system ${promptKind} prompt after ${label}`); |
| 1349 | let current = snapshot; |
| 1350 | const actions = |
| 1351 | promptKind === "open-url" |
| 1352 | ? openUrlPromptActions(snapshot) |
| 1353 | : keyboardTipPromptActions(snapshot); |
| 1354 | for (const action of actions) { |
| 1355 | logStep(`trying prompt action: ${action.label}`); |
| 1356 | action.run(); |
| 1357 | await sleep(1_500); |
| 1358 | current = await retrySimdeckText( |
| 1359 | describeUiVerificationArgs(), |
| 1360 | `${label} describe after ${action.label}`, |
| 1361 | { |
| 1362 | attempts: 3, |
| 1363 | delayMs: 1_000, |
| 1364 | timeoutMs: 90_000, |
| 1365 | maxElapsedMs: describeUiBudgetMs, |
| 1366 | }, |
| 1367 | ); |
| 1368 | if ( |
| 1369 | !looksLikeOpenUrlPrompt(current) && |
| 1370 | !looksLikeKeyboardTipPrompt(current) |
| 1371 | ) { |
| 1372 | logStep(`system ${promptKind} prompt cleared by ${action.label}`); |
| 1373 | return current; |
| 1374 | } |
| 1375 | } |
| 1376 | return current; |
| 1377 | } |
| 1378 | |
| 1379 | function describeUiVerificationArgs() { |
| 1380 | const args = [ |
no test coverage detected