fix(flow): preserve combined signup skip reason

This commit is contained in:
QLHazycoder
2026-05-03 03:41:36 +08:00
parent 02ec8f8906
commit ae74e87fa7
2 changed files with 83 additions and 0 deletions
+3
View File
@@ -1254,6 +1254,9 @@
code: result.code,
phoneVerificationRequired: Boolean(submitResult.addPhonePage),
...(step === 4 && submitResult?.skipProfileStep ? { skipProfileStep: true } : {}),
...(step === 4 && submitResult?.skipProfileStepReason
? { skipProfileStepReason: submitResult.skipProfileStepReason }
: {}),
});
triggerPostSuccessMailboxCleanup(step, mail);
return {
+80
View File
@@ -1342,6 +1342,86 @@ test('verification flow forwards optional signup profile payload when submitting
});
});
test('verification flow keeps combined signup profile skip reason when completing signup verification', async () => {
const completed = [];
const resilientCalls = [];
const helpers = api.createVerificationFlowHelpers({
addLog: async () => {},
chrome: {
tabs: {
update: async () => {},
},
},
CLOUDFLARE_TEMP_EMAIL_PROVIDER: 'cloudflare-temp-email',
completeStepFromBackground: async (step, payload) => {
completed.push({ step, payload });
},
confirmCustomVerificationStepBypassRequest: async () => ({ confirmed: true }),
getHotmailVerificationPollConfig: () => ({}),
getHotmailVerificationRequestTimestamp: () => 0,
getState: async () => ({}),
getTabId: async () => 1,
HOTMAIL_PROVIDER: 'hotmail-api',
isStopError: () => false,
LUCKMAIL_PROVIDER: 'luckmail-api',
MAIL_2925_VERIFICATION_INTERVAL_MS: 15000,
MAIL_2925_VERIFICATION_MAX_ATTEMPTS: 15,
pollCloudflareTempEmailVerificationCode: async () => ({}),
pollHotmailVerificationCode: async () => ({}),
pollLuckmailVerificationCode: async () => ({}),
sendToContentScript: async () => {
throw new Error('should not use non-resilient channel');
},
sendToContentScriptResilient: async (_source, message) => {
resilientCalls.push(message);
return {
success: true,
skipProfileStep: true,
skipProfileStepReason: 'combined_verification_profile',
};
},
sendToMailContentScriptResilient: async () => ({
code: '654321',
emailTimestamp: 123,
}),
setState: async () => {},
setStepStatus: async () => {},
sleepWithStop: async () => {},
throwIfStopped: () => {},
VERIFICATION_POLL_MAX_ROUNDS: 5,
});
await helpers.resolveVerificationStep(
4,
{ email: 'user@example.com', lastSignupCode: null },
{ provider: 'qq', label: 'QQ 邮箱' },
{
signupProfile: {
firstName: 'Ada',
lastName: 'Lovelace',
year: 2003,
month: 6,
day: 19,
},
}
);
assert.equal(resilientCalls[0].payload.signupProfile.firstName, 'Ada');
assert.deepStrictEqual(completed, [
{
step: 4,
payload: {
emailTimestamp: 123,
code: '654321',
phoneVerificationRequired: false,
skipProfileStep: true,
skipProfileStepReason: 'combined_verification_profile',
},
},
]);
});
test('verification flow treats retryable submit transport failure as success when step 4 already redirected to logged-in home', async () => {
const logs = [];