- 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.
55 lines
1.4 KiB
JavaScript
Executable File
55 lines
1.4 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
import dotenv from 'dotenv'
|
|
dotenv.config()
|
|
|
|
const BASE = process.env.TEST_BASE_URL || 'http://localhost:3000'
|
|
|
|
console.log('=== Frontend Smoke Test ===\n')
|
|
|
|
// Test all critical pages load without errors
|
|
const tests = [
|
|
{ name: 'Homepage', url: '/', expectText: 'Christian Warme' },
|
|
{ name: 'Menu Browse', url: '/menuer', expectText: 'Se menuer' },
|
|
{ name: 'Packages', url: '/pakker', expectText: 'Forespørg booking' },
|
|
{ name: 'Booking Form', url: '/book', expectText: 'Forespørg booking' },
|
|
{ name: 'Contact', url: '/kontakt', expectText: 'Kontakt' },
|
|
]
|
|
|
|
let passed = 0
|
|
let failed = 0
|
|
|
|
for (const test of tests) {
|
|
try {
|
|
const res = await fetch(`${BASE}${test.url}`)
|
|
if (!res.ok) {
|
|
console.log(`❌ ${test.name}: HTTP ${res.status}`)
|
|
failed++
|
|
continue
|
|
}
|
|
|
|
const html = await res.text()
|
|
|
|
// Check if expected text is in response
|
|
if (html.includes(test.expectText)) {
|
|
console.log(`✅ ${test.name}: OK`)
|
|
passed++
|
|
} else {
|
|
console.log(`⚠️ ${test.name}: Loaded but missing expected text "${test.expectText}"`)
|
|
failed++
|
|
}
|
|
} catch (err) {
|
|
console.log(`❌ ${test.name}: ${err.message}`)
|
|
failed++
|
|
}
|
|
}
|
|
|
|
console.log(`\n📊 Results: ${passed} passed, ${failed} failed`)
|
|
|
|
if (failed === 0) {
|
|
console.log('🎉 All smoke tests passed!')
|
|
process.exit(0)
|
|
} else {
|
|
console.log('❌ Some tests failed')
|
|
process.exit(1)
|
|
}
|