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.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?