X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Ftests%2FDrupal%2FFunctionalJavascriptTests%2FAjax%2FAjaxFormPageCacheTest.php;fp=web%2Fcore%2Ftests%2FDrupal%2FFunctionalJavascriptTests%2FAjax%2FAjaxFormPageCacheTest.php;h=5a167f729cb92263eed2968543ec0f9a70afc4ef;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hp=3d174b04df1325c9f1429645fa66479cad0ee01f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c;p=yaffs-website diff --git a/web/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php b/web/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php index 3d174b04d..5a167f729 100644 --- a/web/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php +++ b/web/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php @@ -2,14 +2,14 @@ namespace Drupal\FunctionalJavascriptTests\Ajax; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * Performs tests on AJAX forms in cached pages. * * @group Ajax */ -class AjaxFormPageCacheTest extends JavascriptTestBase { +class AjaxFormPageCacheTest extends WebDriverTestBase { /** * {@inheritdoc} @@ -41,7 +41,6 @@ class AjaxFormPageCacheTest extends JavascriptTestBase { */ public function testSimpleAJAXFormValue() { $this->drupalGet('ajax_forms_test_get_form'); - $this->assertEquals($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', 'Page was not cached.'); $build_id_initial = $this->getFormBuildId(); // Changing the value of a select input element, triggers a AJAX @@ -55,8 +54,8 @@ class AjaxFormPageCacheTest extends JavascriptTestBase { // Wait for the DOM to update. The HtmlCommand will update // #ajax_selected_color to reflect the color change. - $green_div = $this->assertSession()->waitForElement('css', "#ajax_selected_color div:contains('green')"); - $this->assertNotNull($green_div, 'DOM update: The selected color DIV is green.'); + $green_span = $this->assertSession()->waitForElement('css', "#ajax_selected_color:contains('green')"); + $this->assertNotNull($green_span, 'DOM update: The selected color SPAN is green.'); // Confirm the operation of the UpdateBuildIdCommand. $build_id_first_ajax = $this->getFormBuildId(); @@ -67,8 +66,8 @@ class AjaxFormPageCacheTest extends JavascriptTestBase { $session->getPage()->selectFieldOption('select', 'red'); // Wait for the DOM to update. - $red_div = $this->assertSession()->waitForElement('css', "#ajax_selected_color div:contains('red')"); - $this->assertNotNull($red_div, 'DOM update: The selected color DIV is red.'); + $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(); @@ -77,7 +76,6 @@ class AjaxFormPageCacheTest extends JavascriptTestBase { // Emulate a push of the reload button and then repeat the test sequence // this time with a page loaded from the cache. $session->reload(); - $this->assertEquals($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.'); $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'); @@ -86,8 +84,8 @@ class AjaxFormPageCacheTest extends JavascriptTestBase { $session->getPage()->selectFieldOption('select', 'green'); // Wait for the DOM to update. - $green_div2 = $this->assertSession()->waitForElement('css', "#ajax_selected_color div:contains('green')"); - $this->assertNotNull($green_div2, 'DOM update: After reload - the selected color DIV is green.'); + $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.'); $build_id_from_cache_first_ajax = $this->getFormBuildId(); $this->assertNotEquals($build_id_from_cache_initial, $build_id_from_cache_first_ajax, 'Build id is changed in the simpletest-DOM on first AJAX submission'); @@ -98,8 +96,8 @@ class AjaxFormPageCacheTest extends JavascriptTestBase { $session->getPage()->selectFieldOption('select', 'red'); // Wait for the DOM to update. - $red_div2 = $this->assertSession()->waitForElement('css', "#ajax_selected_color div:contains('red')"); - $this->assertNotNull($red_div2, 'DOM update: After reload - the selected color DIV is red.'); + $red_span2 = $this->assertSession()->waitForElement('css', "#ajax_selected_color:contains('red')"); + $this->assertNotNull($red_span2, 'DOM update: After reload - the selected color SPAN is red.'); $build_id_from_cache_second_ajax = $this->getFormBuildId(); $this->assertNotEquals($build_id_from_cache_first_ajax, $build_id_from_cache_second_ajax, 'Build id changes on subsequent AJAX submissions'); @@ -115,7 +113,9 @@ class AjaxFormPageCacheTest extends JavascriptTestBase { $this->drupalGet('ajax_validation_test'); // Changing the value of the textfield will trigger an AJAX // request/response. - $this->getSession()->getPage()->fillField('drivertext', 'some dumb text'); + $field = $this->getSession()->getPage()->findField('drivertext'); + $field->setValue('some dumb text'); + $field->blur(); // When the AJAX command updates the DOM a