Skip to content
This repository has been archived by the owner on Nov 3, 2024. It is now read-only.

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

Open
smustgrave opened this issue Jun 1, 2022 · 14 comments

Comments

@smustgrave
Copy link

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
Copy link
Member

rfay commented Jun 1, 2022

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

@smustgrave
Copy link
Author

smustgrave commented Jun 1, 2022

So I added

`webimage_extra_packages:

  • chromium
  • chromium-driver`
    to my config.yml file

phpunit.xml

<php> <!-- Set error reporting to E_ALL. --> <ini name="error_reporting" value="32767"/> <!-- Do not limit the amount of memory tests take to run. --> <ini name="memory_limit" value="-1"/> <!-- Example SIMPLETEST_BASE_URL value: http://localhost --> <env name="SIMPLETEST_BASE_URL" value="http://drupal9-ddev.ddev.site"/> <!-- Example SIMPLETEST_DB value: mysql://username:password@localhost/databasename#table_prefix --> <env name="SIMPLETEST_DB" value="sqlite://localhost//tmp/drupal9-ddev.test.sqlite"/> <!-- Example BROWSERTEST_OUTPUT_DIRECTORY value: /path/to/webroot/sites/simpletest/browser_output --> <env name="BROWSERTEST_OUTPUT_DIRECTORY" value="./docroot/sites/simpletest/browser_output"/> <!-- To have browsertest output use an alternative base URL. For example if SIMPLETEST_BASE_URL is an internal DDEV URL, you can set this to the external DDev URL so you can follow the links directly. --> <env name="BROWSERTEST_OUTPUT_BASE_URL" value="http://drupal9-ddev.ddev.site"/> <!-- To disable deprecation testing completely uncomment the next line. --> <!-- <env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/> --> <!-- Example for changing the driver class for mink tests MINK_DRIVER_CLASS value: 'Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver' --> <env name="MINK_DRIVER_CLASS" value=""/> <!-- Example for changing the driver args to mink tests MINK_DRIVER_ARGS value: '["http://127.0.0.1:8510"]' --> <env name="MINK_DRIVER_ARGS" value=""/> <!-- Example for changing the driver args to webdriver tests MINK_DRIVER_ARGS_WEBDRIVER value: '["chrome", { "chromeOptions": { "w3c": false } }, "http://localhost:4444/wd/hub"]' For using the Firefox browser, replace "chrome" with "firefox" --> <env name="MINK_DRIVER_ARGS_WEBDRIVER" value="['chrome', {'browserName':'chrome','chromeOptions':{'args':['--disable-gpu','--disable-dev-shm-usage','--headless','--no-sandbox','--window-size=1920,1080']}}, 'http://localhost:9515']"/> <!-- Drupal Test Traits --> <env name="DTT_BASE_URL" value="http://drupal9-ddev.ddev.site"/> <env name="DTT_API_URL" value="http://localhost:9222"/> <env name="DTT_MINK_DRIVER_ARGS" value="['chrome', {'browserName':'chrome','chromeOptions':{'args':['--disable-gpu','--disable-dev-shm-usage','--headless','--no-sandbox','--window-size=1920,1080']}}, 'http://localhost:9515']"/> <!-- @todo This should not be necessary, but Drupal Test Traits currently throw a lot of deprecation warnings which make test jobs fail in CI. --> <env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/> </php>

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
Copy link
Member

rfay commented Jun 1, 2022

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
Copy link
Author

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

@rfay
Copy link
Member

rfay commented Jun 1, 2022

Please do go look at ddev/ddev#3578

@heddn
Copy link
Collaborator

heddn commented Jun 1, 2022

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

@smustgrave
Copy link
Author

@heddn no worries thank you though!

@rfay tried following the steps from ddev/ddev#3578 (comment) 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
Copy link
Member

rfay commented Jun 1, 2022

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 ddev/ddev#3578 (comment) - please follow up there. He has also promised to write up the whole recipe.

@rfay rfay changed the title Issue with chromedriver setup drupalci-chromedriver recipe does not work on arm64 (Mac M1/Apple Siliicon) Jun 1, 2022
@rfay
Copy link
Member

rfay commented Jun 1, 2022

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

@smustgrave
Copy link
Author

@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
Copy link
Member

rfay commented Jun 29, 2022

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
Copy link
Author

smustgrave commented Jun 29, 2022

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
Copy link
Member

rfay commented Jun 29, 2022

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

@rfay
Copy link
Member

rfay commented Jun 29, 2022

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

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

No branches or pull requests

3 participants