Files
kokken/cache-debug-test.spec.ts
Alex Polo cbc1e31440 feat: Add address column and booking extras to bookings table
- Implemented a script to add an 'address' column to the 'bookings' table if it doesn't exist.
- Created a script to add 'include_service', 'include_cleanup', and 'total_price' columns to the 'bookings' table.
- Set up a 'users' table with an admin user and password hashing using bcrypt.
- Developed login and logout API routes with JWT authentication.
- Created a login page with form handling and error display.
- Designed a profile page for Christian Wärme showcasing skills and experience.
- Added a logout button component for admin interface.
- Implemented tests for login functionality and visual calendar layout.
2025-11-07 10:58:19 +01:00

54 lines
2.0 KiB
TypeScript

import { test } from '@playwright/test';
test('Debug browser cache vs server response', async ({ page }) => {
// Completely clear cache and storage
await page.context().clearCookies();
// Set basic auth header
await page.setExtraHTTPHeaders({
'Authorization': 'Basic ' + Buffer.from('brotha:makefood1').toString('base64'),
'Cache-Control': 'no-cache, no-store, must-revalidate',
'Pragma': 'no-cache',
'Expires': '0'
});
console.log('1. Going to page with cache disabled...');
await page.goto('http://localhost:3000/admin/availability', {
waitUntil: 'networkidle'
});
await page.waitForSelector('.cook-calendar', { timeout: 10000 });
await page.waitForTimeout(3000);
// Check what we get immediately
const headers1 = await page.locator('.cook-calendar thead th').allTextContents();
const firstRow1 = await page.locator('.cook-calendar tbody tr:first-child td button').allTextContents();
console.log('2. Initial load:');
console.log(' Headers:', headers1.join(' '));
console.log(' First row:', firstRow1.join(' '));
// Force another reload with cache busting
console.log('3. Hard reload...');
await page.reload({ waitUntil: 'networkidle' });
await page.waitForTimeout(2000);
const headers2 = await page.locator('.cook-calendar thead th').allTextContents();
const firstRow2 = await page.locator('.cook-calendar tbody tr:first-child td button').allTextContents();
console.log('4. After reload:');
console.log(' Headers:', headers2.join(' '));
console.log(' First row:', firstRow2.join(' '));
// Check if there's a difference between SSR and client hydration
const pageSource = await page.content();
if (pageSource.includes('27</button></td><td class="rdp-cell"')) {
console.log('5. Server-side rendered content found in HTML');
} else {
console.log('5. Content appears to be client-side only');
}
// Take final screenshot
await page.screenshot({ path: 'final-calendar-debug.png' });
console.log('6. Screenshot saved as final-calendar-debug.png');
});