Harden Paddle sandbox flow navigation
This commit is contained in:
@@ -17,6 +17,7 @@ const sandboxCard = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
test.use({
|
test.use({
|
||||||
|
channel: process.env.E2E_BROWSER_CHANNEL ?? 'chrome',
|
||||||
userAgent:
|
userAgent:
|
||||||
process.env.E2E_USER_AGENT ??
|
process.env.E2E_USER_AGENT ??
|
||||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36',
|
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36',
|
||||||
@@ -41,11 +42,7 @@ test.describe('Paddle sandbox full flow (staging)', () => {
|
|||||||
|
|
||||||
await dismissConsentBanner(page);
|
await dismissConsentBanner(page);
|
||||||
|
|
||||||
// If login/register step is present, choose guest path or continue
|
await proceedToAccountStep(page);
|
||||||
const continueButtons = page.getByRole('button', { name: /weiter|continue/i });
|
|
||||||
if (await continueButtons.first().isVisible()) {
|
|
||||||
await continueButtons.first().click();
|
|
||||||
}
|
|
||||||
|
|
||||||
await completeRegistrationOrLogin(page, {
|
await completeRegistrationOrLogin(page, {
|
||||||
email: tenantEmail!,
|
email: tenantEmail!,
|
||||||
@@ -165,6 +162,30 @@ async function completeRegistrationOrLogin(page: Page, credentials: { email: str
|
|||||||
await expect(page.getByPlaceholder(/Gutscheincode|Coupon/i)).toBeVisible({ timeout: 20_000 });
|
await expect(page.getByPlaceholder(/Gutscheincode|Coupon/i)).toBeVisible({ timeout: 20_000 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function proceedToAccountStep(page: Page, timeoutMs = 30_000): Promise<void> {
|
||||||
|
const deadline = Date.now() + timeoutMs;
|
||||||
|
|
||||||
|
while (Date.now() < deadline) {
|
||||||
|
const accountForm = page.locator('input[name="first_name"], input[name="identifier"]');
|
||||||
|
if (await accountForm.isVisible()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await dismissConsentBanner(page);
|
||||||
|
|
||||||
|
const continueButton = page.getByRole('button', { name: /Weiter|Continue/i }).first();
|
||||||
|
if (await continueButton.isVisible()) {
|
||||||
|
if (await continueButton.isEnabled()) {
|
||||||
|
await continueButton.click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await page.waitForTimeout(500);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error('Account step did not load in time.');
|
||||||
|
}
|
||||||
|
|
||||||
async function completeHostedPaddleCheckout(
|
async function completeHostedPaddleCheckout(
|
||||||
page: Page,
|
page: Page,
|
||||||
card: { number: string; expiry: string; cvc: string; name: string; postal: string }
|
card: { number: string; expiry: string; cvc: string; name: string; postal: string }
|
||||||
|
|||||||
Reference in New Issue
Block a user