Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dusk Tests not running via Sail on Apple M1 Chip #899

Closed
fabianpnke opened this issue May 23, 2021 · 6 comments
Closed

Dusk Tests not running via Sail on Apple M1 Chip #899

fabianpnke opened this issue May 23, 2021 · 6 comments

Comments

@fabianpnke
Copy link

fabianpnke commented May 23, 2021

  • Dusk Version: 6.15.0
  • Laravel Version: 8.42.1
  • PHP Version: 8.0.5
  • Database Driver & Version: MariaDB 10.5.10

Description:

Laravel Dusk Tests do not run, with a clean install on an Apple M1 Chip with Laravel Sail.
Thanks for your help!
Regards
Fabian

Steps To Reproduce:

  1. Create a new Laravel Project via CLI
    curl -s "https://laravel.build/dusk-tests?with=mariadb,redis,mailhog,selenium" | bash
  2. Build and start Sail Containers
    cd dusk-tests
    ./vendor/bin/sail build --no-cache
    ./vendor/bin/sail up
  3. Install Laravel Dusk
    sail composer require --dev laravel/dusk
    sail artisan dusk:install
  4. Run Laravel Dusk Test Suite
    ./vendor/bin/sail dusk
  5. The following error eccurs
PHPUnit 9.5.4 by Sebastian Bergmann and contributors.

E                                                                   1 / 1 (100%)

Time: 00:09.462, Memory: 20.00 MB

There was 1 error:

1) Tests\Browser\ExampleTest::testBasicExample
Facebook\WebDriver\Exception\UnknownErrorException: unknown error: Chrome failed to start: crashed.
  (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.)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'a44e39c1dca6', ip: '172.27.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.25-linuxkit', java.version: '1.8.0_282'
Driver info: driver.version: unknown
remote stacktrace: #0 0x004000666e89 <unknown>


/var/www/html/vendor/php-webdriver/webdriver/lib/Exception/WebDriverException.php:139
/var/www/html/vendor/php-webdriver/webdriver/lib/Remote/HttpCommandExecutor.php:371
/var/www/html/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php:135
/var/www/html/tests/DuskTestCase.php:46
/var/www/html/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:218
/var/www/html/vendor/laravel/framework/src/Illuminate/Support/helpers.php:234
/var/www/html/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:219
/var/www/html/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:97
/var/www/html/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:65
/var/www/html/tests/Browser/ExampleTest.php:21

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.
@driesvints
Copy link
Member

driesvints commented May 23, 2021

The m1 Chromedriver version isn't shipped by default. Try running php artisan dusk:chrome-driver and running your build again.

@fabianpnke
Copy link
Author

I tried the sail artisan dusk:chrome-driverand php artisan dusk:chrome-drivercommand. Even with the --all or --detectargument. Still getting the same error.

@driesvints
Copy link
Member

Forgot that actually doesn't matters as the Sail builds are a Linux environment. It should work normally 🤔

@fabianpnke
Copy link
Author

Changed to local setup without sail.

@totov
Copy link

totov commented May 27, 2021

I'm getting the same issue. I logged into the Selenium container and tried running google-chrome manually to see if I could spot anything obvious in the output and it's getting a seg fault:

seluser@8a851d21571c:/$ google-chrome --disable-gpu --headless www.google.com
qemu: uncaught target signal 5 (Trace/breakpoint trap) - core dumped
qemu: uncaught target signal 5 (Trace/breakpoint trap) - core dumped
[0527/203840.526044:ERROR:bus.cc(393)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[0527/203840.528608:ERROR:file_path_watcher_linux.cc(326)] inotify_init() failed: Function not implemented (38)
[0527/203840.597577:WARNING:headless_browser_main_parts.cc(106)] Cannot create Pref Service with no user data dir.
[0527/203840.662261:ERROR:gpu_process_host.cc(996)] GPU process launch failed: error_code=1002
[0527/203840.663498:WARNING:gpu_process_host.cc(1316)] The GPU process has crashed 1 time(s)
qemu: unknown option 'type=utility'
[0527/203840.722029:ERROR:gpu_process_host.cc(996)] GPU process launch failed: error_code=1002
[0527/203840.722095:WARNING:gpu_process_host.cc(1316)] The GPU process has crashed 2 time(s)
[0527/203840.818203:ERROR:gpu_process_host.cc(996)] GPU process launch failed: error_code=1002
[0527/203840.818267:WARNING:gpu_process_host.cc(1316)] The GPU process has crashed 3 time(s)
[0527/203840.825570:ERROR:gpu_process_host.cc(996)] GPU process launch failed: error_code=1002
[0527/203840.825615:WARNING:gpu_process_host.cc(1316)] The GPU process has crashed 4 time(s)
[0527/203840.882838:ERROR:network_service_instance_impl.cc(331)] Network service crashed, restarting service.
[0527/203840.887285:ERROR:gpu_process_host.cc(996)] GPU process launch failed: error_code=1002
[0527/203840.887349:WARNING:gpu_process_host.cc(1316)] The GPU process has crashed 5 time(s)
qemu: unknown option 'type=utility'
[0527/203840.931402:ERROR:gpu_process_host.cc(996)] GPU process launch failed: error_code=1002
[0527/203840.931461:WARNING:gpu_process_host.cc(1316)] The GPU process has crashed 6 time(s)
[0527/203840.931514:FATAL:gpu_data_manager_impl_private.cc(415)] GPU process isn't usable. Goodbye.
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault

I tried the prerelease version of the selenium docker image as well as specifying the platform in the docker-compose.yml file, but still getting the same issue. Think this is probably more specific to Selenium than Dusk/Sail though.

@totov
Copy link

totov commented May 28, 2021

There's further discussion about the selenium docker image not working on Mac M1 chips here. The workaround mentioned in the last comment worked for me (i.e. using the seleniarm image instead). Here's the relevant section of my docker-compose.yml file:

 selenium:
   image: 'seleniarm/standalone-chromium:4.0.0-beta-1-20210215'
   ports:
       - '4444:4444'
   volumes:
        - '/dev/shm:/dev/shm'
   networks:
       - sail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants