Testing Section header/footer Actions

Hello, How do I test the schema/submit action for an action I defined in a Section's headerActions or footerActions within a panel page? For a start, I have my schema set up like so:
Section::make('Prescriptions')
->id('prescriptions')
->schema([
//...
])
->headerActions([
Action::make('New Prescription')
->icon(Heroicon::Plus)
->slideOver()
->modalWidth(Width::ExtraLarge)
->action(fn ($data) => $this->addPrescription($data))
->databaseTransaction()
->schema(...)
Section::make('Prescriptions')
->id('prescriptions')
->schema([
//...
])
->headerActions([
Action::make('New Prescription')
->icon(Heroicon::Plus)
->slideOver()
->modalWidth(Width::ExtraLarge)
->action(fn ($data) => $this->addPrescription($data))
->databaseTransaction()
->schema(...)
I have a test that calls
// assettion fails
Livewire::test(Prescription::class)->assertActionExists('New Prescription')

// callMountedAction requires an array, I'm not sure what the array item shere should be
Livewire::test(Prescriptions::class)->callMountedAction('New Prescription');

// This still requires an array of $actions, I'm unsure where those actions should come from
Livewire::test(Prescriptions::class)->callInfolistAction('New Prescription');
// assettion fails
Livewire::test(Prescription::class)->assertActionExists('New Prescription')

// callMountedAction requires an array, I'm not sure what the array item shere should be
Livewire::test(Prescriptions::class)->callMountedAction('New Prescription');

// This still requires an array of $actions, I'm unsure where those actions should come from
Livewire::test(Prescriptions::class)->callInfolistAction('New Prescription');
Hoping someone can point out where I should start from.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?