Test tenancy redirects

Got a wierd one here. If I go to my filament app, login, then in the browser just enter https://domain.com/admin (the default panel is 'admin'), I get successfully redirected to <default tenant>.domain.com/admin All good. But I try to test this via pest: (Note: config('app.home_url_tld') is simply 'domain.com') the final URL is https://domain.com , even though that's the same user with the default tenant
it('redirects to homepage if no tenant subdomain is defined and user has a default tenant', function () {

$user = User::find(1);
$response = $this->actingAs($user)
->followingRedirects()
->get('https://'.config('app.home_url_tld')."/admin");

$response->assertSessionHasNoErrors()
->assertStatus(200)
->assertLocation("https://".$user->getDefaultTenant()->slug.".".config('app.home_url_tld')."/admin");


})->only();
it('redirects to homepage if no tenant subdomain is defined and user has a default tenant', function () {

$user = User::find(1);
$response = $this->actingAs($user)
->followingRedirects()
->get('https://'.config('app.home_url_tld')."/admin");

$response->assertSessionHasNoErrors()
->assertStatus(200)
->assertLocation("https://".$user->getDefaultTenant()->slug.".".config('app.home_url_tld')."/admin");


})->only();
I've tested this by taking out the config helpers and just hard-coding the domain, and get the same issue. Anyone got any idea why pest should be different to the browser in this case?
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?