skillhub/web/e2e/helpers/auth-fixtures.ts
dongmucat 38ebb13133
feat(auth): 邮箱验证码重置密码与 SMTP 配置支持 (#273)
* feat(auth): add email-based password reset with SMTP config docs

* test(e2e): stabilize password reset flow

* test(e2e): isolate password reset rate limits

* test(ci): stabilize backend and register e2e

* docs(auth): sanitize smtp setup examples
2026-04-13 20:27:00 +08:00

16 lines
565 B
TypeScript

import type { Page } from '@playwright/test'
export async function setEnglishLocale(page: Page) {
await page.addInitScript(() => {
window.localStorage.setItem('i18nextLng', 'en')
})
}
export async function setUniqueClientIp(page: Page, seed: string) {
const suffix = Date.now() + Math.floor(Math.random() * 1000)
const thirdOctet = seed.split('').reduce((sum, char) => sum + char.charCodeAt(0), 0) % 250
const fourthOctet = suffix % 250
await page.context().setExtraHTTPHeaders({
'X-Forwarded-For': `10.0.${thirdOctet}.${fourthOctet}`,
})
}