Files
shadcn/tests/quick-blocks-verification.spec.ts
zeekay 545320fbc0 fix: Update header nav to Builder and fix block iframe 404 errors
- Changed header navigation from Blocks to Builder
- Fixed block preview iframe URLs from /view/default/[name] to /view/[name]
- Fixed icon stretching in block viewer toggle buttons
- Added comprehensive Playwright tests to verify functionality
- Removed empty malformed directory blocks/[.../

Fixes:
- Block previews now load correctly (no 404 errors)
- All 5 blocks verified working: dashboard-01, sidebar-07, sidebar-03, login-03, login-04
- Icons properly sized (h-3.5 w-3.5) in toggle buttons
- Builder link now in header, Blocks remains in sidebar

Test Results:
āœ… 5/5 iframes loading correctly
āœ… 0 404 errors
āœ… All blocks verified with Playwright
āœ… Screenshots captured for visual proof
2025-11-15 22:48:48 -08:00

80 lines
2.2 KiB
TypeScript

import { test, expect } from '@playwright/test'
test('Quick blocks page verification', async ({ page }) => {
console.log('\nšŸš€ QUICK BLOCKS VERIFICATION TEST')
console.log('='.repeat(50))
// Track 404 errors
const errors404: string[] = []
const successfulIframes: string[] = []
page.on('response', response => {
const url = response.url()
if (url.includes('/view/')) {
if (response.status() === 404) {
errors404.push(url)
} else if (response.status() === 200) {
successfulIframes.push(url)
}
}
})
// Navigate with shorter timeout
console.log('\nšŸ“ Loading blocks page...')
await page.goto('http://localhost:3333/blocks', {
waitUntil: 'domcontentloaded',
timeout: 15000
})
console.log('āœ… Page loaded')
// Wait for iframes
await page.waitForSelector('iframe', { timeout: 5000 })
// Get iframe count
const iframes = await page.locator('iframe').all()
console.log(`\nšŸ–¼ļø Found ${iframes.length} iframes`)
// Check iframe sources
console.log('\nšŸ“‹ Iframe sources:')
for (const [i, iframe] of iframes.entries()) {
const src = await iframe.getAttribute('src')
console.log(` ${i + 1}. ${src}`)
// Verify correct format
expect(src).toMatch(/^\/view\/[a-z0-9-]+$/)
expect(src).not.toContain('/default/')
}
// Wait for content to load
await page.waitForTimeout(3000)
// Take screenshot
await page.screenshot({
path: 'tests/quick-verification.png',
fullPage: false
})
// Results
console.log('\n' + '='.repeat(50))
console.log('šŸ“Š RESULTS:')
console.log('='.repeat(50))
console.log(`āœ… Iframes found: ${iframes.length}`)
console.log(`āœ… Successful loads: ${successfulIframes.length}`)
console.log(`${errors404.length === 0 ? 'āœ…' : 'āŒ'} 404 errors: ${errors404.length}`)
if (errors404.length > 0) {
console.log('\nāŒ Failed URLs:')
errors404.forEach(url => console.log(` - ${url}`))
}
console.log('\nšŸ“ø Screenshot: tests/quick-verification.png')
console.log('='.repeat(50))
// Assertions
expect(iframes.length).toBeGreaterThanOrEqual(5)
expect(errors404.length).toBe(0)
if (errors404.length === 0 && iframes.length >= 5) {
console.log('\nšŸŽ‰ SUCCESS! All blocks loading correctly!')
}
})