mirror of
https://github.com/hanzoai/shadcn.git
synced 2026-10-30 18:22:59 +00:00
Fixed icon stretching in block viewer by adding !important modifiers to all icon size classes. This overrides the ToggleGroup wildcard selector that was causing icons (Monitor, Tablet, Smartphone, Fullscreen, RotateCw, Check, Terminal) to appear distorted. Changes: - Updated all icon className from "h-3.5 w-3.5" to "!h-3.5 !w-3.5" - Added Playwright test screenshots to verify proper rendering - All 5 block previews now load correctly with properly sized icons
63 lines
2.2 KiB
TypeScript
63 lines
2.2 KiB
TypeScript
import { test } from '@playwright/test'
|
|
|
|
test('Capture blocks page with loading previews', async ({ page }) => {
|
|
console.log('šø Capturing blocks page with loaded previews...\n')
|
|
|
|
// Set viewport to desktop size
|
|
await page.setViewportSize({ width: 1920, height: 1080 })
|
|
|
|
// Navigate to blocks page
|
|
await page.goto('http://localhost:3333/blocks', {
|
|
waitUntil: 'domcontentloaded'
|
|
})
|
|
|
|
// Wait for iframes to be present
|
|
await page.waitForSelector('iframe', { timeout: 10000 })
|
|
console.log('ā
Iframes detected')
|
|
|
|
// Wait a bit for content to load
|
|
await page.waitForTimeout(4000)
|
|
console.log('ā
Waiting for content to load...')
|
|
|
|
// Take full page screenshot
|
|
await page.screenshot({
|
|
path: 'tests/blocks-with-previews-FULL.png',
|
|
fullPage: true
|
|
})
|
|
console.log('šø Full page screenshot saved: blocks-with-previews-FULL.png')
|
|
|
|
// Take viewport screenshot (what you see without scrolling)
|
|
await page.screenshot({
|
|
path: 'tests/blocks-with-previews-VIEWPORT.png',
|
|
fullPage: false
|
|
})
|
|
console.log('šø Viewport screenshot saved: blocks-with-previews-VIEWPORT.png')
|
|
|
|
// Scroll to middle and capture
|
|
await page.evaluate(() => window.scrollTo(0, 800))
|
|
await page.waitForTimeout(1000)
|
|
await page.screenshot({
|
|
path: 'tests/blocks-with-previews-MIDDLE.png',
|
|
fullPage: false
|
|
})
|
|
console.log('šø Middle section screenshot saved: blocks-with-previews-MIDDLE.png')
|
|
|
|
// Scroll to bottom
|
|
await page.evaluate(() => window.scrollTo(0, document.body.scrollHeight))
|
|
await page.waitForTimeout(1000)
|
|
await page.screenshot({
|
|
path: 'tests/blocks-with-previews-BOTTOM.png',
|
|
fullPage: false
|
|
})
|
|
console.log('šø Bottom section screenshot saved: blocks-with-previews-BOTTOM.png')
|
|
|
|
// Get count of loaded iframes
|
|
const iframes = await page.locator('iframe').all()
|
|
console.log(`\nā
${iframes.length} block previews captured`)
|
|
|
|
console.log('\nš Screenshots saved in tests/ directory:')
|
|
console.log(' ⢠blocks-with-previews-FULL.png (complete page)')
|
|
console.log(' ⢠blocks-with-previews-VIEWPORT.png (above the fold)')
|
|
console.log(' ⢠blocks-with-previews-MIDDLE.png (middle section)')
|
|
console.log(' ⢠blocks-with-previews-BOTTOM.png (bottom section)')
|
|
}) |