[10.3] Test failure: The requested URL returned error: 400 Bad Request

Created on 8 July 2024, 9 months ago

HoneypotFileFieldTest fails when testing with core Drupal 10.3, but passes when testing with core Drupal 10.2.
See the test results at https://git.drupalcode.org/project/honeypot/-/pipelines/218383

I suspect this has something to do with one of the core dependencies that was changed between these minor point releases of core.
WebDriver, for example, changed major versions, from version 1.4.19 in Drupal 10.2 to 2.0.4 in Drupal 10.3.
But there were a lot of other dependency changes too, so I'm not sure.

Regardless, HoneypotFileFieldTest just extends the core FileFieldWidgetTest. The only thing we do differently is set some Honeypot configuration values in the setUp() method of our test, but the rest of the core test is left unchanged. That's why it's surprising that we get HTTP 400 errors when initializing the parent test.

I'm going to use the MR in this issue as a way to debug what is happening on GitLabCI.

📌 Task
Status

Active

Version

2.1

Component

Code

Created by

🇺🇸United States tr Cascadia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @tr
  • 🇺🇸United States tr Cascadia

    This is just plain weird. When I copy the core FileFieldWidgetTest into the Honeypot namespace, with no changes (other than the namespace of course), it FAILS in core 10.3 and PASSES in core 10.2.

    That just should not be - the core tests should always be working.

    The test failure looks like this:

        Drupal\Tests\honeypot\FunctionalJavascript\FileFieldWidgetTest::testMultiValuedWidget
        WebDriver\Exception\CurlExec: Curl error thrown for http POST to
        http://localhost:9515/session/181e9c672d5c7f455268ba88c9d7bb3f/element/f.6D1A3CEA6617A6A3D67277607608CB4F.d.043A063B0C99C792D2A1EA30A95FB313.e.13/click
        
        The requested URL returned error: 400 Bad Request
        
        /builds/project/honeypot/vendor/lullabot/php-webdriver/lib/WebDriver/Exception.php:198
        /builds/project/honeypot/web/core/tests/Drupal/FunctionalJavascriptTests/WebDriverCurlService.php:152
        /builds/project/honeypot/vendor/lullabot/php-webdriver/lib/WebDriver/AbstractWebDriver.php:170
        /builds/project/honeypot/vendor/lullabot/php-webdriver/lib/WebDriver/AbstractWebDriver.php:290
        /builds/project/honeypot/vendor/lullabot/php-webdriver/lib/WebDriver/Container.php:231
        /builds/project/honeypot/vendor/lullabot/mink-selenium2-driver/src/Selenium2Driver.php:847
        /builds/project/honeypot/vendor/lullabot/mink-selenium2-driver/src/Selenium2Driver.php:841
        /builds/project/honeypot/web/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php:122
        /builds/project/honeypot/web/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php:202
        /builds/project/honeypot/web/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php:133
        /builds/project/honeypot/vendor/behat/mink/src/Element/NodeElement.php:176
        /builds/project/honeypot/vendor/behat/mink/src/Element/NodeElement.php:186
        /builds/project/honeypot/web/core/tests/Drupal/Tests/UiHelperTrait.php:101
        /builds/project/honeypot/web/core/tests/Drupal/Tests/UiHelperTrait.php:161
        /builds/project/honeypot/tests/src/FunctionalJavascript/FileFieldWidgetTest.php:58
        /builds/project/honeypot/vendor/phpunit/phpunit/src/Framework/TestResult.php:729

    Line 58 of FileFieldWidgetTest is $this->drupalLogin($this->adminUser);

    The artifacts are no use in debugging this.

    Not sure what to do next ...

  • 🇺🇸United States tr Cascadia
  • 🇮🇳India chandu7929 Pune

    I ran the failing test locally on Drupal 10.3, and with PHP 8.3, I don't see any failure. I will run the complete suit to see if it fails.

    Running phpunit tests for xyz. 
    PHPUnit 9.6.19 by Sebastian Bergmann and contributors.
    
    Runtime:       PHP 8.3.7
    Configuration: /Users/chandan.singh/Sites/xyz/docroot/core/phpunit.xml
    Warning:       Your XML configuration validates against a deprecated schema.
    Suggestion:    Migrate your XML configuration using "--migrate-configuration"!
    
    Testing Drupal\Tests\honeypot\FunctionalJavascript\HoneypotFileFieldTest
    Test 'Drupal\Tests\honeypot\FunctionalJavascript\HoneypotFileFieldTest::testMultiValuedWidget' started
    Test 'Drupal\Tests\honeypot\FunctionalJavascript\HoneypotFileFieldTest::testMultiValuedWidget' ended
    Test 'Drupal\Tests\honeypot\FunctionalJavascript\HoneypotFileFieldTest::testSingleValuedWidget' started
    Test 'Drupal\Tests\honeypot\FunctionalJavascript\HoneypotFileFieldTest::testSingleValuedWidget' ended
    Test 'Drupal\Tests\honeypot\FunctionalJavascript\HoneypotFileFieldTest::testUploadingMoreFilesThanAllowed' started
    Test 'Drupal\Tests\honeypot\FunctionalJavascript\HoneypotFileFieldTest::testUploadingMoreFilesThanAllowed' ended
    
    
    Time: 02:02.167, Memory: 10.00 MB
    
    OK (3 tests, 78 assertions)
    
  • 🇮🇳India chandu7929 Pune

    Not sure whats causing this, but nothing is failing on my local.

    Time: 05:22.566, Memory: 20.00 MB
    
    OK (32 tests, 928 assertions)
    
  • 🇺🇸United States tr Cascadia

    Thanks for looking at this.

    The latest test results on GitLabCI still show the same results: Everything works in D10.2, but the above errors happen in D10.3. You can also see the same behavior in the MR test output above. I re-ran both just now (and I had run them a dozen times over a few days before opening this issue just to be sure it wasn't a temporary failure with GitLabCI.)

    https://git.drupalcode.org/project/honeypot/-/pipelines/223153
    https://git.drupalcode.org/project/honeypot/-/pipelines/218495

    In general, it doesn't matter if it works locally. If it doesn't run on GitLabCI using the controlled environment, then there's a problem.

  • 🇺🇸United States mark_fullmer Tucson

    suspect this has something to do with one of the core dependencies that was changed between these minor point releases of core.
    WebDriver, for example, changed major versions, from version 1.4.19 in Drupal 10.2 to 2.0.4 in Drupal 10.3.
    But there were a lot of other dependency changes too, so I'm not sure.

    I can confirm that changes between the drupal/core-dev library are responsible for this.

    On my setup, all FunctionalJavascript tests fail with the error reported here on drupal/core-dev 10.3.1.

    Downgrading drupal/core-dev (10.3.1 => 10.1.8) resolves the issue.

    There is this change record associated with Drupal 10.3, but for me at least, simply updating the indicated syntax does not fix the issue: https://www.drupal.org/node/3422624

  • 🇺🇸United States mark_fullmer Tucson

    Based on the comment in #8, I think this issue should be transferred to the Drupal core issue queue, as this is reproducible outside of the Honeypot module.

  • 🇺🇸United States mark_fullmer Tucson

    Further narrowing the root cause, it appears that the resulting change is due to switching from behat & instaclick to lullabot:

    ## Works
    - instaclick/php-webdriver (1.4.19)
    - behat/mink-selenium2-driver (v1.7.0)

    ## Breaks
    lullabot/php-webdriver (v2.0.5)
    lullabot/mink-selenium2-driver (v1.7.3)

    This led me to https://www.drupal.org/project/drupal/issues/3458751 🐛 Drupal 10.3.x regression running JS tests using ddev - update lullabot/php-webdriver Fixed , which seems related, but simply updating to core-dev 10.3.x-dev does not resolve the issue. The immediate workaround is to stay on drupal/core-dev ~10.2.0

  • 🇺🇸United States mark_fullmer Tucson

    Update: I was able to get this working with drupal/core-dev 10.3 by adding "w3c":false and changing chromeOptions to goog:chromeOptions. See https://git.drupalcode.org/project/drupal/-/commit/ec1aa07ac86f7d6f84bf7...

  • 🇺🇸United States tr Cascadia

    So, the core issue for that commit you linked in #11 is 📌 Use lullabot/mink-selenium2-driver and lullabot/php-webdriver for functional browser testing Fixed

    The GitLabCI template include files were changed in response to that core issue: #3423154: Change chromedriver for the new one used by core.

    The changes that were made are shown here:
    https://git.drupalcode.org/project/gitlab_templates/-/commit/d814dac179d...

    Could this just be a case that the include file wasn't completely updated to reflect the changes made in core? If so this would be a bug for the GitLabCI templates project ...

    Thanks for looking into this!

  • Status changed to Closed: outdated 6 months ago
  • 🇺🇸United States tr Cascadia

    This issue hasn't re-appeared. I'm going to attribute it to some transient problem with the testbot. Regardless, this project has run hundreds of pipelines over the past few months with no further occurrences of this error, so I'm closing this as "outdated".

    If the problem occurs again, feel free to re-open the issue.

Production build 0.71.5 2024