chilio/laravel-dusk-ci

The process started from chrome location /chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.

enourinick opened this issue ยท 5 comments

Hi,

I'm using your image for my dusk test but it seems chrome driver sucks!

here is my .gitlab-ci.yml file

image: chilio/laravel-dusk-ci
services:
  - mysql:5.7

cache:
  untracked: true
  key: ${CI_COMMIT_REF_SLUG}
  paths:
    - node_modules
    - vendor
    - /root/.composer
    - /root/.npm

variables:
  MYSQL_DATABASE: mysql_database
  MYSQL_ROOT_PASSWORD: secret

stages:
  - tests

browser:
  stage: tests
  script:
    - cp .env.gitlab .env
    - composer install
    - npm install
    - npm run production
    - configure-laravel
    - start-nginx-ci-project
    - sleep 3
    - php artisan dusk
  artifacts:
    name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
    paths:
      - tests/Browser/screenshots/
    expire_in: 2 weeks
    when: always

the problem which I've faced with is it seems chromedriver does not run correctly or something!

$ configure-laravel
Application key [base64:D/JwKTvwukrg6cCT5bMt2/hVK3F7G6n2Fj7kmTDKGaQ=] set successfully.
Dropped all tables successfully.
Migration table created successfully.
#### MIGRATIONS ####
#### SEEDINGS  ####
System Chrome version: 69
System Chromedriver version: 2.42
Laravel Chromedriver version: 2.35
Chromedriver shipped with your Laravel installation is NOT compatible with this systems chrome version!
Don't worry, we are fixing this right now, so you will be able, to test your app anyway.
You can always read more about running tests with system inbuilt chromedriver in laravel-dusk-ci docs.
Scheduled start of inbuilt Chromedriver (2.42). Chromedriver will be ready soon...
Starting ChromeDriver 2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac) on port 9515
Only local connections are allowed.
[1538992522.833][SEVERE]: bind() returned an error, errno=99: Cannot assign requested address (99)
$ start-nginx-ci-project
 * Starting nginx nginx
   ...done.
$ sleep 3
$ php artisan dusk
Warning: TTY mode requires /dev/tty to be read/writable.
PHPUnit 7.3.5 by Sebastian Bergmann and contributors.

EE                                                                  2 / 2 (100%)

Time: 1.18 seconds, Memory: 18.00MB

There were 2 errors:

1) Tests\Browser\WhiteDownloadAppTest::testActive
Facebook\WebDriver\Exception\UnknownServerException: unknown error: Chrome failed to start: exited abnormally
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 3.10.0-862.9.1.el7.x86_64 x86_64)

/builds/inpin/landing/vendor/facebook/webdriver/lib/Exception/WebDriverException.php:114
/builds/inpin/landing/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:326
/builds/inpin/landing/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:126
/builds/inpin/landing/tests/DuskTestCase.php:40
/builds/inpin/landing/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:192
/builds/inpin/landing/vendor/laravel/framework/src/Illuminate/Support/helpers.php:750
/builds/inpin/landing/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:193
/builds/inpin/landing/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:93
/builds/inpin/landing/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:64
/builds/inpin/landing/tests/Browser/WhiteDownloadAppTest.php:50

2) Tests\Browser\WhiteDownloadAppTest::testInactive
Facebook\WebDriver\Exception\UnknownServerException: unknown error: Chrome failed to start: exited abnormally
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 3.10.0-862.9.1.el7.x86_64 x86_64)

/builds/inpin/landing/vendor/facebook/webdriver/lib/Exception/WebDriverException.php:114
/builds/inpin/landing/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:326
/builds/inpin/landing/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:126
/builds/inpin/landing/tests/DuskTestCase.php:40
/builds/inpin/landing/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:192
/builds/inpin/landing/vendor/laravel/framework/src/Illuminate/Support/helpers.php:750
/builds/inpin/landing/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:193
/builds/inpin/landing/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:93
/builds/inpin/landing/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:64
/builds/inpin/landing/tests/Browser/WhiteDownloadAppTest.php:73

ERRORS!
Tests: 2, Assertions: 0, Errors: 2.
Uploading artifacts...
tests/Browser/screenshots/: found 2 matching files 
Uploading artifacts to coordinator... ok            id=2302 responseStatus=201 Created token=_YoXGK5K
ERROR: Job failed: exit code 1

but every thing on my local machin runs correctly!

even I've tried to use the chromedriver-linux file from the vendor\laravel\dusk\bin and the other versions of chromedriver (version 2.40, 2.38 and 2.35) which I've downloaded directly form http://chromedriver.chromium.org but with all of them after sometimes (about 1 or 2 minuts) the error of Operation timed out after 30001 milliseconds with 0 bytes received has been shown.

did I do something wrong?

I'm using laravel 5.7 and dusk 4.0 (both the latest version).

Hi, which image have you tried?
And do you have
'--disable-gpu', '--headless', '--no-sandbox',
in your DuskTestCase driver setup?

Thank you very much, you saved me ๐Ÿ‘
My problem is I've forgotten to put '--no-sandbox' in my DuskTestCase driver, and now everything is going very well.

Hello! The same happened to me!
I put '--no-sandbox'in myDuskTestCase`
but now:

  1. Tests\Browser\ExampleTest::testBasicExample
    Did not see expected text [Laravel] within element [body].
    Failed asserting that false is true.
    any ideas?
    modify the .env.dusk.local?

@nmardones This error has to do with the actual tests being run. Your setup seems to be fine if you can see this.

@MCMainiac If you're right, the configuration is ok! and when executing it in gitlab the error is for another reason.
I was missing the phpunit.dusk.xml file
Thank you