Files
kokken/tests/force-refresh-test.spec.ts
Alex Polo 570c41f465 Add comprehensive Playwright tests for calendar functionality
- Implemented tests for debugging browser cache vs server response.
- Verified calendar displays correct dates for November 2025.
- Added visual inspection screenshot for calendar layout.
- Created tests to ensure calendar fits within its container.
- Checked for correct styling of available and blocked dates.
- Debugged login form behavior and cookie handling.
- Added tests for forced browser refresh and cache verification.
- Conducted visual tests to compare actual calendar layout with expected.
- Enhanced logging for better traceability during test execution.
2025-11-07 14:09:22 +01:00

40 lines
1.3 KiB
TypeScript

import { test } from '@playwright/test';
test('Force browser refresh and check cache', async ({ page }) => {
// Set basic auth header
await page.setExtraHTTPHeaders({
'Authorization': 'Basic ' + Buffer.from('brotha:makefood1').toString('base64')
});
// Force hard reload
await page.goto('http://localhost:3000/admin/availability', {
waitUntil: 'networkidle'
});
// Bypass cache
await page.reload({ waitUntil: 'networkidle' });
await page.waitForSelector('.cook-calendar');
await page.waitForTimeout(3000);
// Take screenshot
await page.screenshot({ path: 'current-calendar.png', fullPage: true });
// Check if there are any console errors
const logs = [];
page.on('console', msg => {
logs.push(`${msg.type()}: ${msg.text()}`);
});
// Reload one more time and check
await page.reload({ waitUntil: 'networkidle' });
await page.waitForTimeout(2000);
const tableHTML = await page.locator('.cook-calendar table').innerHTML();
console.log('Table HTML (first 500 chars):');
console.log(tableHTML.substring(0, 500) + '...');
// Check actual layout one more time
const firstRowCells = await page.locator('.cook-calendar tbody tr:first-child td button').allTextContents();
console.log('After hard refresh - First row:', firstRowCells);
});