Testing a confirming action

I'm trying to make a test that ensures that if an action that requires confirmation is called and the user does not confirm the operation then it is not called. For simplicity sake, imagine it is a table's delete action. What can I do to simulate the user dismissing the dialog instead of submiting it? Here's what I have so far:
$page = livewire(MyResourceListPage::class)
->assertCountTableRecords(1)
->assertTableActionExists('delete')
->mountTableAction('delete', $businessArea)
->assertTableActionHalted('delete');

// Now I would dismiss the confirmation dialog
//How??

// And make sure the record was not deleted
expect(MyModel::query()->where('id', $knownId)->count())->toBe(1);
$page = livewire(MyResourceListPage::class)
->assertCountTableRecords(1)
->assertTableActionExists('delete')
->mountTableAction('delete', $businessArea)
->assertTableActionHalted('delete');

// Now I would dismiss the confirmation dialog
//How??

// And make sure the record was not deleted
expect(MyModel::query()->where('id', $knownId)->count())->toBe(1);
2 Replies
Dan Harrin
Dan Harrin2y ago
dismissing is done on the frontend so there isnt a simulation what you have is all you need unless you call callMountedTableAction() it wont be run
marco.ferreira
marco.ferreiraOP2y ago
Thanks for the answer. I'll leave it as it is then.
Want results from more Discord servers?
Add your server