Testing filament resource table got an error
I got an error when testing a filament resource table like that! I don't know why?. I just copied the code from filament resource testing documentation.
CategoryResourceTest.php
lse,"except":null},"defaultTableActionRecord":{"as":"tableActionRecord","use":"replace","alwaysShow":false,"except":null},"paginators.page":{"as":"page","use":"push","alwaysShow":false,"except":null}}}" wire:id="7e0WsZp5wPL6t4HSQntg"\n
class="fi-page fi-resource-list-records-page fi-resource-categories"\n
>\n
... (3480 more lines)
To contain: 7e0WsZp5wPL6t4HSQntg.table.records.11
at vendor/livewire/livewire/src/Features/SupportTesting/MakesAssertions.php:38
34▕
35▕ function assertSeeHtml($values)
36▕ {
37▕ foreach (Arr::wrap($values) as $value) {
➜ 38▕ PHPUnit::assertStringContainsString(
39▕ $value,
40▕ $this->html()
41▕ );
42▕ }
+4 vendor frames
5 tests/Feature/filament/CategoryResourceTest.php:43
lse,"except":null},"defaultTableActionRecord":{"as":"tableActionRecord","use":"replace","alwaysShow":false,"except":null},"paginators.page":{"as":"page","use":"push","alwaysShow":false,"except":null}}}" wire:id="7e0WsZp5wPL6t4HSQntg"\n
class="fi-page fi-resource-list-records-page fi-resource-categories"\n
>\n
... (3480 more lines)
To contain: 7e0WsZp5wPL6t4HSQntg.table.records.11
at vendor/livewire/livewire/src/Features/SupportTesting/MakesAssertions.php:38
34▕
35▕ function assertSeeHtml($values)
36▕ {
37▕ foreach (Arr::wrap($values) as $value) {
➜ 38▕ PHPUnit::assertStringContainsString(
39▕ $value,
40▕ $this->html()
41▕ );
42▕ }
+4 vendor frames
5 tests/Feature/filament/CategoryResourceTest.php:43
it('can list categories table', function () {
$categories = Category::factory()->count(10)->create();
livewire(CategoryResource\Pages\ListCategories::class)
->assertCanSeeTableRecords($categories);
});
it('can list categories table', function () {
$categories = Category::factory()->count(10)->create();
livewire(CategoryResource\Pages\ListCategories::class)
->assertCanSeeTableRecords($categories);
});
1 Reply