developing-with-turbo-tests
Basics of testing out Turbo-specific aspects of web applications. Activate when working on projects that utilize Turbo for testing specific Turbo Frames, Turbo Streams, or Turbo Native behavior.
Install
mkdir -p .claude/skills/developing-with-turbo-tests && curl -L -o skill.zip "https://mcp.directory/api/skills/download/5539" && unzip -o skill.zip -d .claude/skills/developing-with-turbo-tests && rm skill.zipInstalls to .claude/skills/developing-with-turbo-tests
About this skill
Testing Turbo Laravel
Turbo Laravel provides the InteractsWithTurbo trait and several test response macros for asserting Turbo-specific behavior in feature tests.
Setup
Add the InteractsWithTurbo trait to your test class (or base TestCase):
@verbatim
<code-snippet name="Setup" lang="php"> use HotwiredLaravel\TurboLaravel\Testing\InteractsWithTurbo;class PostTest extends TestCase { use InteractsWithTurbo; } </code-snippet>
@endverbatim
Note: The turbo-laravel.queue config is automatically set to false during testing so broadcasts are processed synchronously.
Simulating Turbo Requests
Turbo Stream Visits
Use $this->turbo() to simulate a request that accepts Turbo Stream responses (sets the appropriate Accept header):
@verbatim
<code-snippet name="Turbo visits" lang="php"> $this->turbo()->post(route('posts.store'), ['title' => 'Test']) ->assertTurboStream();$this->turbo()->put(route('posts.update', $post), ['title' => 'Updated']) ->assertTurboStream();
$this->turbo()->delete(route('posts.destroy', $post)) ->assertTurboStream(); </code-snippet>
@endverbatim
Turbo Frame Requests
Use $this->fromTurboFrame() to simulate a request from a specific Turbo Frame (sets the Turbo-Frame header):
@verbatim
<code-snippet name="Frame requests" lang="php"> $this->fromTurboFrame(dom_id($post)) ->get(route('posts.edit', $post)) ->assertSee('<turbo-frame id="' . dom_id($post) . '">', false);$this->fromTurboFrame(dom_id($post, 'create_comment')) ->post(route('posts.comments.store', $post), ['content' => 'Hello']) ->assertOk(); </code-snippet>
@endverbatim
Hotwire Native Requests
Use $this->hotwireNative() to simulate a request from a Hotwire Native mobile client:
@verbatim
<code-snippet name="Hotwire Native" lang="php"> $this->hotwireNative()->post(route('comments.store'), ['content' => 'Hello']) ->assertRedirectRecede(['status' => __('Comment created.')]); </code-snippet>@endverbatim
Asserting Turbo Stream Responses
assertTurboStream()
Assert the response is a Turbo Stream. Optionally pass a callback to inspect individual streams:
@verbatim
<code-snippet name="assertTurboStream" lang="php"> // Simple assertion that the response is a Turbo Stream $this->turbo()->post(route('posts.store'), ['title' => 'Test']) ->assertTurboStream();// With callback for detailed assertions $this->turbo()->post(route('posts.store'), ['title' => 'Test']) ->assertTurboStream(fn ($streams) => $streams ->has(2) // Assert exactly 2 stream elements ->hasTurboStream(fn ($s) => $s ->where('target', 'posts') ->where('action', 'append') ->see('Test') ) ->hasTurboStream(fn ($s) => $s ->where('target', 'post_count') ->where('action', 'update') ) ); </code-snippet>
@endverbatim
assertNotTurboStream()
Assert the response is NOT a Turbo Stream:
@verbatim
<code-snippet name="assertNotTurboStream" lang="php"> $this->get(route('posts.index')) ->assertNotTurboStream(); </code-snippet>@endverbatim
Asserting Hotwire Native Redirects
For Hotwire Native clients, assert specific redirect path behaviors with optional flash data:
@verbatim
<code-snippet name="Native redirects" lang="php"> // Assert a "recede" redirect (go back in the native navigation stack) $this->hotwireNative()->post(route('comments.store'), ['content' => 'Hello']) ->assertRedirectRecede(['status' => __('Comment created.')]);// Assert a "resume" redirect (stay on the current screen) $this->hotwireNative()->put(route('settings.update'), ['name' => 'New']) ->assertRedirectResume(['status' => __('Settings updated.')]);
// Assert a "refresh" redirect (reload the current screen) $this->hotwireNative()->post(route('posts.store'), ['title' => 'Test']) ->assertRedirectRefresh(['status' => __('Post created.')]); </code-snippet>
@endverbatim
Testing Broadcasts
Faking Broadcasts
Use TurboStream::fake() to capture broadcasts without actually sending them:
@verbatim
<code-snippet name="Fake broadcasts" lang="php"> use HotwiredLaravel\TurboLaravel\Facades\TurboStream;public function test_creating_post_broadcasts() { TurboStream::fake();
$post = Post::create(['title' => 'Test']);
TurboStream::assertBroadcasted(fn ($broadcast) =>
$broadcast->target === 'posts' && $broadcast->action === 'append'
);
} </code-snippet>
@endverbatim
assertNothingWasBroadcasted()
Assert no broadcasts were sent:
@verbatim
<code-snippet name="Nothing broadcasted" lang="php"> TurboStream::fake();// ... perform actions that should NOT broadcast ...
TurboStream::assertNothingWasBroadcasted(); </code-snippet>
@endverbatim
assertBroadcastedTimes()
Assert a broadcast matching a condition was sent a specific number of times:
@verbatim
<code-snippet name="Broadcast times" lang="php"> TurboStream::fake();Post::create(['title' => 'First']); Post::create(['title' => 'Second']);
TurboStream::assertBroadcastedTimes( fn ($broadcast) => $broadcast->action === 'append', times: 2, ); </code-snippet>
@endverbatim
More by hotwired-laravel
View all skills by hotwired-laravel →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversXcodeBuild streamlines iOS app development for Apple developers with tools for building, debugging, and deploying iOS an
Unlock browser automation studio with Browserbase MCP Server. Enhance Selenium software testing and AI-driven workflows
Use iOS Simulator for testing with tools like UI interaction and device info retrieval. Perfect as an iPhone emulator fo
DebuggAI enables zero-config end to end testing for web applications, offering secure tunnels, easy setup, and detailed
Electron Desktop Automation streamlines app testing with screenshots, console monitoring, project detection, and debuggi
WebDriverIO MCP Server enables Claude Desktop to automate browsers and iOS/Android apps with WebDriverIO — offering brow
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.