Problem/Motivation
#2942900: Convert JavascriptTestBase Tests to use DrupalSelenium2Driver introduced \Drupal\FunctionalJavascriptTests\WebDriverCurlService
.
That extends \WebDriver\Service\CurlService
, which was recently updated to not send
$customHeaders[] = 'Content-Length: 0';
but
$customHeaders[] = 'Content-Length: 0';
// Suppress "Transfer-Encoding: chunked" header automatically added by cURL that
// causes a 400 bad request (bad content-length).
$customHeaders[] = 'Transfer-Encoding:';
Drupal's subclass does not do that, and hence results in errors like this:
1) Drupal\Tests\media\FunctionalJavascript\CKEditorIntegrationTest::testPreviewUsesDefaultThemeAndIsClientCacheable
WebDriver\Exception\CurlExec: Curl error thrown for http POST to http://localhost:4444/wd/hub/session/96b11bb539709524afdbb8393ed07e6c/element/0.8283755658968526-1/click
The requested URL returned error: 400 Bad Content-Length
/Users/wim.leers/Work/d8/vendor/instaclick/php-webdriver/lib/WebDriver/Exception.php:155
/Users/wim.leers/Work/d8/core/tests/Drupal/FunctionalJavascriptTests/WebDriverCurlService.php:107
/Users/wim.leers/Work/d8/vendor/instaclick/php-webdriver/lib/WebDriver/AbstractWebDriver.php:123
/Users/wim.leers/Work/d8/vendor/instaclick/php-webdriver/lib/WebDriver/AbstractWebDriver.php:218
/Users/wim.leers/Work/d8/vendor/instaclick/php-webdriver/lib/WebDriver/Container.php:224
/Users/wim.leers/Work/d8/vendor/behat/mink-selenium2-driver/src/Selenium2Driver.php:781
/Users/wim.leers/Work/d8/vendor/behat/mink-selenium2-driver/src/Selenium2Driver.php:769
/Users/wim.leers/Work/d8/vendor/behat/mink/src/Element/NodeElement.php:153
/Users/wim.leers/Work/d8/vendor/behat/mink/src/Element/NodeElement.php:161
/Users/wim.leers/Work/d8/core/tests/Drupal/Tests/UiHelperTrait.php:100
/Users/wim.leers/Work/d8/core/tests/Drupal/Tests/UiHelperTrait.php:250
/Users/wim.leers/Work/d8/core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php:153
This happens with:
- PHP 7.3.9
- Chrome 77
- chromedriver 77
instaclick/php-webdriver
1.4.5 and 1.4.6 (meaning that unlike what https://www.previousnext.com.au/blog/how-fix-webdriver-http-error-400-ba... says, updating that dependency does not fix things)
Proposed resolution
Port the upstream changes.