Open codebymikey opened 5 months ago
Open the branch in Web Editor • VS Code • Insiders
Open Preview
The recent updates focus on modifying the PHPUnit configuration and related testing environments within a web project. The primary change involves updating the SIMPLETEST_BASE_URL
from "http://localhost"
to "http://web"
, impacting both PHPUnit and Nightwatch configurations to ensure proper URL settings for testing.
Files | Change Summary |
---|---|
.ddev/commands/web/phpunit |
Updated SIMPLETEST_BASE_URL from "http://localhost" to "http://web" . |
.ddev/docker-compose.testing.yaml |
Adjusted settings for PHPUnit and Nightwatch, including updates to SIMPLETEST_BASE_URL , MINK_DRIVER_ARGS_WEBDRIVER , and DRUPAL_TEST_WEBDRIVER_CHROME_ARGS . |
In the realm of code so bright,
URLs shift from day to night.
Fromlocalhost
toweb
we steer,
Testing paths now crystal clear.
With PHPUnit and Nightwatch in sync,
Our web project dances on the brink.
🐇✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
@codebymikey thank you for this PR! I confirm that this PR fixes running core/modules/action/tests/src/FunctionalJavascript/ActionFormAjaxTest.php
but for some reason it didn't worked for running javascript tests for checking iframes. Also it didn't worked for media browser test: Drupal\Tests\media_library\FunctionalJavascript\WidgetOverflowTest::testWidgetOverflow
I recieved:
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)
What worked for me is (in addition to your changes) to specify --no-sandbox
in both variables:
MINK_DRIVER_ARGS_WEBDRIVER: >-
[
"chrome",
{
"browserName":"chrome",
"chromeOptions":{"args":["--disable-dev-shm-usage","--disable-gpu","--headless","--dns-prefetch-disable","--no-sandbox"]},
"goog:chromeOptions":{"args":["--disable-dev-shm-usage","--disable-gpu","--headless","--dns-prefetch-disable","--no-sandbox"]}
},
"http://chromedriver:9515"
]
DRUPAL_TEST_WEBDRIVER_CHROME_ARGS: "--disable-dev-shm-usage --disable-gpu --headless --dns-prefetch-disable --no-sandbox"
@codebymikey or @shaal Would you mind updating the title to "Ensure functional javascript tests can be run"? (ran
-> run
) thanks!
(BTW, I'm not sure why Drupalpod isn't using https://github.com/ddev/ddev-selenium-standalone-chrome for this if it's not? That would be the best maintained solution. )
The Problem/Issue/Bug
It's currently not possible to run functional tests as the default settings are invalid.
How this PR Solves The Problem
I've updated the default environment variables to more appropriate ones based off what Drupal uses in it's official pipelines.
Implementation notes
The
MINK_DRIVER_ARGS_WEBDRIVER
environment variable supports bothgoog:chromeOptions
andchromeOptions
(legacy) in order to automatically support testing on Drupal <10.3 - https://www.drupal.org/node/3422624We can potentially simplify this to just
goog:chromeOptions
and add an init script which detects< D10.3
, and replaces it withchromeOptions
, but that seemed unnecessarily complicated.Manual Testing Instructions
Set up a drupal project in gitpod.
All the tests will be currently skipped due to the misconfigurations.
Related Issue Link(s)
N/A
Release/Deployment notes
N/A
Summary by CodeRabbit