only in patch2: unchanged: --- a/core/tests/Drupal/Tests/BrowserTestBase.php +++ b/core/tests/Drupal/Tests/BrowserTestBase.php @@ -906,9 +906,13 @@ protected function submitForm(array $edit, $submit, $form_html_id = NULL) { // Ensure that any changes to variables in the other thread are picked up. $this->refreshVariables(); - // Log only for JavascriptTestBase tests because for Goutte we log with - // ::getResponseLogHandler. + // Actions only for JavascriptTestBase. if ($this->htmlOutputEnabled && !($this->getSession()->getDriver() instanceof GoutteDriver)) { + // Wait on AJAX requests to finish which might have been triggered on load. + $this->assertSession()->assertWaitOnAjaxRequest(); + + // Log only for JavascriptTestBase tests because for Goutte we log with + // ::getResponseLogHandler. $out = $this->getSession()->getPage()->getContent(); $html_output = 'POST request to: ' . $action . '
Ending URL: ' . $this->getSession()->getCurrentUrl();