Files
kokken/debug-calendar.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

41 lines
1.5 KiB
TypeScript

import { test } from '@playwright/test';
test('Debug calendar DOM structure', async ({ page }) => {
// Set basic auth header
await page.setExtraHTTPHeaders({
'Authorization': 'Basic ' + Buffer.from('brotha:makefood1').toString('base64')
});
await page.goto('http://localhost:3000/admin/availability');
await page.waitForSelector('.cook-calendar');
// Log all classes i kalenderen
const calendarHTML = await page.locator('.cook-calendar').innerHTML();
console.log('Calendar HTML structure:');
console.log(calendarHTML.slice(0, 1000) + '...');
// Find alle elements med rdp classes
const rdpElements = await page.locator('[class*="rdp"]').all();
console.log(`Found ${rdpElements.length} elements with rdp classes`);
for (let i = 0; i < Math.min(10, rdpElements.length); i++) {
const className = await rdpElements[i].getAttribute('class');
const tagName = await rdpElements[i].evaluate(el => el.tagName);
console.log(`${i}: ${tagName}.${className}`);
}
// Tjek computed styles på nogle elements
const dayElements = await page.locator('.cook-calendar [class*="day"]').all();
console.log(`Found ${dayElements.length} day elements`);
if (dayElements.length > 0) {
const firstDayStyle = await dayElements[0].evaluate((el) => {
const computed = window.getComputedStyle(el);
return {
backgroundColor: computed.backgroundColor,
className: el.className
};
});
console.log('First day style:', firstDayStyle);
}
});