Files
moyosapp_beta.0.0.3.3_beta/e2e/guestbook-flow.spec.ts
2026-01-16 19:04:48 +02:00

65 lines
2.3 KiB
TypeScript

/**
* E2E Test: Guestbook Entry Flow
* Priority: HIGH - Critical user engagement feature
*
* Tests the complete guestbook journey:
* 1. Navigate to guestbook
* 2. Write a message
* 3. Submit entry
* 4. View entry in feed
* 5. View scrolling testimonials
*/
import { test, expect, type Page } from '@playwright/test';
test.describe('Guestbook Flow', () => {
test.beforeEach(async ({ page }: { page: Page }) => {
// Authenticate as guest first
await page.goto('http://localhost:3000');
await page.fill('input[placeholder*="invite"]', 'TEST123');
await page.click('button[type="submit"]');
await page.waitForURL(/.*dashboard.*/, { timeout: 5000 });
});
test('complete guestbook entry journey', async ({ page }: { page: Page }) => {
// Step 1: Navigate to guestbook
await page.click('text=Guestbook');
await expect(page).toHaveURL(/.*guestbook.*/);
// Step 2: Write a message
const messageInput = page.getByPlaceholder(/message/i);
await messageInput.fill('Congratulations on your special day! Wishing you both a lifetime of happiness.');
// Step 3: Submit entry
await page.click('button[type="submit"]');
await expect(page.locator('text=Entry submitted')).toBeVisible({ timeout: 5000 });
// Step 4: View entry in feed
await expect(page.locator('text=Congratulations on your special day')).toBeVisible({ timeout: 5000 });
// Step 5: Verify entry appears in scrolling testimonials
await expect(page.locator('text=Wishing you both')).toBeVisible({ timeout: 5000 });
});
test('validates message length', async ({ page }: { page: Page }) => {
await page.click('text=Guestbook');
const messageInput = page.getByPlaceholder(/message/i);
const longMessage = 'a'.repeat(1001);
await messageInput.fill(longMessage);
await page.click('button[type="submit"]');
await expect(page.locator('text=too long')).toBeVisible({ timeout: 3000 });
});
test('requires minimum message length', async ({ page }: { page: Page }) => {
await page.click('text=Guestbook');
const messageInput = page.getByPlaceholder(/message/i);
await messageInput.fill('Hi');
await page.click('button[type="submit"]');
await expect(page.locator('text=too short')).toBeVisible({ timeout: 3000 });
});
});