Β© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filamentβ€’11mo agoβ€’
2 replies
D5300

Field is hidden test - Pest

Hi guys,

I have on my tenant create a form which I want to test. It has a depending field which I try to test if its visible or not. But using isVisible or isHidden, both return an error:

Failed asserting that a field with the name [company_name] is hidden on the form named [form] on the [App\Filament\Pages\Tenancy\RegisterWebsite] component.
Failed asserting that an array does not have the key 'company_name'.

My test looks like the following:

it('hides the company name field when you want to create a new company', function () {
            $user = newUser();
            $this->actingAs($user);
            $company = Company::factory(['owner_id' => $user])->create();
            Website::factory(['company_id' => $company])->create();

            $livewire = livewire(RegisterWebsite::class);

            $livewire->fillForm([
                'company_id' => Company::first()->id
            ]);

            $livewire->assertFormFieldIsHidden('company_name');
        });
it('hides the company name field when you want to create a new company', function () {
            $user = newUser();
            $this->actingAs($user);
            $company = Company::factory(['owner_id' => $user])->create();
            Website::factory(['company_id' => $company])->create();

            $livewire = livewire(RegisterWebsite::class);

            $livewire->fillForm([
                'company_id' => Company::first()->id
            ]);

            $livewire->assertFormFieldIsHidden('company_name');
        });


The form will be in a seperate message as I dont have discord premium πŸ˜„
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel β€’ Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

#fileupload #test #pest
FilamentFFilament / β“β”Šhelp
13mo ago
Test authentication with Pest
FilamentFFilament / β“β”Šhelp
2y ago
How to test that field hidden in infolist?
FilamentFFilament / β“β”Šhelp
3y ago
Save hidden field
FilamentFFilament / β“β”Šhelp
3y ago