ddev / ddev-contrib

Contrib space for DDEV services, tools, snippets, and approaches.
Apache License 2.0
162 stars 162 forks source link

drupalci-chromedriver recipe does not work on arm64 (Mac M1/Apple Siliicon) #212

Open smustgrave opened 2 years ago

smustgrave commented 2 years ago

Following the setup on https://github.com/drud/ddev-contrib/tree/master/docker-compose-services/drupalci-chromedriver I get the following error

1) Drupal\Tests\system\FunctionalJavascript\System\DateFormatTest::testDateFormatXss The test wasn't able to connect to your webdriver instance. For more information read core/tests/README.md.

The original message while starting Mink: Could not open connection: 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.) (Driver info: chromedriver=98.0.4758.102 (273bf7ac8c909cde36982d27f66f3c70846a3718-refs/branch-heads/4758@{#1151}),platform=Linux 5.10.47-linuxkit x86_64)

/var/www/html/web/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php:55 /var/www/html/web/core/tests/Drupal/Tests/BrowserTestBase.php:381 /var/www/html/web/core/modules/system/tests/src/FunctionalJavascript/System/DateFormatTest.php:29 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:703

Don't know how to proceed any help would be appreciated (@mglaman or @heddn tagging you as the authors on that page)

I'm on a macbook with the M1 chip if that matters.

rfay commented 2 years ago

M1 matters a lot, as the recipe you're using doesn't have amd64 images. (chromedriver doesn't have amd64, only chromium). See https://github.com/drud/ddev/issues/3578 for a path.

smustgrave commented 2 years ago

So I added

`webimage_extra_packages:

phpunit.xml

`

`

Installed the following "require-dev": { "drupal/core-dev": "^9.5", "phpspec/prophecy-phpunit": "^2.0", "phpunit/phpunit": "^9.5", "weitzman/drupal-test-traits": "^1.5" },

When I try and run

ddev exec phpunit --verbose -c ./phpunit-phpstorm.xml web/core/modules/system/tests/src/FunctionalJavascript/System/DateFormatTest.php

I get

1) Drupal\Tests\system\FunctionalJavascript\System\DateFormatTest::testDateFormatXss The test wasn't able to connect to your webdriver instance. For more information read core/tests/README.md.

The original message while starting Mink: Could not open connection: Curl error thrown for http POST to http://localhost:4444/wd/hub/session with params: {"desiredCapabilities":{"browserName":"firefox","name":"Behat Test"}}

Failed to connect to localhost port 4444: Connection refused

/var/www/html/web/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php:55 /var/www/html/web/core/tests/Drupal/Tests/BrowserTestBase.php:381 /var/www/html/web/core/modules/system/tests/src/FunctionalJavascript/System/DateFormatTest.php:29 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:726

Not even using my config it seems

rfay commented 2 years ago

Your webdriver has crashed because it's amd64 and can't run on arm64. "The test wasn't able to connect to your webdriver instance". You can see the crash with ddev logs chromedriver

smustgrave commented 2 years ago

Any suggestions or am I just out of luck right now until wider support for the new M1 happens?

rfay commented 2 years ago

Please do go look at https://github.com/drud/ddev/issues/3578

heddn commented 2 years ago

I use linux/amd64, so I won't be much help here.

smustgrave commented 2 years ago

@heddn no worries thank you though!

@rfay tried following the steps from https://github.com/drud/ddev/issues/3578#issuecomment-1039898468 but no luck. If you have a consolidated list of tricks it would be appreciated.

Trying to be a good Drupal contributor and right functional javascript files but can't seem to get a chromedriver working

rfay commented 2 years ago

I've spent a lot of time with this, and built a new multiplatform chromium image for use (https://github.com/drud/ddev-contrib/tree/master/docker-compose-services/headless-chrome) but the Drupal community here hasn't stepped up to adjust to use it. The most knowledgable person I know is @stborchert in https://github.com/drud/ddev/issues/3578#issuecomment-1039898468 - please follow up there. He has also promised to write up the whole recipe.

rfay commented 2 years ago

Please follow up in that issue, not here. Thanks.

smustgrave commented 2 years ago

@rfay I FINALLY got it working. I would like to document how for future users. Where would it best go?
Edit the config file Custom command Phpunit.xml example

rfay commented 2 years ago

How about a ddev-get add-on (see https://github.com/drud/ddev-addon-template)? That would be awesome! Otherwise, a PR here in ddev-contrib. I'd love you to do it as an add-on, where it can be properly maintained over the long term.

smustgrave commented 2 years ago

Cool I'll take a look. Hopefully eventually drupalci chromeDriver catches up

Since this doesn't have its own docker-compose file would that work as an add on?

rfay commented 2 years ago

Let's find out who maintains that and see if we can figure out how to influence it.

rfay commented 2 years ago

Except... it can't use Chrome at this time, as there are no chrome arm64 packages, only Chromium.