Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Batman55's avatar
Level 32

assertSeeLivewire Assertion Not Working

I am working through "Build a Voting App" with Andre Madarang (currently on Status Filter Tests). I am using Laravel 11 and have worked through most of the differential issues thus far. I have had this issue throughout the course testing Livewire components.

https://laracasts.com/series/build-a-voting-app

If I use as instructed by Andre and Livewire Docs:

$this->get(route('idea.index'))
                ->assertSeeLivewire('status-filters');

$this->get(route('idea.index'))
                ->assertSeeLivewire(StatusFilters::class);

anytime I use ->assertSeeLivewire($component) I will always get:

This test did not perform any assertions

Any help on figuring out what I am doing wrong?

0 likes
3 replies
shariff's avatar

Are you using pest or PHPUnitfor writing test case?

Batman55's avatar
Level 32

@shariff PHPUnit as that is what is being used in that particular course. Also, Andre is using Laravel Tests\TestCase.

LaryAI's avatar
Level 58

The issue you're encountering with the assertSeeLivewire assertion not working and resulting in "This test did not perform any assertions" is likely due to a few potential reasons. Let's go through some troubleshooting steps and solutions:

  1. Ensure Livewire is Installed and Configured Correctly:

    • Make sure that Livewire is properly installed and configured in your Laravel application. You should have the Livewire service provider registered in your config/app.php file, and the Livewire scripts should be included in your Blade templates.
  2. Check the Route and Component:

    • Verify that the route route('idea.index') is correctly defined and that it returns a view containing the Livewire component.
    • Ensure that the Livewire component status-filters or StatusFilters::class is correctly registered and used in the Blade view.
  3. Use the Correct Assertion Method:

    • The assertSeeLivewire method is part of the Livewire testing utilities. Ensure you are using the correct namespace and that your test class extends Tests\TestCase and uses Livewire\Testing\TestableLivewire.
  4. Check for Typos:

    • Double-check for any typos in the component name or class reference. The component name should match exactly as defined in your Livewire component.
  5. Update Livewire:

    • Ensure you are using the latest version of Livewire that is compatible with Laravel 11. Run composer update livewire/livewire to update Livewire to the latest version.
  6. Example Test Case:

    • Here's an example of how your test case should look:
use Livewire\Livewire;
use Tests\TestCase;

class StatusFilterTest extends TestCase
{
    /** @test */
    public function it_shows_status_filters_component()
    {
        $this->get(route('idea.index'))
             ->assertSeeLivewire('status-filters');
    }
}
  1. Check PHPUnit Configuration:
    • Ensure that your PHPUnit configuration is set up correctly and that the test is being executed. You can run your tests with php artisan test to see if the assertion is being picked up.

If you've gone through these steps and the issue persists, consider checking the Livewire documentation for any updates or changes in the API that might affect the assertSeeLivewire method. Additionally, reviewing the Laracasts forum or GitHub issues for similar problems might provide further insights.

Please or to participate in this conversation.