fix: Enhance email input verification with SMART handling for Microsoft domain separation

This commit is contained in:
2025-11-09 11:26:33 +01:00
parent fbbdd370ce
commit 1bf483b76e

View File

@@ -763,21 +763,34 @@ export class AccountCreator {
const emailInput = this.page.locator('input[type="email"]').first() const emailInput = this.page.locator('input[type="email"]').first()
await emailInput.waitFor({ timeout: 15000 }) await emailInput.waitFor({ timeout: 15000 })
// CRITICAL: Retry fill with verification // CRITICAL: Retry fill with SMART verification
// Microsoft separates username from domain for outlook.com/hotmail.com addresses
const emailFillSuccess = await this.retryOperation( const emailFillSuccess = await this.retryOperation(
async () => { async () => {
await emailInput.clear() await emailInput.clear()
await this.humanDelay(800, 1500) // INCREASED from 500-1000 await this.humanDelay(800, 1500)
await emailInput.fill(email) await emailInput.fill(email)
await this.humanDelay(1200, 2500) // INCREASED from 800-2000 await this.humanDelay(1200, 2500)
// Verify value was filled correctly // SMART VERIFICATION: Check if Microsoft separated the domain
const verified = await this.verifyInputValue('input[type="email"]', email, 'EMAIL_INPUT') const inputValue = await emailInput.inputValue().catch(() => '')
if (!verified) { const emailUsername = email.split('@')[0] // e.g., "sharon_jackson"
const emailDomain = email.split('@')[1] // e.g., "outlook.com"
// Check if input contains full email OR just username (Microsoft separated domain)
if (inputValue === email) {
// Full email is in input (not separated)
log(false, 'CREATOR', `[EMAIL_INPUT] ✅ Input value verified: ${email}`, 'log', 'green')
return true
} else if (inputValue === emailUsername && (emailDomain === 'outlook.com' || emailDomain === 'hotmail.com' || emailDomain === 'outlook.fr')) {
// Microsoft separated the domain - this is EXPECTED and OK
log(false, 'CREATOR', `[EMAIL_INPUT] ✅ Username verified: ${emailUsername} (domain separated by Microsoft)`, 'log', 'green')
return true
} else {
// Unexpected value
log(false, 'CREATOR', `[EMAIL_INPUT] ⚠️ Unexpected value: expected "${email}" or "${emailUsername}", got "${inputValue}"`, 'warn', 'yellow')
throw new Error('Email input value not verified') throw new Error('Email input value not verified')
} }
return true
}, },
'EMAIL_FILL', 'EMAIL_FILL',
3, 3,
@@ -823,12 +836,10 @@ export class AccountCreator {
return null return null
} }
// CRITICAL: Verify we can actually proceed (password page OR no error) // CRITICAL: If email was accepted by handleEmailErrors, trust that result
const finalCheck = await this.verifyNoErrors('EMAIL_FINAL_CHECK') // Don't do additional error check here as it may detect false positives
if (!finalCheck) { // (e.g., transient errors that were already handled)
log(false, 'CREATOR', '❌ Email step has errors, cannot proceed', 'error') log(false, 'CREATOR', ` Email step completed successfully: ${result.email}`, 'log', 'green')
return null
}
return result.email return result.email
} }
@@ -874,21 +885,26 @@ export class AccountCreator {
const emailInput = this.page.locator('input[type="email"]').first() const emailInput = this.page.locator('input[type="email"]').first()
// CRITICAL: Retry fill with verification // CRITICAL: Retry fill with SMART verification (handles domain separation)
const retryFillSuccess = await this.retryOperation( const retryFillSuccess = await this.retryOperation(
async () => { async () => {
await emailInput.clear() await emailInput.clear()
await this.humanDelay(800, 1500) // INCREASED from 500-1000 await this.humanDelay(800, 1500)
await emailInput.fill(newEmail) await emailInput.fill(newEmail)
await this.humanDelay(1200, 2500) // INCREASED from 800-2000 await this.humanDelay(1200, 2500)
// Verify value was filled correctly // SMART VERIFICATION: Microsoft may separate domain
const verified = await this.verifyInputValue('input[type="email"]', newEmail, 'EMAIL_RETRY') const inputValue = await emailInput.inputValue().catch(() => '')
if (!verified) { const emailUsername = newEmail.split('@')[0]
const emailDomain = newEmail.split('@')[1]
if (inputValue === newEmail || (inputValue === emailUsername && (emailDomain === 'outlook.com' || emailDomain === 'hotmail.com' || emailDomain === 'outlook.fr'))) {
log(false, 'CREATOR', '[EMAIL_RETRY] ✅ Value verified (domain may be separated)', 'log', 'green')
return true
} else {
log(false, 'CREATOR', `[EMAIL_RETRY] ⚠️ Unexpected value: "${inputValue}"`, 'warn', 'yellow')
throw new Error('Email retry input value not verified') throw new Error('Email retry input value not verified')
} }
return true
}, },
'EMAIL_RETRY_FILL', 'EMAIL_RETRY_FILL',
3, 3,