With verbose output on, a drupalGet and drupalPost both show the HTML page that the internal testing browser is working with.

With a drupalPostAJAX, the verbose output shows the AJAX commands instead.

This means that the developer is left in the dark as to what the internal browser now sees.

This can be fixed with a second call to verbose(), with the updated content.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim’s picture

Status: Active » Needs review
FileSize
726 bytes
joachim’s picture

Patch for D7 which I'm uploading now so I don't lose it.

(This is obviously going to fail tests while the issue is set to the 8.x branch.)

Status: Needs review » Needs work

The last submitted patch, 2: 2182315.drupal-7.simpletest-post-ajax-verbose.patch, failed testing.

joachim’s picture

Status: Needs work » Needs review

Setting to needs review.

That patch that needs review is the one that passed tests :)

mondrake’s picture

Title: simpletest verbose output doesn't show end result of a drupalPostAJAX() » simpletest verbose output doesn't show end result of a drupalPostAjaxForm()
+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
@@ -1608,6 +1608,12 @@ protected function drupalPostAjaxForm($path, $edit, $triggering_element, $ajax_p
+    $verbose = 'AJAX POST request to: ' . $path;

I wonder whether it would make sense to show also the path to the Ajax controller to which the Ajax request was sent to, i.e. something like

    $verbose = 'AJAX POST request to: ' . $path;
    $verbose .= '<br />AJAX controller path: ' . $ajax_path;
    $verbose .= '<hr />Ending URL: ' . $this->getUrl();
    

Other than that, it looks good to me: with the patch we get two 'verbose' debug lines for each call to drupalPostAjaxForm, one with the Ajax response and one with the updated content, which I believe is a good insight.

joachim’s picture

FileSize
788 bytes

Done!

mondrake’s picture

Status: Needs review » Reviewed & tested by the community

Thank ypu!

catch’s picture

Version: 8.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed/pushed to 8.x, thanks!

joachim’s picture

Status: Patch (to be ported) » Needs review
Issue tags: -Needs backport to D7

The D7 patch should be ready to go :)

joachim’s picture

mondrake’s picture

Status: Needs review » Needs work

Well :)

The patch in #2 does not contain the changes introduced in #6 for D8... and BTW in this case I believe we should have an 'Ajax callback' instead of an 'Ajax controller'.

joachim’s picture

Status: Needs work » Needs review
FileSize
677 bytes

Reroll with the changes form the D8 patch.

mondrake’s picture

Status: Needs review » Reviewed & tested by the community

Looks good, thanks!

David_Rothstein’s picture

Status: Reviewed & tested by the community » Fixed

This still looks pretty odd (at least in Drupal 7) since there are now two separate verbose messages... and the second always seems to say "Ending URL: internal:" before printing the page content. Nonetheless, it's definitely an improvement over what was there before, so I committed it to 7.x - thanks!

  • Commit e25cbd6 on 7.x by David_Rothstein:
    Issue #2182315 by joachim: Simpletest verbose output doesn't show end...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.