Fix Issue #3626907: Fix random failure in ThemeSettingsFormTest::testFormSettingsSubmissionHandler

Fixes a random failure in ThemeSettingsFormTest::testFormSettingsSubmissionHandler: Form hidden field with id|name|value "custom_logo[fids]" not found.

Seen in https://git.drupalcode.org/issue/drupal-3624887/-/jobs/12520251 and https://git.drupalcode.org/project/drupal/-/jobs/12026261.

Cause

pressButton('Save configuration') returns before the browser has loaded the page the form submits to. The custom_logo[fids] assertion that follows can run while the browser is between pages, so the field isn't found. It can also run on the page from before the submit, in which case the permanent-file check can run before the save has finished.

Changes

  • After pressing Save, wait for the "The configuration options have been saved." status message before asserting on the new page.
  • Assert that waitForButton('custom_logo_remove_button') found the button, so a slow upload fails at the upload step with a clear reason.

Verification

🔁 Repeat Class Test with REPEAT_TEST_CLASS=Drupal\Tests\system\FunctionalJavascript\ThemeSettingsFormTest, REPEAT_COUNT=100: (100/100 passed)

Closes #3626907

Edited by Matt Hand

Merge request reports

Loading
Loading