mirror of
https://github.com/hanzoai/shadcn.git
synced 2026-10-30 18:22:59 +00:00
- 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
80 lines
2.2 KiB
TypeScript
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!')
|
|
}
|
|
}) |