fix: restart phone signup when password page rejects number
- 合并 PR #214 的核心改动:将密码页手机号已关联账号/phone already exists 归为可重开的注册手机号异常,并补充回归覆盖。 - 本地补充修复:无。 - 影响范围:content/signup-page.js 的 Step 3/4 注册验证码前置检查、step4 split-code 测试。
This commit is contained in:
@@ -2493,7 +2493,7 @@ const SIGNUP_PHONE_PASSWORD_MISMATCH_ERROR_PREFIX = 'SIGNUP_PHONE_PASSWORD_MISMA
|
||||
const AUTH_MAX_CHECK_ATTEMPTS_ERROR_PREFIX = 'AUTH_MAX_CHECK_ATTEMPTS::';
|
||||
const STEP8_EMAIL_IN_USE_ERROR_PREFIX = 'STEP8_EMAIL_IN_USE::';
|
||||
const SIGNUP_EMAIL_EXISTS_PATTERN = /与此电子邮件地址相关联的帐户已存在|account\s+associated\s+with\s+this\s+email\s+address\s+already\s+exists|email\s+address.*already\s+exists/i;
|
||||
const SIGNUP_PHONE_PASSWORD_MISMATCH_PATTERN = /incorrect\s+phone\s+number\s+or\s+password|phone\s+number\s+or\s+password/i;
|
||||
const SIGNUP_PHONE_PASSWORD_MISMATCH_PATTERN = /incorrect\s+phone\s+number\s+or\s+password|phone\s+number\s+or\s+password|与此(?:电话|手机)号码相关联的帐户已存在|account\s+associated\s+with\s+this\s+phone\s+number\s+already\s+exists/i;
|
||||
|
||||
const authPageRecovery = self.MultiPageAuthPageRecovery?.createAuthPageRecovery?.({
|
||||
detailPattern: AUTH_TIMEOUT_ERROR_DETAIL_PATTERN,
|
||||
@@ -2552,9 +2552,9 @@ function createSignupUserAlreadyExistsError() {
|
||||
|
||||
function createSignupPhonePasswordMismatchError(detailText = '') {
|
||||
const detail = String(detailText || '').replace(/\s+/g, ' ').trim();
|
||||
const suffix = detail ? `页面提示:${detail}` : '页面提示手机号或密码不正确。';
|
||||
const suffix = detail ? `页面提示:${detail}` : '页面提示注册手机号不可继续使用,需重新开始当前轮。';
|
||||
return new Error(
|
||||
`${SIGNUP_PHONE_PASSWORD_MISMATCH_ERROR_PREFIX}步骤 3:检测到注册手机号或密码不正确,需要重新开始当前轮。${suffix}`
|
||||
`${SIGNUP_PHONE_PASSWORD_MISMATCH_ERROR_PREFIX}步骤 3:检测到注册手机号异常,需要重新开始当前轮。${suffix}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -806,3 +806,92 @@ return {
|
||||
assert.equal(result.clicks.length, 0);
|
||||
assert.equal(result.logs.some(({ message }) => /检测到密码页报错/.test(message)), true);
|
||||
});
|
||||
|
||||
test('prepareSignupVerificationFlow stops immediately when password page shows phone already exists error', async () => {
|
||||
const api = new Function(`
|
||||
const logs = [];
|
||||
const clicks = [];
|
||||
let now = 0;
|
||||
|
||||
Date.now = () => now;
|
||||
|
||||
function throwIfStopped() {}
|
||||
function log(message, level = 'info') { logs.push({ message, level }); }
|
||||
async function sleep(ms = 0) { now += ms || 200; }
|
||||
function isVisibleElement() { return true; }
|
||||
function isActionEnabled() { return true; }
|
||||
function getActionText(el) { return el?.textContent || ''; }
|
||||
function getCurrentAuthRetryPageState() { return null; }
|
||||
function isPhoneVerificationPageReady() { return false; }
|
||||
function findResendVerificationCodeTrigger() { return null; }
|
||||
function isEmailVerificationPage() { return false; }
|
||||
function getPageTextSnapshot() { return '与此电话号码相关联的帐户已存在'; }
|
||||
function getVerificationCodeTarget() { return null; }
|
||||
function is405MethodNotAllowedPage() { return false; }
|
||||
async function recoverCurrentAuthRetryPage() {}
|
||||
function createSignupUserAlreadyExistsError() { return new Error('user already exists'); }
|
||||
function getSignupPasswordInput() { return { value: 'Secret123!' }; }
|
||||
function getSignupPasswordSubmitButton() { return { textContent: 'Continue' }; }
|
||||
function isSignupEmailAlreadyExistsPage() { return false; }
|
||||
function isSignupPasswordErrorPage() { return false; }
|
||||
function getSignupPasswordTimeoutErrorPageState() { return null; }
|
||||
function isStep5Ready() { return false; }
|
||||
function getSignupPasswordFieldErrorText() { return '与此电话号码相关联的帐户已存在'; }
|
||||
function simulateClick(target) { clicks.push(target?.textContent || 'clicked'); }
|
||||
async function humanPause() {}
|
||||
function fillInput() {}
|
||||
function logSignupPasswordDiagnostics() {}
|
||||
function createSignupPhonePasswordMismatchError(detailText = '') {
|
||||
return new Error('SIGNUP_PHONE_PASSWORD_MISMATCH::' + detailText);
|
||||
}
|
||||
|
||||
const location = {
|
||||
href: 'https://auth.openai.com/log-in/password',
|
||||
pathname: '/log-in/password',
|
||||
};
|
||||
const document = {
|
||||
readyState: 'complete',
|
||||
title: '',
|
||||
body: {
|
||||
textContent: '与此电话号码相关联的帐户已存在',
|
||||
innerText: '与此电话号码相关联的帐户已存在',
|
||||
},
|
||||
querySelector() {
|
||||
return null;
|
||||
},
|
||||
querySelectorAll() {
|
||||
return [];
|
||||
},
|
||||
};
|
||||
|
||||
${extractFunction('isSignupVerificationPageInteractiveReady')}
|
||||
${extractFunction('isVerificationPageStillVisible')}
|
||||
${extractFunction('isSignupProfilePageUrl')}
|
||||
${extractFunction('isLikelyLoggedInChatgptHomeUrl')}
|
||||
${extractFunction('getStep4PostVerificationState')}
|
||||
${extractFunction('inspectSignupVerificationState')}
|
||||
${extractFunction('waitForSignupVerificationTransition')}
|
||||
${extractFunction('prepareSignupVerificationFlow')}
|
||||
|
||||
return {
|
||||
async run() {
|
||||
try {
|
||||
await prepareSignupVerificationFlow({
|
||||
password: 'Secret123!',
|
||||
prepareLogLabel: '步骤 3 收尾',
|
||||
}, 10000);
|
||||
return { threw: false, logs, clicks };
|
||||
} catch (error) {
|
||||
return { threw: true, error: error.message, logs, clicks };
|
||||
}
|
||||
},
|
||||
};
|
||||
`)();
|
||||
|
||||
const result = await api.run();
|
||||
|
||||
assert.equal(result.threw, true);
|
||||
assert.match(result.error, /SIGNUP_PHONE_PASSWORD_MISMATCH::与此电话号码相关联的帐户已存在/);
|
||||
assert.equal(result.clicks.length, 0);
|
||||
assert.equal(result.logs.some(({ message }) => /检测到密码页报错/.test(message)), true);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user