How to test with multi-tenancy ?

When I want to test a create form on a multi-tenant aware panel, I get an error because the index route is missing the tenant parameter.
I think this is the index route used by the "cancel" button.
How do I inject the correct tenant in my test to prevent this error ?

Here is my code :

test('superadmin can create admin', function () {
    $this->signInAsSuperAdmin();
    livewire(CreateSuperadmin::class)
        ->fillForm([
            'name' => 'New Admin',
            'email' => 'test@test.com',
            'password' => 'password',
        ])
        ->call('create')
        ->assertHasNoFormErrors();

    $this->assertDatabaseHas(User::class, [
        'name' => 'New Admin',
        'email' => 'test@test.com',
    ]);
});


Although it is the create page, I get the following error : Missing required parameter for [Route: filament.admin.resources.superadmin.index]
Was this page helpful?