Я пытаюсь запустить тест браузера по умолчанию Laravel, но получаю эту ошибку:
[...] $ php artisan dusk
PHPUnit 7.5.20 by Sebastian Bergmann and contributors.
E 1 / 1 (100%)
Time: 640 ms, Memory: 22.00 MB
There was 1 error:
1) Tests\Browser\ExampleTest::testBasicExample
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session with params: {"desiredCapabilities":{"browserName":"chrome","platform":"ANY","chromeOptions":{"w3c":false,"binary":"","args":["--disable-gpu","--headless","--window-size=1920,1080"]}}}
Failed to connect to localhost port 9515: Connection refused
/home/rere/laravel/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:297
/home/rere/laravel/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:144
/home/rere/laravel/tests/DuskTestCase.php:40
/home/rere/laravel/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:200
/home/rere/laravel/vendor/laravel/framework/src/Illuminate/Support/helpers.php:817
/home/rere/laravel/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:201
/home/rere/laravel/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:95
/home/rere/laravel/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:65
/home/rere/laravel/tests/Browser/ExampleTest.php:21
ERRORS!
Tests: 1, Assertions: 0, Errors: 1.
Laravel версия: 5.8
Laravel Dusk версия: 5.8
У меня Laravel на виртуальном хостинге (Linux).
Пожалуйста, помогите мне: (
UPDATE:
DuskTestCase. php
<?php
namespace Tests;
use Facebook\WebDriver\Chrome\ChromeOptions;
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Laravel\Dusk\TestCase as BaseTestCase;
abstract class DuskTestCase extends BaseTestCase
{
use CreatesApplication;
/**
* Prepare for Dusk test execution.
*
* @beforeClass
* @return void
*/
public static function prepare()
{
//static::startChromeDriver();
}
/**
* Create the RemoteWebDriver instance.
*
* @return \Facebook\WebDriver\Remote\RemoteWebDriver
*/
protected function driver()
{
$options = (new ChromeOptions)->addArguments([
'--disable-gpu',
'--headless',
'--no-sandbox'
]);
return RemoteWebDriver::create(
'http://mywebsite.com/clients', DesiredCapabilities::chrome()->setCapability(
ChromeOptions::CAPABILITY, $options
)
);
}
}
LoginTest. php:
<?php
namespace Tests\Unit;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;
class LoginTest extends TestCase
{
/**
* A basic unit test example.
*
* @return void
*/
public function testExample()
{
$response = $this->get('/login');
$response->assertStatus(200);
}
}
PS Мои файлы каталога laravel publi c находятся в каталоге / public_html / clients. Каталоги laravel находятся в каталоге / laravel.