Files
tilbudgivern/tests/api-roof-types.spec.js
alexpolo1 78595bbf6f feat: Complete SVG validation and enhancements for all roof types
- Added comprehensive SVG validation and fixes in EnhancedGeometry.js
- Created SVG_VALIDATION_COMPLETE.md to document validation results and improvements
- Developed a quick test guide for all 7 roof types in TEST_ROOF_TYPES_QUICK.md
- Summarized test results in TEST_SUMMARY.md, highlighting core functionality and API status
- Implemented Playwright tests for roof types API and UI interactions, ensuring all roof types are selectable and functional
- Enhanced error handling and accessibility features across the application
- Verified successful integration of SVG rendering with React components
2025-12-23 01:37:04 +00:00

56 lines
1.6 KiB
JavaScript

// @ts-check
const { test, expect } = require('@playwright/test');
const BASE_URL = 'https://tilbudsgiveren.alw.dk';
test('Verify /api/enhanced/roof-types returns all 7 roof types', async ({ request }) => {
console.log('\n🔍 Testing Roof Types API...\n');
const response = await request.get(`${BASE_URL}/api/enhanced/roof-types`);
expect(response.status()).toBe(200);
const data = await response.json();
console.log('API Response:', JSON.stringify(data, null, 2));
expect(data.success).toBe(true);
expect(data.roofTypes).toBeDefined();
expect(Array.isArray(data.roofTypes)).toBeTruthy();
// Verify we have all 7 roof types
expect(data.roofTypes.length).toBeGreaterThanOrEqual(7);
const expectedTypes = [
'sadeltag',
'valmtag',
'koebenhavnertag',
'fladt_tag',
'pulttag',
'tag_med_kviste',
'mansard'
];
console.log('\n📋 Checking for each roof type:\n');
let found = 0;
for (const expectedType of expectedTypes) {
const roofType = data.roofTypes.find(rt =>
rt.value === expectedType ||
rt.value.includes(expectedType) ||
rt.label.toLowerCase().includes(expectedType.replace('_', ' '))
);
if (roofType) {
found++;
console.log(`${roofType.label} (${roofType.value})`);
console.log(` Complexity: ${roofType.complexity}, Pitch: ${roofType.recommendedPitch}`);
} else {
console.log(` ⚠️ ${expectedType} - Not found`);
}
}
console.log(`\n📊 Total roof types available: ${data.roofTypes.length}`);
console.log(`📊 Expected types found: ${found}/7\n`);
expect(found).toBeGreaterThanOrEqual(7);
});