Test Slideover is Visible

I want to test that a slideOver edit action is visible. I have this on my ViewRecord:
<?php

namespace App\Filament\Resources\EntityTypeResource\Pages;

use App\Filament\Resources\EntityTypeResource;
use App\Models\EntityType;
use Filament\Actions\EditAction;
use Filament\Resources\Pages\ViewRecord;

class ViewEntityType extends ViewRecord
{
protected static string $resource = EntityTypeResource::class;

protected function getHeaderActions(): array
{
return [
EditAction::make()
->slideOver()
->form(EntityType::getForm()),
];
}
}
<?php

namespace App\Filament\Resources\EntityTypeResource\Pages;

use App\Filament\Resources\EntityTypeResource;
use App\Models\EntityType;
use Filament\Actions\EditAction;
use Filament\Resources\Pages\ViewRecord;

class ViewEntityType extends ViewRecord
{
protected static string $resource = EntityTypeResource::class;

protected function getHeaderActions(): array
{
return [
EditAction::make()
->slideOver()
->form(EntityType::getForm()),
];
}
}
This is the PEST test I am trying to run:
it('renders the edit slideover', function () {
$entityType = EntityType::factory()->create();
livewire(ViewEntityType::class, ['record' => $entityType->getRouteKey()])
->mountAction(['edit'])
->callAction(['edit'])
->assertSee('Save changes');
});
it('renders the edit slideover', function () {
$entityType = EntityType::factory()->create();
livewire(ViewEntityType::class, ['record' => $entityType->getRouteKey()])
->mountAction(['edit'])
->callAction(['edit'])
->assertSee('Save changes');
});
I have tried multiple variations of this, but I need some more direction. Thanks.
1 Reply
EleventhTower
EleventhTowerOP8mo ago
Another day and a fresh set of eyes. I swear I tested this before, but this works now:
it('renders the edit slideover', function () {
$entityType = EntityType::factory()->create();
livewire(ViewEntityType::class, ['record' => $entityType->getRouteKey()])
->mountAction('edit')
->assertSee('Save changes');
});
it('renders the edit slideover', function () {
$entityType = EntityType::factory()->create();
livewire(ViewEntityType::class, ['record' => $entityType->getRouteKey()])
->mountAction('edit')
->assertSee('Save changes');
});
Want results from more Discord servers?
Add your server