From 5b8ddc608104e4ebfaa140484927e9c3a466aafb Mon Sep 17 00:00:00 2001 From: Pratik Joshi Date: Wed, 15 May 2013 11:59:15 +0530 Subject: [PATCH] fix for CRM-12378 comment : WebTest_Member_StandaloneAddTest.testAjaxCustomGroupLoad was failing (https://test.civicrm.org/job/CiviCRM-4.3-WebTest-git/LABEL=ubuntu1204,SUITE=WebTest_AllTests/24/) --- tests/phpunit/CiviTest/CiviSeleniumTestCase.php | 6 +++++- .../WebTest/Campaign/CampaignDescriptionTest.php | 2 ++ tests/phpunit/WebTest/Member/StandaloneAddTest.php | 10 +++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index fac1e087cb..c44c8c1baa 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -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 diff --git a/tests/phpunit/WebTest/Campaign/CampaignDescriptionTest.php b/tests/phpunit/WebTest/Campaign/CampaignDescriptionTest.php index 76b977f1bf..ed5fb79ccd 100644 --- a/tests/phpunit/WebTest/Campaign/CampaignDescriptionTest.php +++ b/tests/phpunit/WebTest/Campaign/CampaignDescriptionTest.php @@ -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), diff --git a/tests/phpunit/WebTest/Member/StandaloneAddTest.php b/tests/phpunit/WebTest/Member/StandaloneAddTest.php index fab7c651e3..de6effe422 100644 --- a/tests/phpunit/WebTest/Member/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Member/StandaloneAddTest.php @@ -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 -- 2.25.1