neuer checkout-pfad: /de/bestellen/paketID und /en/checkout/PackageID

This commit is contained in:
Codex Agent
2025-12-20 16:17:21 +01:00
parent 18297aa3f1
commit 6500b8df2c
18 changed files with 331 additions and 345 deletions

View File

@@ -1,13 +1,17 @@
import { test, expectFixture as expect } from '../helpers/test-fixtures';
const shouldRun = process.env.E2E_TESTING_API === '1';
const demoTenantCredentials = {
email: process.env.E2E_DEMO_TENANT_EMAIL ?? 'tenant-demo@fotospiel.app',
password: process.env.E2E_DEMO_TENANT_PASSWORD ?? 'Demo1234!',
};
test.describe('Standard package checkout with coupons', () => {
test.skip(!shouldRun, 'Set E2E_TESTING_API=1 to enable checkout tests that use /api/_testing endpoints.');
test('applies seeded coupon and shows discount summary', async ({
page,
tenantAdminCredentials,
seedTestCoupons,
}) => {
test.skip(!tenantAdminCredentials, 'Tenant admin credentials required via E2E_TENANT_EMAIL/PASSWORD');
await seedTestCoupons();
await page.goto('/de/packages');
@@ -25,16 +29,15 @@ test.describe('Standard package checkout with coupons', () => {
await dialog.getByRole('link', { name: /Jetzt bestellen|Order now|Jetzt buchen/i }).click();
await expect(page).toHaveURL(/\/purchase-wizard\/\d+/);
await expect(page).toHaveURL(/\/(bestellen|checkout)\/\d+/);
await page.getByRole('button', { name: /^Weiter$/ }).first().click();
await expect(page.getByRole('heading', { name: /Registrieren/i })).toBeVisible();
await page.getByRole('button', { name: /^Anmelden$/ }).first().click();
await page.fill('input[name="identifier"]', tenantAdminCredentials.email);
await page.fill('input[name="password"]', tenantAdminCredentials.password);
await expect(page.locator('input[name="identifier"]')).toBeVisible();
await page.fill('input[name="identifier"]', demoTenantCredentials.email);
await page.fill('input[name="password"]', demoTenantCredentials.password);
await page.getByRole('button', { name: /^Anmelden$/ }).last().click();
await expect(page.getByPlaceholder(/Gutscheincode/i)).toBeVisible();
@@ -44,6 +47,6 @@ test.describe('Standard package checkout with coupons', () => {
await expect(page.getByText(/Gutschein PERCENT10 aktiviert/i)).toBeVisible();
await expect(page.getByText(/Rabatt|Discount/i)).toBeVisible();
await expect(page.getByText(/Total|Gesamt/i)).toBeVisible();
await expect(page.getByText(/Gesamtsumme|Total|Gesamt/i)).toBeVisible();
});
});