Testing tables with multiple panels

I'm testing a table in a project with multiple panels "admin" and "company". Example test is like this:
it('can list posts', function () {
$pages = Page::factory()->count(10)->create();

livewire(App\Filament\Company\Resources\PageResource\Pages\ListPages::class)
->assertCanSeeTableRecords($pages);
});
it('can list posts', function () {
$pages = Page::factory()->count(10)->create();

livewire(App\Filament\Company\Resources\PageResource\Pages\ListPages::class)
->assertCanSeeTableRecords($pages);
});
When executing the test I get the error Route [filament.admin.resources.pages.edit] not defined. It seems that it assumes that the table is used on the default panel 'admin', but it is on the 'company' panel. meaning the correct route would be filament.company.resources.pages.edit. Do I need to set the panel somewhere in the test or is this a bug?
1 Reply
Stevemo
Stevemo2y ago
add this to your test beforeEach(function () { filament()->setCurrentPanel(filament()->getPanel('company')); });

Did you find this page helpful?