I'm in the midst of upgrading my Laravel 5.3 website to 5.5 and unable to get Dusk working properly against my localhost. I have other unit tests working properly against my localhost but for some reason, Dusk returns "<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body></body></html>"
for any local page. Local pages seem to work fine browsing it on my desktop.
My DuskTestCase
protected function driver()
{
$options = (new ChromeOptions)->addArguments([
'--disable-gpu',
'--headless',
'--no-sandbox',
'--ignore-certificate-errors'
]);
return RemoteWebDriver::create(
'http://localhost:9515',
DesiredCapabilities::chrome()
->setCapability(WebDriverCapabilityType::ACCEPT_SSL_CERTS, true)
->setCapability('acceptInsecureCerts', true)
->setCapability(
ChromeOptions::CAPABILITY, $options
)
);
}
My Sample Test
public function testBasicExample()
{
$this->browse(function (Browser $browser) {
$result = $browser->visit('http://localhost');
$browser->screenshot('test');
$browser->dump();
});
}
- chrome driver works fine calling google.com and dumps content
- hardcoded the url to localhost for testing
- page is http not https
- tried php artisan serve before calling test, same result
- tried cache / config clear
- created an
.env.dusk.local
file, didn't seem to affect it - chromedriver -v is
ChromeDriver 2.44.609551
- tried 127.0.0.1 no dice
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire