© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•5mo ago
moinmichi

Testing repeater if field exists

I'm testing the form of an action of a custom page and need to check if all fields are present. The form has an repeater component. How can I check the existence of the fields in the repeater component? For the normal fields the test works fine, but I can't test for the repeater fields. Here is the test:
#[Test]
    public function it_shows_full_group_form_for_super_admin()
    {
        PrimusUser::instance()->actingAs('admin', 2);
        try {
            $component = Livewire::test($this->page);
            $component->assertSuccessful();
            $group = $this->phase->initialPhaseGroups->first();
            $component->mountAction('editPhaseGroup', ['id' => $group->id])
                ->assertSuccessful()
                ->assertFormExists('mountedActionForm')
                ->assertFormFieldExists('name', 'mountedActionForm')
                ->assertFormFieldExists('status', 'mountedActionForm')
                ->assertFormFieldExists('is_multiple_choice', 'mountedActionForm')
                ->assertFormFieldExists('description', 'mountedActionForm')
                ->assertFormFieldExists('variants', 'mountedActionForm')
                ->assertFormFieldExists('is_relevant', 'mountedActionForm');
        } finally {
            $this->signOut();
        }
    }
#[Test]
    public function it_shows_full_group_form_for_super_admin()
    {
        PrimusUser::instance()->actingAs('admin', 2);
        try {
            $component = Livewire::test($this->page);
            $component->assertSuccessful();
            $group = $this->phase->initialPhaseGroups->first();
            $component->mountAction('editPhaseGroup', ['id' => $group->id])
                ->assertSuccessful()
                ->assertFormExists('mountedActionForm')
                ->assertFormFieldExists('name', 'mountedActionForm')
                ->assertFormFieldExists('status', 'mountedActionForm')
                ->assertFormFieldExists('is_multiple_choice', 'mountedActionForm')
                ->assertFormFieldExists('description', 'mountedActionForm')
                ->assertFormFieldExists('variants', 'mountedActionForm')
                ->assertFormFieldExists('is_relevant', 'mountedActionForm');
        } finally {
            $this->signOut();
        }
    }

The 'variants' is the repeater. Something like 'variants.factor' doesn't work.
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

Testing Repeater
FilamentFFilament / ❓┊help
2y ago
Testing repeater
FilamentFFilament / ❓┊help
3y ago
Testing Repeater component
FilamentFFilament / ❓┊help
2y ago
Testing repeater fields
FilamentFFilament / ❓┊help
3y ago