// Wait for the DOM to update.
$red_span =
$this->
assertSession()->
waitForElement('css', "#ajax_selected_color:contains('red')"
);
$this->
assertNotNull($red_span, 'DOM update: The selected color SPAN is red.'
);
// Confirm the operation of the UpdateBuildIdCommand.
$build_id_second_ajax =
$this->
getFormBuildId();
$this->
assertNotEquals($build_id_first_ajax,
$build_id_second_ajax, 'Build id changes on subsequent AJAX submissions'
);
// Emulate a push of the reload button and then repeat the test sequence
// this time with a page loaded from the cache.
$session->
reload();
$build_id_from_cache_initial =
$this->
getFormBuildId();
$this->
assertEquals($build_id_initial,
$build_id_from_cache_initial, 'Build id is the same as on the first request'
);
// Changing the value of a select input element, triggers an AJAX
// request/response.
$session->
getPage()->
selectFieldOption('select', 'green'
);
// Wait for the DOM to update.
$green_span2 =
$this->
assertSession()->
waitForElement('css', "#ajax_selected_color:contains('green')"
);
$this->
assertNotNull($green_span2, 'DOM update: After reload - the selected color SPAN is green.'
);