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

42 lines
1.6 KiB
TypeScript

import { test } from '@playwright/test';
test('Visual test - take screenshot and compare with expected layout', 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');
await page.waitForTimeout(2000);
// Get the actual table structure
const tableRows = await page.locator('.cook-calendar tbody tr').all();
console.log('=== ACTUAL CALENDAR LAYOUT ===');
for (let i = 0; i < tableRows.length; i++) {
const cells = await tableRows[i].locator('td button').allTextContents();
console.log(`Row ${i + 1}: ${cells.join(' ')}`);
}
// Get headers
const headers = await page.locator('.cook-calendar thead th').allTextContents();
console.log('Headers:', headers.join(' '));
// What we expect for November 2025:
// November 1, 2025 is Saturday, so in week starting Monday:
// ma ti on to fr lö sö
// Should be: 27 28 29 30 31 1 2
const firstRow = await tableRows[0].locator('td button').allTextContents();
console.log('\nFirst row actual:', firstRow);
console.log('First row expected: [27, 28, 29, 30, 31, 1, 2] (1 should be in 6th position - Saturday)');
if (firstRow[5] === '1') {
console.log('✅ November 1st is correctly in position 6 (Saturday)');
} else {
console.log(`❌ November 1st is in wrong position. Found "${firstRow[5]}" in position 6`);
console.log('Position of "1":', firstRow.indexOf('1'));
}
});