laravel-dusk
Laravel Dusk - Browser automation and testing API for Laravel applications. Use when writing browser tests, automating UI testing, testing JavaScript interactions, or implementing end-to-end tests in Laravel.
What this skill does
# Laravel Dusk Skill
Comprehensive assistance with Laravel Dusk browser automation and testing, providing expert guidance on writing expressive, easy-to-use browser tests for your Laravel applications.
## When to Use This Skill
This skill should be triggered when:
- Writing or debugging browser automation tests for Laravel
- Testing user interfaces and JavaScript interactions
- Implementing end-to-end (E2E) testing workflows
- Setting up automated UI testing in Laravel applications
- Working with form submissions, authentication flows, or page navigation tests
- Configuring ChromeDriver or alternative browser drivers
- Using the Page Object pattern for test organization
- Testing Vue.js components or waiting for JavaScript events
- Troubleshooting browser test failures or timing issues
## Quick Reference
### 1. Basic Browser Test
```php
public function testBasicExample(): void
{
$this->browse(function (Browser $browser) {
$browser->visit('/login')
->type('email', '[email protected]')
->type('password', 'password')
->press('Login')
->assertPathIs('/home');
});
}
```
### 2. Using Dusk Selectors (Recommended)
```html
<!-- In your Blade template -->
<button dusk="login-button">Login</button>
<input dusk="email-input" name="email" />
```
```php
// In your test - use @ prefix for dusk selectors
$browser->type('@email-input', '[email protected]')
->click('@login-button');
```
### 3. Testing Multiple Browsers
```php
public function testMultiUserInteraction(): void
{
$this->browse(function (Browser $first, Browser $second) {
$first->loginAs(User::find(1))
->visit('/home');
$second->loginAs(User::find(2))
->visit('/home');
});
}
```
### 4. Waiting for Elements
```php
// Wait for element to appear
$browser->waitFor('.modal')
->assertSee('Confirmation Required');
// Wait for text to appear
$browser->waitForText('Hello World');
// Wait for JavaScript condition
$browser->waitUntil('App.data.servers.length > 0');
// Wait when element is available
$browser->whenAvailable('.modal', function (Browser $modal) {
$modal->assertSee('Delete Account')
->press('OK');
});
```
### 5. Form Interactions
```php
// Text input
$browser->type('email', '[email protected]')
->append('notes', 'Additional text')
->clear('description');
// Dropdown selection
$browser->select('size', 'Large')
->select('categories', ['Art', 'Music']); // Multiple
// Checkboxes and radio buttons
$browser->check('terms')
->radio('gender', 'male');
// File upload
$browser->attach('photo', __DIR__.'/photos/profile.jpg');
```
### 6. Page Object Pattern
```php
// Generate page object
// php artisan dusk:page Login
// app/tests/Browser/Pages/Login.php
class Login extends Page
{
public function url(): string
{
return '/login';
}
public function elements(): array
{
return [
'@email' => 'input[name=email]',
'@password' => 'input[name=password]',
'@submit' => 'button[type=submit]',
];
}
public function login(Browser $browser, $email, $password): void
{
$browser->type('@email', $email)
->type('@password', $password)
->press('@submit');
}
}
// Use in test
$browser->visit(new Login)
->login('[email protected]', 'password')
->assertPathIs('/dashboard');
```
### 7. Browser Macros (Reusable Methods)
```php
// In AppServiceProvider or DuskServiceProvider
use Laravel\Dusk\Browser;
Browser::macro('scrollToElement', function (string $element) {
$this->script("$('html, body').animate({
scrollTop: $('{$element}').offset().top
}, 0);");
return $this;
});
// Use in tests
$browser->scrollToElement('#footer')
->assertSee('Copyright 2024');
```
### 8. Database Management in Tests
```php
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTruncation;
class ExampleTest extends DuskTestCase
{
// Option 1: Run migrations before each test (slower)
use DatabaseMigrations;
// Option 2: Truncate tables after first migration (faster)
use DatabaseTruncation;
// Exclude specific tables from truncation
protected $exceptTables = ['migrations'];
}
```
### 9. JavaScript Execution
```php
// Execute JavaScript
$browser->script('document.documentElement.scrollTop = 0');
// Get JavaScript return value
$path = $browser->script('return window.location.pathname');
// Wait for reload after action
$browser->waitForReload(function (Browser $browser) {
$browser->press('Submit');
})->assertSee('Success');
```
### 10. Common Assertions
```php
// Page assertions
$browser->assertPathIs('/dashboard')
->assertRouteIs('dashboard')
->assertTitle('Dashboard')
->assertSee('Welcome Back')
->assertDontSee('Error');
// Form assertions
$browser->assertInputValue('email', '[email protected]')
->assertChecked('remember')
->assertSelected('role', 'admin')
->assertEnabled('submit-button');
// Element assertions
$browser->assertVisible('.success-message')
->assertMissing('.error-alert')
->assertPresent('button[type=submit]');
// Authentication assertions
$browser->assertAuthenticated()
->assertAuthenticatedAs($user);
```
## Key Concepts
### Dusk Selectors vs CSS Selectors
**Dusk selectors** (recommended) use HTML `dusk` attributes that won't change with UI updates:
- More stable than CSS classes or IDs
- Explicitly mark elements for testing
- Use `@` prefix in tests: `$browser->click('@submit-button')`
- Add to HTML: `<button dusk="submit-button">Submit</button>`
**CSS selectors** are more brittle but sometimes necessary:
- `.class-name`, `#id`, `div > button`
- Can break when HTML structure changes
- Use when you don't control the HTML
### Waiting Strategies
**Always wait explicitly** rather than using arbitrary pauses:
- `waitFor('.selector')` - Wait for element to exist
- `waitUntilMissing('.selector')` - Wait for element to disappear
- `waitForText('text')` - Wait for text to appear
- `waitUntil('condition')` - Wait for JavaScript condition
- `whenAvailable('.selector', callback)` - Run callback when available
### Page Objects
Organize complex test logic into **Page classes**:
- Define URL, assertions, and element selectors
- Create reusable methods for page-specific actions
- Improve test readability and maintainability
- Generate with: `php artisan dusk:page PageName`
### Browser Macros
Define **reusable browser methods** for common patterns:
- Register in service provider's `boot()` method
- Use across all tests
- Chain like built-in methods
- Example: scrolling, modal interactions, custom assertions
## Reference Files
This skill includes comprehensive documentation in `references/`:
- **other.md** - Complete Laravel Dusk documentation covering:
- Installation and configuration
- ChromeDriver management
- Test generation and execution
- Browser interaction methods
- Form handling and file uploads
- Waiting strategies and assertions
- Page Objects and Components patterns
- CI/CD integration examples
Use the reference file when you need:
- Detailed API documentation for specific methods
- Complete list of available assertions (70+)
- Configuration options for different environments
- Advanced topics like iframes, JavaScript dialogs, or keyboard macros
## Working with This Skill
### For Beginners
1. **Start with basic tests**: Use simple `visit()`, `type()`, `press()`, and `assertSee()` methods
2. **Use Dusk selectors**: Add `dusk` attributes to your HTML for stable selectors
3. **Learn waiting**: Always use `waitFor()` instead of `pause()` for reliable tests
4. **Run tests**: Execute with `php artisan dusk` to see results
### For Intermediate Users
1. **Implement Page Objects**: Organize complex tests with the Page pattern
2. **Use database traits**: Choose between `DatabaseMigratioRelated in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.