fixed setting of soft credit for WebTest_Campaign_OfflineContributionTest
authorkurund <kurund@civicrm.org>
Mon, 12 Aug 2013 12:10:39 +0000 (17:40 +0530)
committerkurund <kurund@civicrm.org>
Mon, 12 Aug 2013 12:10:39 +0000 (17:40 +0530)
tests/phpunit/CiviTest/CiviSeleniumTestCase.php
tests/phpunit/WebTest/Campaign/OfflineContributionTest.php

index 31a9f126948d318113c8956cfc5b5365cc0c9802..108a931b0130cfb751edbb80f4cc31fe3f6ee75f 100644 (file)
@@ -360,13 +360,13 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
 
   /**
    */
-  function webtestFillAutocomplete($sortName) {
-    $this->click('contact_1');
-    $this->type('contact_1', $sortName);
-    $this->typeKeys('contact_1', $sortName);
+  function webtestFillAutocomplete($sortName, $fieldName = 'contact_1') {
+    $this->click($fieldName);
+    $this->type($fieldName, $sortName);
+    $this->typeKeys($fieldName, $sortName);
     $this->waitForElementPresent("css=div.ac_results-inner li");
     $this->click("css=div.ac_results-inner li");
-    $this->assertContains($sortName, $this->getValue('contact_1'), "autocomplete expected $sortName but didn’t find it in " . $this->getValue('contact_1'));
+    $this->assertContains($sortName, $this->getValue($fieldName), "autocomplete expected $sortName but didn’t find it in " . $this->getValue($fieldName));
   }
 
   /**
index ba68367564fc1b064fe8443ebe95b6ef78821b39..310c591f0c302842c423d125ba5f7d8d46f4d845 100644 (file)
@@ -168,10 +168,7 @@ class WebTest_Campaign_OfflineContributionTest extends CiviSeleniumTestCase {
     $this->type("trxn_id", "P20901X1" . rand(100, 10000));
 
     // soft credit
-    $this->click("soft_credit_contact_1");
-    $this->type("soft_credit_contact_1", $softCreditFname);
-    $this->typeKeys("soft_credit_contact_1", $softCreditFname);
-    $this->waitForElementPresent("soft_credit_amount_1");
+    $this->webtestFillAutocomplete("{$softCreditLname}, {$softCreditFname}", 'soft_credit_contact_1');
 
     //Additional Detail section
     $this->click("AdditionalDetail");