rework of the e2e test suites

This commit is contained in:
Codex Agent
2025-11-19 22:23:33 +01:00
parent 8d2075bdd2
commit 0127114e59
32 changed files with 1593 additions and 124 deletions

View File

@@ -1,83 +0,0 @@
import 'dotenv/config';
import { test as base, expect, Page, APIRequestContext } from '@playwright/test';
export type TenantCredentials = {
email: string;
password: string;
};
export type TenantAdminFixtures = {
tenantAdminCredentials: TenantCredentials | null;
signInTenantAdmin: () => Promise<void>;
};
const tenantAdminEmail = process.env.E2E_TENANT_EMAIL ?? 'hello@lumen-moments.demo';
const tenantAdminPassword = process.env.E2E_TENANT_PASSWORD ?? 'Demo1234!';
export const test = base.extend<TenantAdminFixtures>({
tenantAdminCredentials: async ({}, use) => {
if (!tenantAdminEmail || !tenantAdminPassword) {
await use(null);
return;
}
await use({
email: tenantAdminEmail,
password: tenantAdminPassword,
});
},
signInTenantAdmin: async ({ page, tenantAdminCredentials }, use) => {
if (!tenantAdminCredentials) {
await use(async () => {
throw new Error('Tenant admin credentials missing. Provide E2E_TENANT_EMAIL and E2E_TENANT_PASSWORD.');
});
return;
}
await use(async () => {
await performTenantSignIn(page, tenantAdminCredentials);
});
},
});
export const expectFixture = expect;
async function performTenantSignIn(page: Page, credentials: TenantCredentials) {
const token = await exchangeToken(page.request, credentials);
await page.addInitScript(({ stored }) => {
localStorage.setItem('tenant_admin.token.v1', JSON.stringify(stored));
sessionStorage.setItem('tenant_admin.token.session.v1', JSON.stringify(stored));
}, { stored: token });
await page.goto('/event-admin');
await page.waitForLoadState('domcontentloaded');
}
type StoredTokenPayload = {
accessToken: string;
abilities: string[];
issuedAt: number;
};
async function exchangeToken(request: APIRequestContext, credentials: TenantCredentials): Promise<StoredTokenPayload> {
const response = await request.post('/api/v1/tenant-auth/login', {
data: {
login: credentials.email,
password: credentials.password,
},
});
if (!response.ok()) {
throw new Error(`Tenant PAT login failed: ${response.status()} ${await response.text()}`);
}
const body = await response.json();
return {
accessToken: body.token,
abilities: Array.isArray(body.abilities) ? body.abilities : [],
issuedAt: Date.now(),
};
}

View File

@@ -1,6 +1,6 @@
import type { Page } from '@playwright/test';
import { test, expectFixture as expect } from './utils/test-fixtures';
import { test, expectFixture as expect } from '../helpers/test-fixtures';
const futureDate = (daysAhead = 10): string => {
const date = new Date();
@@ -106,4 +106,55 @@ test.describe('Tenant Admin PWA end-to-end coverage', () => {
await page.waitForLoadState('networkidle');
await expect(page.getByRole('heading', { name: /Einstellungen/i })).toBeVisible();
});
test('wedding event workflow assigns tasks and exposes join token', async ({ page, fetchJoinToken }) => {
const eventName = `Playwright Hochzeit ${Date.now()}`;
const eventDate = futureDate(21);
await page.goto('/event-admin/events/new');
await page.waitForLoadState('networkidle');
await page.getByLabel(/Eventname/i).fill(eventName);
await page.getByLabel(/Datum/i).fill(eventDate);
const eventTypeCombo = page.getByRole('combobox', { name: /Event-Typ/i });
await eventTypeCombo.click();
const weddingOption = page.getByRole('option', { name: /Hochzeit|Wedding/i }).first();
await expect(weddingOption).toBeVisible();
await weddingOption.click();
await page.getByRole('button', { name: /^Speichern/i }).click();
await page.waitForURL(/\/event-admin\/events\/[a-z0-9-]+$/i, { timeout: 20_000 });
const createdSlug = page.url().split('/').pop() ?? '';
await expect(page.getByText(/Hochzeit|Wedding/i)).toBeVisible();
await page.goto(`/event-admin/events/${createdSlug}/tasks`);
await expect(page.getByRole('heading', { name: /Event-Tasks/i })).toBeVisible();
const librarySection = page
.locator('section')
.filter({ hasText: /Tasks aus Bibliothek hinzufügen|Add tasks/i })
.first();
const availableTaskLabels = librarySection.locator('label');
const availableCount = await availableTaskLabels.count();
test.skip(availableCount === 0, 'No task library entries available to assign');
const firstLabel = availableTaskLabels.first();
const taskTitle = ((await firstLabel.locator('p').first().textContent()) ?? '').trim();
await firstLabel.click();
await page
.getByRole('button', { name: /Ausgewählte Tasks zuweisen|Assign selected tasks/i })
.click();
await expect(
page.locator('section').filter({ hasText: /Zugeordnete Tasks|Assigned tasks/i }).getByText(taskTitle, { exact: false }),
).toBeVisible({ timeout: 15_000 });
const joinToken = await fetchJoinToken({ slug: createdSlug });
expect(joinToken.token).toBeTruthy();
expect(joinToken.join_url).toContain(joinToken.token);
expect(joinToken.qr_svg).toContain('<svg');
});
});

View File

@@ -1,4 +1,4 @@
import { test, expectFixture as expect } from './utils/test-fixtures';
import { test, expectFixture as expect } from '../helpers/test-fixtures';
/**
* Skeleton E2E coverage for the tenant onboarding journey.

View File

@@ -0,0 +1,58 @@
import { test, expectFixture as expect } from '../helpers/test-fixtures';
test.describe('Marketing auth flows', () => {
test('registers a new account and captures welcome email', async ({ page, clearTestMailbox, getTestMailbox }) => {
await clearTestMailbox();
const stamp = Date.now();
const email = `playwright-register-${stamp}@example.test`;
const username = `playwright-${stamp}`;
const password = 'Password123!';
await page.goto('/register');
await page.getByLabel(/Vorname/i).fill('Playwright');
await page.getByLabel(/Nachname/i).fill('Tester');
await page.getByLabel(/^E-Mail/i).fill(email);
await page.getByLabel(/Telefon/i).fill('+49123456789');
await page.getByLabel(/Adresse/i).fill('Teststr. 1, 12345 Berlin');
await page.getByLabel(/Username/i).fill(username);
await page.getByLabel(/^Passwort$/i).fill(password);
await page.getByLabel(/Passwort bestätigen/i).fill(password);
await page.locator('#privacy_consent').check();
await page.getByRole('button', { name: /^Registrieren$/i }).click();
await expect.poll(() => page.url()).not.toContain('/register');
const messages = await getTestMailbox();
const hasWelcome = messages.some((message) =>
message.to.some((recipient) => recipient.email === email)
);
expect(hasWelcome).toBe(true);
});
test('shows inline error on invalid login', async ({ page }) => {
await page.goto('/login');
await page.fill('input[name="login"]', `unknown-${Date.now()}@example.test`);
await page.fill('input[name="password"]', 'totally-wrong');
await page.getByRole('button', { name: /^Anmelden$/i }).click();
await expect(
page.getByText(/Diese Anmeldedaten wurden nicht gefunden/i).first()
).toBeVisible();
});
test('sends password reset email notice', async ({ page }) => {
await page.goto('/forgot-password');
await page.getByLabel(/Email address/i).fill(`ghost-${Date.now()}@example.test`);
await page.getByRole('button', { name: /Email password reset link/i }).click();
await expect(
page.getByText(/reset link will be sent if the account exists/i)
).toBeVisible();
});
});

View File

@@ -0,0 +1,89 @@
import fs from 'node:fs';
import path from 'node:path';
import { expectFixture as expect, test } from '../helpers/test-fixtures';
const guestCount = 15;
const uploadFixturePath = ensureUploadFixture();
test.describe('Guest PWA multi-guest journey', () => {
test('15 guests can onboard, explore tasks, trigger upload review, and reach gallery', async ({
browser,
fetchJoinToken,
}) => {
const eventSlug = process.env.E2E_GUEST_EVENT_SLUG;
test.skip(!eventSlug, 'Set E2E_GUEST_EVENT_SLUG to point the guest suite at an existing event.');
const joinToken = await fetchJoinToken({ slug: eventSlug!, ensureActive: true });
const baseUrl = (process.env.E2E_GUEST_BASE_URL ?? 'http://localhost:8000').replace(/\/+$/, '');
const landingUrl = `${baseUrl}/event`;
const eventBaseUrl = `${baseUrl}/e/${joinToken.token}`;
for (let index = 0; index < guestCount; index += 1) {
const context = await browser.newContext();
const page = await context.newPage();
const guestName = `Gast ${index + 1}`;
await page.goto(landingUrl, { waitUntil: 'domcontentloaded' });
await page.getByPlaceholder(/Event-Code eingeben|Enter event code/i).fill(joinToken.token);
await page.getByRole('button', { name: /Event beitreten|Join event/i }).click();
await completeProfileSetup(page, guestName, joinToken.token);
await page.goto(`${eventBaseUrl}/tasks`, { waitUntil: 'domcontentloaded' });
await expect(page.locator('body')).toContainText(/Aufgaben|Tasks/);
await page.goto(`${eventBaseUrl}/upload`, { waitUntil: 'domcontentloaded' });
const fileInput = page.locator('input[type="file"]');
await expect(fileInput).toBeVisible({ timeout: 15_000 });
await fileInput.setInputFiles(uploadFixturePath);
await expect(
page.getByRole('button', { name: /Nochmal aufnehmen|Retake/i })
).toBeVisible({ timeout: 15_000 });
await page.getByRole('button', { name: /Nochmal aufnehmen|Retake/i }).click();
// Simulate offline queue testing for the last five guests.
if (index >= guestCount - 5) {
await context.setOffline(true);
await page.goto(`${eventBaseUrl}/tasks`, { waitUntil: 'domcontentloaded' }).catch(() => undefined);
await context.setOffline(false);
}
await page.goto(`${eventBaseUrl}/gallery`, { waitUntil: 'domcontentloaded' });
await expect(page.locator('body')).toContainText(/Galerie|Gallery/);
const likeButtons = page.getByLabel(/Foto liken|Like photo/i);
if (await likeButtons.count()) {
await likeButtons.first().click();
}
await context.close();
}
});
});
async function completeProfileSetup(page: import('@playwright/test').Page, guestName: string, token: string) {
await page.waitForLoadState('domcontentloaded');
if (page.url().includes('/setup/')) {
await page.getByLabel(/Dein Name|Your name/i).fill(guestName);
await page.getByRole('button', { name: /Los gehts|Let's go/i }).click();
}
await page.waitForURL(new RegExp(`/e/${token}`), {
timeout: 60_000,
});
}
function ensureUploadFixture(): string {
const fixtureDir = path.join(process.cwd(), 'tests/ui/guest/fixtures');
const fixturePath = path.join(fixtureDir, 'sample-upload.png');
if (!fs.existsSync(fixtureDir)) {
fs.mkdirSync(fixtureDir, { recursive: true });
}
if (!fs.existsSync(fixturePath)) {
const png1x1 = Buffer.from(
'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==',
'base64'
);
fs.writeFileSync(fixturePath, png1x1);
}
return fixturePath;
}

View File

@@ -0,0 +1,236 @@
import 'dotenv/config';
import { test as base, expect, Page, APIRequestContext, APIResponse } from '@playwright/test';
export type TenantCredentials = {
email: string;
password: string;
};
export type TenantAdminFixtures = {
tenantAdminCredentials: TenantCredentials | null;
signInTenantAdmin: () => Promise<void>;
};
export type MailboxEntry = {
id: string;
subject: string | null;
to: Array<{ email: string; name: string | null }>;
from: Array<{ email: string; name: string | null }>;
html: string | null;
text: string | null;
sent_at: string;
};
export type CouponSeedDefinition = {
code: string;
type: 'percentage' | 'flat' | 'flat_per_seat';
amount: number;
currency?: string | null;
description?: string;
enabled_for_checkout?: boolean;
usage_limit?: number | null;
per_customer_limit?: number | null;
starts_at?: string | null;
ends_at?: string | null;
packages?: number[];
};
export type TestingApiFixtures = {
clearTestMailbox: () => Promise<void>;
getTestMailbox: () => Promise<MailboxEntry[]>;
seedTestCoupons: (definitions?: CouponSeedDefinition[]) => Promise<Array<{ id: number; code: string }>>;
getLatestCheckoutSession: (filters?: { email?: string; tenantId?: number; status?: string }) => Promise<CheckoutSessionSummary | null>;
simulatePaddleCompletion: (sessionId: string, overrides?: Partial<PaddleSimulationOverrides>) => Promise<void>;
fetchJoinToken: (params: { eventId?: number; slug?: string; ensureActive?: boolean }) => Promise<JoinTokenPayload>;
};
export type CheckoutSessionSummary = {
id: string;
status: string;
provider: string | null;
tenant_id: number | null;
package_id: number | null;
user_email: string | null;
coupon_id: number | null;
amount_subtotal: string | null;
amount_total: string | null;
created_at: string | null;
};
export type PaddleSimulationOverrides = {
event_type: string;
transaction_id?: string;
status?: string;
checkout_id?: string;
metadata?: Record<string, unknown>;
};
export type JoinTokenPayload = {
event_id: number;
token_id: number;
token: string;
join_url: string;
qr_svg: string;
expires_at: string | null;
usage_count: number;
usage_limit: number | null;
};
const tenantAdminEmail = process.env.E2E_TENANT_EMAIL ?? 'hello@lumen-moments.demo';
const tenantAdminPassword = process.env.E2E_TENANT_PASSWORD ?? 'Demo1234!';
export const test = base.extend<TenantAdminFixtures & TestingApiFixtures>({
tenantAdminCredentials: async ({}, use) => {
if (!tenantAdminEmail || !tenantAdminPassword) {
await use(null);
return;
}
await use({
email: tenantAdminEmail,
password: tenantAdminPassword,
});
},
signInTenantAdmin: async ({ page, tenantAdminCredentials }, use) => {
if (!tenantAdminCredentials) {
await use(async () => {
throw new Error('Tenant admin credentials missing. Provide E2E_TENANT_EMAIL and E2E_TENANT_PASSWORD.');
});
return;
}
await use(async () => {
await performTenantSignIn(page, tenantAdminCredentials);
});
},
clearTestMailbox: async ({ request }, use) => {
await use(async () => {
await expectApiSuccess(request.delete('/api/_testing/mailbox'));
});
},
getTestMailbox: async ({ request }, use) => {
await use(async () => {
const response = await expectApiSuccess(request.get('/api/_testing/mailbox'));
const json = await response.json();
return Array.isArray(json.data) ? (json.data as MailboxEntry[]) : [];
});
},
seedTestCoupons: async ({ request }, use) => {
await use(async (definitions?: CouponSeedDefinition[]) => {
const response = await expectApiSuccess(
request.post('/api/_testing/coupons/seed', {
data: definitions && definitions.length > 0 ? { coupons: definitions } : undefined,
})
);
const json = await response.json();
return Array.isArray(json.data) ? json.data : [];
});
},
getLatestCheckoutSession: async ({ request }, use) => {
await use(async (filters?: { email?: string; tenantId?: number; status?: string }) => {
const response = await request.get('/api/_testing/checkout/sessions/latest', {
params: {
email: filters?.email,
tenant_id: filters?.tenantId,
status: filters?.status,
},
});
if (response.status() === 404) {
return null;
}
await expectApiSuccess(Promise.resolve(response));
const json = await response.json();
return json.data as CheckoutSessionSummary;
});
},
simulatePaddleCompletion: async ({ request }, use) => {
await use(async (sessionId: string, overrides?: Partial<PaddleSimulationOverrides>) => {
await expectApiSuccess(
request.post(`/api/_testing/checkout/sessions/${sessionId}/simulate-paddle`, {
data: overrides,
})
);
});
},
fetchJoinToken: async ({ request }, use) => {
await use(async ({ eventId, slug, ensureActive = true }: { eventId?: number; slug?: string; ensureActive?: boolean }) => {
const response = await expectApiSuccess(
request.get('/api/_testing/events/join-token', {
params: {
event_id: eventId,
slug,
ensure_active: ensureActive,
},
})
);
const json = await response.json();
return json.data as JoinTokenPayload;
});
},
});
export const expectFixture = expect;
async function performTenantSignIn(page: Page, credentials: TenantCredentials) {
const token = await exchangeToken(page.request, credentials);
await page.addInitScript(({ stored }) => {
localStorage.setItem('tenant_admin.token.v1', JSON.stringify(stored));
sessionStorage.setItem('tenant_admin.token.session.v1', JSON.stringify(stored));
}, { stored: token });
await page.goto('/event-admin');
await page.waitForLoadState('domcontentloaded');
}
type StoredTokenPayload = {
accessToken: string;
abilities: string[];
issuedAt: number;
};
async function exchangeToken(request: APIRequestContext, credentials: TenantCredentials): Promise<StoredTokenPayload> {
const response = await request.post('/api/v1/tenant-auth/login', {
data: {
login: credentials.email,
password: credentials.password,
},
});
if (!response.ok()) {
throw new Error(`Tenant PAT login failed: ${response.status()} ${await response.text()}`);
}
const body = await response.json();
return {
accessToken: body.token,
abilities: Array.isArray(body.abilities) ? body.abilities : [],
issuedAt: Date.now(),
};
}
async function expectApiSuccess(responsePromise: Promise<APIResponse>): Promise<APIResponse> {
const response = await responsePromise;
if (!response.ok()) {
throw new Error(`Test API request failed: ${response.status()} ${await response.text()}`);
}
return response;
}

View File

@@ -0,0 +1,12 @@
import { test, expectFixture as expect } from '../helpers/test-fixtures';
test.describe('Coupon scaffolding', () => {
test('default coupon presets are created via testing API', async ({ seedTestCoupons }) => {
const seeded = await seedTestCoupons();
expect(seeded.length).toBeGreaterThanOrEqual(3);
expect(seeded.map((coupon) => coupon.code)).toEqual(
expect.arrayContaining(['PERCENT10', 'FLAT50', 'EXPIRED25'])
);
});
});

View File

@@ -0,0 +1,159 @@
import { test, expectFixture as expect } from '../helpers/test-fixtures';
test.describe('Standard package checkout with Paddle completion', () => {
test('registers, applies coupon, and reaches confirmation', async ({
page,
clearTestMailbox,
getLatestCheckoutSession,
simulatePaddleCompletion,
getTestMailbox,
}) => {
await clearTestMailbox();
const unique = Date.now();
const email = `checkout+${unique}@example.test`;
const password = 'Password123!';
const username = `playwright-${unique}`;
await page.addInitScript(() => {
window.__openedWindows = [];
const originalOpen = window.open;
window.open = function (...args) {
window.__openedWindows.push(args);
return originalOpen?.apply(this, args) ?? null;
};
});
await page.route('https://cdn.paddle.com/paddle/v2/paddle.js', async (route) => {
await route.fulfill({
status: 200,
contentType: 'application/javascript',
body: `
window.__paddleEventCallback = null;
window.__paddleInitOptions = null;
window.__paddleCheckoutConfig = null;
window.Paddle = {
Environment: { set() {} },
Initialize(options) {
window.__paddleInitOptions = options;
window.__paddleEventCallback = options?.eventCallback || null;
},
Checkout: {
open(config) {
window.__paddleCheckoutConfig = config;
},
},
};
`,
});
});
let paddleRequestPayload: Record<string, unknown> | null = null;
await page.route('**/paddle/create-checkout', async (route) => {
paddleRequestPayload = route.request().postDataJSON() as Record<string, unknown>;
await route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({
checkout_url: 'https://sandbox.paddle.test/checkout/abc123',
}),
});
});
await page.goto('/de/packages');
const standardDetailsButton = page
.getByRole('heading', { name: /^Standard$/ })
.locator('..')
.getByRole('button', { name: /Details/i })
.first();
await expect(standardDetailsButton).toBeVisible();
await standardDetailsButton.click();
await expect(page.getByRole('dialog')).toBeVisible();
await page.getByRole('link', { name: /Jetzt bestellen|Order now/i }).click();
await expect(page).toHaveURL(/purchase-wizard/);
await page.getByRole('button', { name: /^Weiter$/ }).first().click();
await expect(page.getByRole('heading', { name: 'Registrieren' })).toBeVisible();
await page.getByLabel(/Vorname/i).fill('Playwright');
await page.getByLabel(/Nachname/i).fill('Tester');
await page.getByLabel(/E-Mail/i).fill(email);
await page.getByLabel(/Telefon/i).fill('+49123456789');
await page.getByLabel(/Adresse/i).fill('Teststr. 1, 12345 Berlin');
await page.getByLabel(/Username/i).fill(username);
await page.getByLabel(/^Passwort$/i).fill(password);
await page.getByLabel(/Passwort bestätigen/i).fill(password);
await page.getByLabel(/Datenschutzerklärung/i).check();
await page.getByRole('button', { name: /^Registrieren$/ }).click();
await expect(page.getByRole('heading', { name: 'Zahlung' })).toBeVisible();
await page.getByPlaceholder(/Gutscheincode/i).fill('PERCENT10');
await page.getByRole('button', { name: /Gutschein anwenden|Apply coupon/i }).click();
await expect(page.getByText(/Gutschein PERCENT10/i)).toBeVisible();
await page.getByRole('button', { name: /Weiter mit Paddle|Continue with Paddle/i }).click();
await expect.poll(async () => page.evaluate(() => window.__paddleCheckoutConfig)).not.toBeNull();
await expect.poll(async () => {
return page.evaluate(() => window.__openedWindows?.length ?? 0);
}).toBe(1);
await expect.poll(async () => {
return page.evaluate(() => window.__openedWindows?.[0]?.[0] ?? null);
}).toContain('https://sandbox.paddle.test/checkout/abc123');
await page.evaluate(() => {
window.__paddleEventCallback?.({ name: 'checkout.completed' });
});
let session = null;
for (let i = 0; i < 6; i++) {
session = await getLatestCheckoutSession({ email });
if (session) {
break;
}
await page.waitForTimeout(500);
}
expect(session).not.toBeNull();
await simulatePaddleCompletion(session!.id);
for (let i = 0; i < 6; i++) {
const refreshed = await getLatestCheckoutSession({ email });
if (refreshed?.status === 'completed') {
session = refreshed;
break;
}
await page.waitForTimeout(500);
}
expect(session?.status).toBe('completed');
await expect(page.getByRole('button', { name: /^Weiter$/ })).toBeEnabled();
await page.getByRole('button', { name: /^Weiter$/ }).last().click();
await expect(page.getByText(/Marketing-Dashboard/)).toBeVisible();
await expect(
page.getByRole('button', { name: /Zum Admin-Bereich|To Admin Area/i })
).toBeVisible();
expect(paddleRequestPayload).not.toBeNull();
expect(paddleRequestPayload?.['coupon_code']).toBe('PERCENT10');
const messages = await getTestMailbox();
expect(messages.length).toBeGreaterThan(0);
});
});
declare global {
interface Window {
__openedWindows?: unknown[];
__paddleEventCallback?: ((event: { name: string }) => void) | null;
__paddleInitOptions?: unknown;
__paddleCheckoutConfig?: unknown;
}
}

View File

@@ -0,0 +1,49 @@
import { test, expectFixture as expect } from '../helpers/test-fixtures';
test.describe('Standard package checkout with coupons', () => {
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');
const detailsButtons = page.getByRole('button', {
name: /Details ansehen|Details anzeigen|View details/i,
});
await expect(detailsButtons.first()).toBeVisible();
await detailsButtons.nth(1).click();
const dialog = page.getByRole('dialog');
await expect(dialog).toBeVisible();
await expect(dialog.getByRole('heading', { name: /Standard/i })).toBeVisible();
await dialog.getByRole('link', { name: /Jetzt bestellen|Order now|Jetzt buchen/i }).click();
await expect(page).toHaveURL(/\/purchase-wizard\/\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 page.getByRole('button', { name: /^Anmelden$/ }).last().click();
await expect(page.getByPlaceholder(/Gutscheincode/i)).toBeVisible();
await page.getByPlaceholder(/Gutscheincode/i).fill('PERCENT10');
await page.getByRole('button', { name: /Gutschein anwenden|Apply coupon/i }).click();
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();
});
});