Initial commit
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test('page loads without critical errors', async ({ page }) => {
|
||||
const errors: string[] = [];
|
||||
page.on('console', msg => {
|
||||
if (msg.type() === 'error') {
|
||||
errors.push(msg.text());
|
||||
}
|
||||
});
|
||||
|
||||
await page.goto('http://localhost:5173/');
|
||||
await expect(page).toHaveTitle('Baby Sleep Tracker');
|
||||
|
||||
const awakeBanner = page.locator('text=Baby is awake');
|
||||
const sleepingBanner = page.locator('text=Baby is sleeping');
|
||||
const bannerVisible = await awakeBanner.or(sleepingBanner).isVisible();
|
||||
expect(bannerVisible).toBe(true);
|
||||
|
||||
if (errors.length > 0) {
|
||||
console.log('Console errors:', errors);
|
||||
}
|
||||
expect(errors.length).toBe(0);
|
||||
});
|
||||
Reference in New Issue
Block a user