Set up Playwright with dual-project config (API + Web), auth test fixtures, 16 E2E tests covering registration, login, profile, token refresh, and homepage rendering. Added GitHub Actions CI workflow for automated E2E runs. Co-Authored-By: Paperclip <noreply@paperclip.ing>
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
test.describe('Homepage', () => {
|
|
test('loads and displays platform title', async ({ page }) => {
|
|
await page.goto('/');
|
|
|
|
await expect(page.locator('h1')).toContainText('GoodGo Platform');
|
|
await expect(page.locator('p')).toContainText('Vietnam Real Estate Platform');
|
|
});
|
|
|
|
test('has correct page title', async ({ page }) => {
|
|
await page.goto('/');
|
|
|
|
await expect(page).toHaveTitle(/GoodGo/i);
|
|
});
|
|
|
|
test('renders without console errors', async ({ page }) => {
|
|
const errors: string[] = [];
|
|
page.on('console', (msg) => {
|
|
if (msg.type() === 'error') errors.push(msg.text());
|
|
});
|
|
|
|
await page.goto('/');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
expect(errors).toHaveLength(0);
|
|
});
|
|
|
|
test('is responsive — mobile viewport', async ({ page }) => {
|
|
await page.setViewportSize({ width: 375, height: 667 });
|
|
await page.goto('/');
|
|
|
|
const main = page.locator('main');
|
|
await expect(main).toBeVisible();
|
|
|
|
const h1 = page.locator('h1');
|
|
await expect(h1).toBeVisible();
|
|
});
|
|
});
|