protected function getFormBuildId() { // Ensure the hidden 'form_build_id' field is unique.
$this->
assertSession()->
elementsCount('xpath', '//input[@name="form_build_id"]', 1
);
return $this->
assertSession()->
hiddenFieldExists('form_build_id'
)->
getValue();
} /**
* Create a simple form, then submit the form via AJAX to change to it.
*/
public function testSimpleAJAXFormValue() { $this->
drupalGet('ajax_forms_test_get_form'
);
$build_id_initial =
$this->
getFormBuildId();
// Changing the value of a select input element, triggers an AJAX
// request/response. The callback on the form responds with three AJAX
// commands:
// - UpdateBuildIdCommand
// - HtmlCommand
// - DataCommand
$session =
$this->
getSession();
$session->
getPage()->
selectFieldOption('select', 'green'
);
// Wait for the DOM to update. The HtmlCommand will update