feat: 更新重试逻辑,最多自动点击 5 次以恢复认证页状态

This commit is contained in:
QLHazyCoder
2026-04-19 03:43:00 +08:00
parent afef124856
commit 67304bb64c
5 changed files with 90 additions and 14 deletions
+26
View File
@@ -137,6 +137,32 @@ test('auth page recovery can click retry twice before page recovers', async () =
assert.equal(state.retryVisible, false);
});
test('auth page recovery stops after five retry clicks when page does not recover', async () => {
const state = {
clickCount: 0,
pageText: 'Something went wrong. Please try again.',
retryVisible: true,
onClick() {},
};
const api = createRecoveryApi(state);
await assert.rejects(
() => api.recoverAuthRetryPage({
logLabel: '步骤 8:检测到重试页,正在点击“重试”恢复',
maxClickAttempts: 5,
pathPatterns: [/\/log-in(?:[/?#]|$)/i],
step: 8,
timeoutMs: 1000,
waitAfterClickMs: 10,
pollIntervalMs: 1,
}),
/已连续点击“重试” 5 次/
);
assert.equal(state.clickCount, 5);
assert.equal(state.retryVisible, true);
});
test('auth page recovery throws cloudflare security blocked error on max_check_attempts page', async () => {
const state = {
clickCount: 0,