Navigation Menu testing

I want to test, if my navigation menu item is visible or not. Currently I am relying on this code snippet
$this->get(Dashboard::getUrl())
->assertSuccessful()
->assertSeeTextInOrder([
'Posts',
'Comments'
]);
$this->get(Dashboard::getUrl())
->assertSuccessful()
->assertSeeTextInOrder([
'Posts',
'Comments'
]);
I am running filament v3 and pest v3 with livewire plugin installed, But this may result in a false positive. I want to understand if I can get easily test this in a more efficient way. I need the testing because, in another test case, I want to test that the nav menu item is not visible on certain condition.
1 Reply
awcodes
awcodes4d ago
Maybe getNavigation() from the Filament facade and test the items are in the array instead?

Did you find this page helpful?