webtest fix : using clickLink for ajax form save results in timeout error as, clickLi...
authorPratik Joshi <pratik.joshi@webaccess.co.in>
Thu, 21 Mar 2013 09:52:45 +0000 (15:22 +0530)
committerPratik Joshi <pratik.joshi@webaccess.co.in>
Thu, 21 Mar 2013 09:52:45 +0000 (15:22 +0530)
tests/phpunit/CiviTest/CiviSeleniumTestCase.php
tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php

index c90b66ade396c9bdb03fb1f38ad2c3268459bd15..86a40dc2b30e3d852b8ba5cfd426e374d2efc7f9 100644 (file)
@@ -165,9 +165,12 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
    * Wait for the page to load
    * Wait for an element to be present
    */
-  function clickLink($element, $waitFor = 'civicrm-footer') {
+  function clickLink($element, $waitFor = 'civicrm-footer', $waitForPageLoad = TRUE) {
     $this->click($element);
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    // conditional wait for page load e.g for ajax form save
+    if ($waitForPageLoad) {
+      $this->waitForPageToLoad($this->getTimeoutMsec());
+    }
     if ($waitFor) {
       $this->waitForElementPresent($waitFor);
     }
index 3784109498500b85b32d6ff2848bf418d6ff3555..176d6ff051ecce3066f26d4dac9d70b39a775300 100644 (file)
@@ -141,7 +141,7 @@ class WebTest_Contact_InlineFieldsEditTest extends CiviSeleniumTestCase {
     $this->type('organization_name', $orgName);
     $this->type('street_address-1', 'Test Org Street');
     $this->type('city-1', 'Test Org City');
-    $this->clickLink('_qf_Edit_next', 'selected_shared_address-2');
+    $this->clickLink('_qf_Edit_next', 'selected_shared_address-2', FALSE);
     $this->waitForTextPresent('Test Org Street');
     $this->inlineEdit('address-block-2', array(
       'address_2_location_type_id' => array('Work'),