Files
shadcn/tests/capture-blocks-loading.spec.ts
zeekay 9f8c72e27f fix: Icon sizing in block viewer toggle buttons
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
2025-11-15 22:58:58 -08:00

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)')
})