F
Filament2y ago
dyo

Test case in edit record page

How can create test case with pest to assert the view can be rendered, the inputs is disabled, and the button save is not exist.. I tried simple with :
php
$this->actingAs($user)
->get(CampaignResource::getUrl('edit', ['record' => $campaign->getRouteKey()]))
->assertSuccessful();
php
$this->actingAs($user)
->get(CampaignResource::getUrl('edit', ['record' => $campaign->getRouteKey()]))
->assertSuccessful();
The status code returns 403. But when I tried in browser with same user, it's successfully rendered.. What should i do?
4 Replies
LeandroFerreira
Filament
Testing - Admin Panel - Filament
The elegant TALL stack admin panel for Laravel artisans.
LeandroFerreira
Regards the 403 error, check the actingAs and the user's permission. https://filamentphp.com/docs/2.x/admin/testing#getting-started
Filament
Testing - Admin Panel - Filament
The elegant TALL stack admin panel for Laravel artisans.
ByteXR
ByteXR2y ago
Are you use your $user has correct permissions to enter filament admin. Because 403 would like be caused by that
dyo
dyoOP2y ago
in my opening thread above, i've posted the image of how the page behaviour if spesific user role open the editRecord page.. it can only view data details, the fields is disabled.. how can i assertSuccessful a detail record page? sorry nevermind, solved it by asserting from get('/') method..
Want results from more Discord servers?
Add your server