ユニットテスト

フィーチャーテスト

ブラウザテスト(Laravel Dusk)

インストール

$ sail composer require --dev laravel/dusk
$ sail artisan dusk:install

テスト実行

$ sail dusk

.env編集

APP_URL=http://localhost
DUSK_DRIVER_URL=http://localhost

トラブルシューティング 

Facebook\WebDriver?\Exception\SessionNotCreatedException?: Could not start a new session. Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: unknown error: Chrome failed to start: crashed.

% sail dusk
PHPUnit 9.5.21 #StandWithUkraine

E                                                                   1 / 1 (100%)

Time: 00:35.580, Memory: 22.00 MB

There was 1 error:

1) Tests\Browser\ExampleTest::testBasicExample
Facebook\WebDriver\Exception\SessionNotCreatedException: Could not start a new session. Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: unknown error: Chrome failed to start: crashed.
  (chrome not reachable)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '4.2.2', revision: '683ccb65d6'
System info: host: '9132dedbda0e', ip: '172.19.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.104-linuxkit', java.version: '11.0.15'
Driver info: driver.version: unknown
Build info: version: '4.2.2', revision: '683ccb65d6'
System info: host: '9132dedbda0e', ip: '172.19.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.104-linuxkit', java.version: '11.0.15'
Driver info: driver.version: unknown

/var/www/html/vendor/php-webdriver/webdriver/lib/Exception/WebDriverException.php:125
/var/www/html/vendor/php-webdriver/webdriver/lib/Remote/HttpCommandExecutor.php:372
/var/www/html/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php:131
/var/www/html/tests/DuskTestCase.php:46
/var/www/html/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:219
/var/www/html/vendor/laravel/framework/src/Illuminate/Support/helpers.php:243
/var/www/html/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:220
/var/www/html/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:98
/var/www/html/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:66
/var/www/html/tests/Browser/ExampleTest.php:21

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.
  • アプリケーションの.envファイルにAPP_URL環境変数を設定

Facebook\WebDriver?\Exception\WebDriverCurlException?: Curl error thrown for http POST to /session with params:

Failed to connect to localhost port 4444: Connection refused


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2022-06-28 (火) 14:07:44 (661d)