From 28154ee78f0a024c50fe950ed631586fc07baaa7 Mon Sep 17 00:00:00 2001 From: Pratik Joshi Date: Thu, 21 Mar 2013 15:22:45 +0530 Subject: [PATCH] webtest fix : using clickLink for ajax form save results in timeout error as, clickLink waits for page to load which doesn't happen in ajax form save. --- tests/phpunit/CiviTest/CiviSeleniumTestCase.php | 7 +++++-- tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index c90b66ade3..86a40dc2b3 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -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); } diff --git a/tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php b/tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php index 3784109498..176d6ff051 100644 --- a/tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php +++ b/tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php @@ -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'), -- 2.25.1