visualbuilder/filament-screenshot-catalogue
Capture every Filament v5 panel page as desktop/tablet/mobile screenshots in light & dark mode. Queue Playwright capture jobs, upload PNGs to S3, and publish a shareable HTML index for visual QA, design reviews, and regression workflows.
Install the Package
composer require --dev visualbuilder/filament-screenshot-catalogue
Register a Panel Descriptor
Add a service provider (e.g., ScreenshotCatalogueServiceProvider) to bootstrap/providers.php with a PanelDescriptor for your Filament panel:
PanelRegistry::register(new PanelDescriptor(
key: 'admin',
panelId: 'admin',
domain: env('ADMIN_DOMAIN'),
email: env('SCREENSHOT_ADMIN_EMAIL'),
password: env('SCREENSHOT_ADMIN_PASSWORD'),
authenticator: fn() => auth('web')->setUser(\App\Models\User::first()),
));
Set Up Dependencies Ensure Node.js 18+ and Playwright are installed:
npm install playwright && npx playwright install chromium
Configure S3 Disk
Add an S3 disk (e.g., s3_public) in config/filesystems.php and update config/screenshot-catalogue.php:
'disk' => 's3_public',
'path_prefix' => 'screenshots',
Generate Sitemap Discover all panel URLs:
php artisan panel:sitemap --panel=admin
Capture Screenshots Queue a job to capture all pages:
php artisan screenshot:dispatch --panel=admin --tag=latest
Access the Catalogue
The browsable index (index.html) will be uploaded to S3 at:
s3://{disk}/{prefix}/{env}/admin/latest/.
dashboard):
php artisan screenshot:capture --panel=admin --page=dashboard --tag=debug
index.html to inspect the screenshot at different viewports (desktop/tablet/mobile) and modes (light/dark).Continuous Visual QA
screenshot:dispatch in CI/CD (e.g., post-deploy) with a unique tag (e.g., tag=build-123).diff tools or AI like Claude) to catch regressions.Design Reviews
--tag=design-review to generate a versioned catalogue for stakeholders.index.html link (hosted via S3 static website) for feedback.Marketing Assets
capture_time_css to override animations (e.g., lock a hero section in place).AI-Driven Regression Testing
Compare these two screenshots of a Filament panel dashboard:
[screenshot-1.png] [screenshot-2.png]
Highlight any visual differences, including layout shifts, missing elements, or style changes.
Queue Workers
screenshot:dispatch in a queue worker (e.g., Redis) to avoid timeouts for large panels:
php artisan queue:work
Custom Viewports
config/screenshot-catalogue.php:
'viewports' => [
'desktop' => ['width' => 1920, 'height' => 1080],
'mobile' => ['width' => 414, 'height' => 896],
],
Exclude Pages
users.edit with variable data):
'excluded_slugs' => ['users.edit', 'settings.profile'],
Branding
php artisan vendor:publish --tag=filament-screenshot-catalogue-config
Then update config/screenshot-catalogue.php:
'brand' => [
'name' => 'MyApp Admin',
'logo' => public_path('logo.svg'),
],
Tenanted Panels
authenticator closure:
authenticator: fn() => Filament::setTenant(\App\Models\Tenant::find(1)),
Missing Dependencies
Class 'Visualbuilder\FilamentScreenshotCatalogue\PanelRegistry' not found.composer require --dev) and the provider is registered conditionally (wrap in class_exists for dev-only installs).Playwright Failures
Cannot find Chromium executable or TimeoutError.npx playwright install chromium firefox
--headful to debug:
php artisan screenshot:capture --panel=admin --page=dashboard --tag=debug --headful
Authentication Issues
authenticator closure sets the correct user/tenant.viewAny for all resources).S3 Upload Failures
config/filesystems.php and credentials are valid.CSS Injection Not Working
capture_time_css to force a stable state:
'capture_time_css' => '
.fi-topbar { transition: none !important; }
.dynamic-element { opacity: 0 !important; }
',
Log Sitemap Generation
storage/app/sitemap-admin.json to verify all expected pages are included. Exclude dynamic pages with excluded_slugs.Check Queue Jobs
php artisan queue:list
php artisan queue:work --once
Inspect Playwright Output
php artisan screenshot:capture --panel=admin --page=dashboard --tag=debug --headful
Validate S3 Structure
path_prefix and disk config. Example:
s3://my-bucket/screenshots/staging/admin/latest/dashboard/desktop-light.png
Custom Playwright Runner
php artisan vendor:publish --tag=filament-screenshot-catalogue-js
resources/js/runner.js to add custom Playwright logic (e.g., wait for specific elements).Post-Capture Hooks
RebuildScreenshotIndexJob to add metadata or transform PNGs:
// app/Providers/ScreenshotCatalogueServiceProvider.php
use Visualbuilder\FilamentScreenshotCatalogue\Jobs\RebuildScreenshotIndexJob;
RebuildScreenshotIndexJob::macro('addMetadata', function ($metadata) {
$this->metadata = $metadata;
});
Claude Integration
php artisan vendor:publish --tag=filament-screenshot-catalogue-claude-skills
.claude/commands/screenshot-catalogue.md):
Analyze the visual differences between these two screenshots of the Filament dashboard:
[screenshot-1.png] [screenshot-2.png]
Focus on layout, colors, and missing elements. Provide a bullet-point summary.
Dynamic Tagging
tag logic in app/Providers/ScreenshotCatalogueServiceProvider.php to use Git commit hashes:
PanelRegistry::register(new PanelDescriptor(
// ...
tag: fn() => exec('git rev-parse --short HEAD'),
));
How can I help you explore Laravel packages today?