(step, timeout)
| 1240 | |
| 1241 | |
| 1242 | async function waitForVerificationSubmitOutcome(step, timeout) { |
| 1243 | const resolvedTimeout = timeout ?? (step === 7 ? 30000 : 12000); |
| 1244 | const start = Date.now(); |
| 1245 | |
| 1246 | while (Date.now() - start < resolvedTimeout) { |
| 1247 | throwIfStopped(); |
| 1248 | |
| 1249 | const errorText = getVerificationErrorText(); |
| 1250 | if (errorText) { |
| 1251 | return { invalidCode: true, errorText }; |
| 1252 | } |
| 1253 | |
| 1254 | if (step === 4 && isStep5Ready()) { |
| 1255 | return { success: true }; |
| 1256 | } |
| 1257 | |
| 1258 | if (step === 7 && isStep8Ready()) { |
| 1259 | return { success: true }; |
| 1260 | } |
| 1261 | |
| 1262 | if (step === 7 && isAddPhonePageReady()) { |
| 1263 | return { success: true, addPhonePage: true }; |
| 1264 | } |
| 1265 | |
| 1266 | await sleep(150); |
| 1267 | } |
| 1268 | |
| 1269 | if (isVerificationPageStillVisible()) { |
| 1270 | return { |
| 1271 | invalidCode: true, |
| 1272 | errorText: getVerificationErrorText() || '提交后仍停留在验证码页面,准备重新发送验证码。', |
| 1273 | }; |
| 1274 | } |
| 1275 | |
| 1276 | return { success: true, assumed: true }; |
| 1277 | } |
| 1278 | |
| 1279 | async function fillVerificationCode(step, payload) { |
| 1280 | const { code } = payload; |
no test coverage detected