added various tests for playwright
This commit is contained in:
44
tests/ui/purchase/marketing-smoke.test.ts
Normal file
44
tests/ui/purchase/marketing-smoke.test.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test.describe('Marketing frontend smoke', () => {
|
||||
test('landing renders without console errors and CTA leads to packages', async ({ page }) => {
|
||||
const consoleErrors: string[] = [];
|
||||
page.on('console', (msg) => {
|
||||
if (msg.type() === 'error') {
|
||||
consoleErrors.push(msg.text());
|
||||
}
|
||||
});
|
||||
|
||||
const response = await page.goto('/');
|
||||
expect(response?.ok()).toBeTruthy();
|
||||
|
||||
const acceptCookies = page.getByRole('button', { name: /akzeptieren|accept/i });
|
||||
if (await acceptCookies.isVisible()) {
|
||||
await acceptCookies.click();
|
||||
}
|
||||
|
||||
await expect(page.getByRole('heading', { level: 1, name: /Dein Event|Fotospiel/i })).toBeVisible();
|
||||
const heroCta = page.getByRole('link', { name: /paket|packages|starten|ausprobieren/i }).first();
|
||||
await expect(heroCta).toBeVisible();
|
||||
|
||||
await heroCta.click();
|
||||
await expect(page).toHaveURL(/\/packages/);
|
||||
|
||||
await expect(page.getByRole('heading', { level: 1 })).toBeVisible();
|
||||
|
||||
expect(consoleErrors).toEqual([]);
|
||||
});
|
||||
|
||||
test('packages page lists packages and register CTAs', async ({ page }) => {
|
||||
const response = await page.goto('/packages');
|
||||
expect(response?.ok()).toBeTruthy();
|
||||
|
||||
const acceptCookies = page.getByRole('button', { name: /akzeptieren|accept/i });
|
||||
if (await acceptCookies.isVisible()) {
|
||||
await acceptCookies.click();
|
||||
}
|
||||
|
||||
const packageCards = page.locator('section >> text=/Starter|Standard|Premium/');
|
||||
await expect(packageCards.first()).toBeVisible();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user