Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Api/PendingAwaitablePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,16 @@ public function withUserAgent(string $userAgent): self
]);
}

/**
* Sets the host for the server.
*/
public function withHost(string $host): self
{
Playwright::setHost($host);

return new self($this->browserType, $this->device, $this->url, $this->options);
}

/**
* Sets the timezone for the page.
*/
Expand Down
6 changes: 2 additions & 4 deletions tests/Browser/Visit/SubdomainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
</html>
');

pest()->browser()->withHost('app.localhost');

visit('/app-test')
->withHost('app.localhost')
->assertSee('Welcome to NON Subdomain')
->assertSeeIn('#content', 'This is the non subdomain content')
->assertTitle('Non Subdomain');
Expand All @@ -33,9 +32,8 @@
]);
});

pest()->browser()->withHost('api.localhost');

visit('/api/health')
->withHost('api.localhost')
->assertSee('"status":"ok"')
->assertSee('"subdomain":"api"')
->assertSee('"host":"api.localhost"');
Expand Down