Files
fotospiel-app/tests/e2e/tenant-onboarding-flow.test.ts

68 lines
2.9 KiB
TypeScript

import { test, expectFixture as expect } from './utils/test-fixtures';
/**
* Skeleton E2E coverage for the tenant onboarding journey.
*
* This suite is currently skipped until we have stable seed data and
* authentication helpers for Playwright. Once those are in place we can
* remove the skip and let the flow exercise the welcome -> packages -> summary
* steps with mocked Stripe/Paddle APIs.
*/
test.describe('Tenant Onboarding Welcome Flow', () => {
test('redirects unauthenticated users to login', async ({ page }) => {
await page.goto('/event-admin/welcome');
await expect(page).toHaveURL(/\/event-admin\/login/);
await expect(page.getByText('Bitte warten', { exact: false })).toBeVisible();
});
test('tenant admin can progress through welcome, packages, summary, and setup', async ({
tenantAdminCredentials,
signInTenantAdmin,
page,
}) => {
test.skip(
!tenantAdminCredentials,
'Provide E2E_TENANT_EMAIL and E2E_TENANT_PASSWORD (see docs/testing/e2e.md) to run onboarding tests.'
);
await signInTenantAdmin();
// If guard redirects to dashboard, hop to welcome manually.
if (!page.url().includes('/event-admin/welcome')) {
await page.goto('/event-admin/welcome');
}
await expect(page.getByRole('heading', { name: /Willkommen im Event-Erlebnisstudio/i })).toBeVisible();
// Open package selection via CTA.
await page.getByRole('button', { name: /Pakete entdecken/i }).click();
await expect(page).toHaveURL(/\/event-admin\/welcome\/packages/);
await expect(page.getByRole('heading', { name: /Wähle dein Eventpaket/i })).toBeVisible();
// Choose the first available package and ensure we land on the summary step.
const choosePackageButton = page.getByRole('button', { name: /Paket wählen/i }).first();
await choosePackageButton.waitFor({ state: 'visible', timeout: 10_000 });
await choosePackageButton.click();
await expect(page).toHaveURL(/\/event-admin\/welcome\/summary/);
await expect(page.getByRole('heading', { name: /Bestellübersicht/i })).toBeVisible();
// Validate payment sections. Depending on env we either see Stripe/Paddle widgets or configuration warnings.
const stripeConfigured = Boolean(process.env.VITE_STRIPE_PUBLISHABLE_KEY);
if (stripeConfigured) {
await expect(page.getByRole('heading', { name: /Kartenzahlung \(Stripe\)/i })).toBeVisible();
} else {
await expect(
page.getByText(/Stripe nicht verfügbar|PaymentIntent konnte nicht erstellt werden|Publishable Key fehlt/i)
).toBeVisible();
}
await expect(page.getByRole('heading', { name: /^Paddle$/i })).toBeVisible();
// Continue to the setup step without completing a purchase.
await page.getByRole('button', { name: /Weiter zum Setup/i }).click();
await expect(page).toHaveURL(/\/event-admin\/welcome\/event/);
await expect(page.getByRole('heading', { name: /Bereite dein erstes Event vor/i })).toBeVisible();
});
});