Trying to write some tests for my Laravel Livewire components following the official Livewire documentation, but I’m hitting brick walls from the very beginning. I have a feeling the issue is not with my code, but want to have it confirmed by some people more familiar with Livewire.
So the documentation gives this method as an example:
/** @test */
function post_creation_page_contains_livewire_component()
{
$this->get('/posts/create')->assertSeeLivewire('create-post');
}
So here is my method following the same model:
/** @test */
public function manage_permissions_contains_livewire_component(): void
{
$this->actingAs(User::factory()->create());
$response = $this->get('/permissions');
$response->assertSeeLivewire('manage-permissions');
}
The issue I’m facing is that there is no existing assertSeeLivewire method in the response returned.
My test class extends the TestsTestCase test class which then extends the IlluminateFoundationTestingTestCase class, which seems to be the correct TestCase.
The returned response is an instance of IlluminateHttpResponse.
The error message received is: -> BadMethodCallException: Method IlluminateHttpResponse::assertSeeLivewire does not exist.
Is that documentation outdated (https://laravel-livewire.com/docs/2.x/testing) or is it me doing something wrong here?