Allow timestamp placeholders for Paddle sandbox tenant email
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-01-03 19:04:54 +01:00
parent eb6c8857d1
commit bd6a8b9c7c

View File

@@ -6,7 +6,7 @@ const shouldRun = process.env.E2E_PADDLE_SANDBOX === '1';
const baseUrl = process.env.E2E_BASE_URL ?? 'https://test-y0k0.fotospiel.app';
const locale = process.env.E2E_LOCALE ?? 'de';
const checkoutSlug = locale === 'en' ? 'checkout' : 'bestellen';
const tenantEmail = process.env.E2E_TENANT_EMAIL ?? process.env.E2E_PADDLE_EMAIL ?? null;
const tenantEmail = buildTenantEmail();
const tenantPassword = process.env.E2E_TENANT_PASSWORD ?? null;
const sandboxCard = {
number: process.env.E2E_PADDLE_CARD_NUMBER ?? '4242 4242 4242 4242',
@@ -178,6 +178,20 @@ async function completeHostedPaddleCheckout(
await payButton.click();
}
function buildTenantEmail(): string | null {
const rawEmail = process.env.E2E_TENANT_EMAIL ?? process.env.E2E_PADDLE_EMAIL ?? null;
if (!rawEmail) {
return null;
}
if (!rawEmail.includes('{timestamp}')) {
return rawEmail;
}
const timestamp = Math.floor(Date.now() / 1000).toString();
return rawEmail.replaceAll('{timestamp}', timestamp);
}
async function fillInAnyFrame(page: Page, selectors: string[], value: string): Promise<void> {
const filled = await attemptFill(page, selectors, value);
if (filled) {