fix for CRM-12378 comment : WebTest_Member_StandaloneAddTest.testAjaxCustomGroupLoad...
authorPratik Joshi <pratik.joshi@webaccess.co.in>
Wed, 15 May 2013 06:29:15 +0000 (11:59 +0530)
committerPratik Joshi <pratik.joshi@webaccess.co.in>
Wed, 15 May 2013 06:29:15 +0000 (11:59 +0530)
tests/phpunit/CiviTest/CiviSeleniumTestCase.php
tests/phpunit/WebTest/Campaign/CampaignDescriptionTest.php
tests/phpunit/WebTest/Member/StandaloneAddTest.php

index fac1e087cb32db698d386016d40e653e72c81c4d..c44c8c1baa12dabc563c5bfca37b82b1893c88ee 100644 (file)
@@ -1821,9 +1821,10 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
 
                                      which uses the entity info as its selection value
    * @param array  $pageUrl          the url which on which the ajax custom group load takes place
+   * @param $beforeTriggering        code to execute before actual element triggering
    * @return void
    */
-  function customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl) {
+  function customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl, $beforeTriggering = NULL) {
     //add the custom set
     $return = $this->addCustomGroupField($customSets);
 
@@ -1835,6 +1836,9 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
         list($entity, $entityData) = explode('_', $entityType);
         $elementType = CRM_Utils_Array::value('type', $customData['triggerElement'], 'select');
         $elementName = CRM_Utils_Array::value('name', $customData['triggerElement']);
+        if ($beforeTriggering) {
+          call_user_func($beforeTriggering);
+        }
         if ($elementType == 'select') {
           //reset the select box, so triggering of ajax only happens
           //WRT input of value in this function
index 76b977f1bff84d69da1803d1789412dbb8320a52..ed5fb79ccd153776af1cc3821548fd9bda45190b 100644 (file)
@@ -85,6 +85,8 @@ class WebTest_Campaign_CampaignDescriptionTest extends CiviSeleniumTestCase {
 
   function testAjaxCustomGroupLoad() {
     $this->webtestLogin();
+
+    $this->enableComponents(array('CiviCampaign'));
     $triggerElement = array('name' => 'campaign_type_id', 'type' => 'select');
     $customSets = array(
       array('entity' => 'Campaign', 'subEntity' => 'Referral Program', 'triggerElement' => $triggerElement),
index fab7c651e362700803f7464873dd8c75545b05fc..de6effe4227eebbaa821c1b0a6d315222b6367b4 100644 (file)
@@ -171,6 +171,14 @@ class WebTest_Member_StandaloneAddTest extends CiviSeleniumTestCase {
     );
 
     $pageUrl = array('url' => 'member/add', 'args' => 'reset=1&action=add&context=standalone');
-    $this->customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl);
+
+    //case where we should fire certain
+    //ui actions which helps triggering possible
+    $test = $this;
+    $this->customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl,
+      function() use ($test) {
+        $test->select('membership_type_id_0', 'value=1');
+      }
+    );
   }
 }
\ No newline at end of file