CRM-18454: webtest fixes
authorjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Tue, 26 Apr 2016 13:19:18 +0000 (18:49 +0530)
committerjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Tue, 26 Apr 2016 13:21:20 +0000 (18:51 +0530)
CRM-18454: webtest fixes

tests/phpunit/CiviTest/CiviSeleniumTestCase.php
tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php
tests/phpunit/WebTest/Case/AddCaseTest.php
tests/phpunit/WebTest/Contact/CustomDataAddTest.php
tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php
tests/phpunit/WebTest/Contribute/PCPAddTest.php
tests/phpunit/WebTest/Contribute/StandaloneAddTest.php
tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php

index 4fb2fda525742f8a1352775ea372cc83c511d211..e2da3a3c16bf7389954eb6c064321f7d3933fd41 100644 (file)
@@ -627,6 +627,8 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
       $tableLocator = "[@id='$tableId']";
     }
     foreach ($expected as $label => $value) {
+      //assertContains() accepts param as string
+      $value = "$value";
       if ($xpathPrefix) {
         $this->waitForElementPresent("xpath=//table{$tableLocator}/tbody/tr/td{$xpathPrefix}[text()='{$label}']/../following-sibling::td");
         $this->assertElementContainsText("xpath=//table{$tableLocator}/tbody/tr/td{$xpathPrefix}[text()='{$label}']/../following-sibling::td", $value);
index 525d85bcf3f472f90c3e98c806a583eb35ce6d84..39ea8db29954f2af1bbfe95ff7a504136f28a17c 100644 (file)
@@ -145,7 +145,7 @@ class WebTest_ACL_AssignUsersToRolesTest extends CiviSeleniumTestCase {
     $smartGroupTitle = "SmartGroup" . substr(sha1(rand()), 0, 4);
     $this->type("title", $smartGroupTitle);
     $this->clickLink("_qf_SaveSearch_next-bottom");
-    $this->waitForText('crm-notification-container', "Your smart group has been saved as \'$smartGroupTitle\'");
+    $this->waitForText('crm-notification-container', "Your smart group has been saved as '$smartGroupTitle'");
 
     //Create ACL role
     $this->openCiviPage("admin/options/acl_role", "reset=1", "xpath=//a[@class='button new-option']");
index 379664e09f8625c12665a4e090684cfdf038c4ef..6c4bb2d6be1749ec37c81fe357faf0425193493a 100644 (file)
@@ -195,7 +195,7 @@ class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent("xpath=//table[@id='caseRoles-selector-$id']/tbody/tr[4]/td[2]/a");
     // check that expected roles are listed in the Case Roles pane
     foreach ($caseRoles as $role) {
-      $this->assertElementContainsText("xpath=//table[@id='caseRoles-selector-$id']/tbody/tr[4]/td[1]", $role);
+      $this->assertElementContainsText("css=div.crm-case-roles-block", $role);
     }
     // check that case creator role has been assigned to logged in user
     $this->assertElementContainsText("xpath=//table[@id='caseRoles-selector-$id']/tbody/tr[4]/td[2]", $creatorName);
@@ -208,7 +208,7 @@ class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase {
     $id = $this->urlArg('id');
     // check that expected auto-created activities are listed in the Case Activities table
     foreach ($activityTypes as $aType) {
-      $this->assertText("case_id_$id", $aType);
+      $this->assertElementContainsText("case_id_$id", $aType);
     }
   }
 
@@ -219,7 +219,7 @@ class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase {
   public function _testVerifyOpenCaseActivity($subject, $openCaseData) {
     $id = $this->urlArg('id');
     // check that open case subject is present
-    $this->assertText("case_id_$id", $subject);
+    $this->assertElementContainsText("case_id_$id", $subject);
     // click open case activity pop-up dialog
     $this->click("xpath=//table[@id='case_id_{$id}']/tbody//tr/td[2]/div[text()='{$subject}']/../../td[8]/a[text()='View']");
     $this->waitForElementPresent("ActivityView");
index 1c3d2b1dccfab9606dd653a4bbbab969df2efcad..bb0b27ad0cba0aaa8f7c8661edddc912dd48656a 100644 (file)
@@ -232,7 +232,7 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase {
 
     //verify the money custom field value in the proper format
     $this->assertTrue($this->isElementPresent("xpath=//div[@id='custom-set-content-{$customFieldsetId}']/div/div[2]/div[2]"));
-    $this->verifyText("xpath=//div[@id='custom-set-content-{$customFieldsetId}']/div/div[2]/div[2]", '12,345,678.98');
+    $this->assertElementContainsText("xpath=//div[@id='custom-set-content-{$customFieldsetId}']/div/div[2]/div[2]", '12,345,678.98');
   }
 
   public function testCustomDataChangeLog() {
index 377e79fde7823d664d1576fac9f745a2371ec4b6..9263fade25c051c831f97d973a3cd2b553a27d0e 100644 (file)
@@ -259,8 +259,9 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent("financial_type_id");
     $this->type("sort_name", $firstName);
     $this->select('financial_type_id', "label=Donation");
-    $this->clickLink('_qf_Search_refresh', "xpath=//table[@class='selector row-highlight']/tbody/tr/td[10]/span//a[text()='View']", FALSE);
-    $this->click("xpath=//div[@id='contributionSearch']/table[@class='selector row-highlight']/tbody/tr/td[10]/span//a[text()='View']");
+    $this->clickLink('_qf_Search_refresh', "xpath=//table[@class='selector row-highlight']/tbody/tr/td[4][text()='Donation']/../td[10]/span//a[text()='View']", FALSE);
+    $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr/td[4][text()='Donation']/../td[10]/span//a[text()='View']");
+    $this->waitForElementPresent("xpath=//table/tbody/tr/td[text()='From']/following-sibling::td");
     $this->waitForAjaxContent();
     $expected = array(
       'From' => "{$firstName} {$lastName}",
index 8f903f2532613058fa95ae3fe38ff9b88c63d2fb..8b9d9eb642065fd131e9cb8308eaa4eb3acc6c82 100644 (file)
@@ -203,8 +203,8 @@ class WebTest_Contribute_PCPAddTest extends CiviSeleniumTestCase {
 
     // Check PCP Summary Report
     $this->openCiviPage('report/instance/17', 'reset=1');
-    $this->verifyText("PCP", preg_quote($pcpTitle));
-    $this->verifyText("PCP", preg_quote("{$lastName}, {$firstName}"));
+    $this->assertElementContainsText("PCP", $pcpTitle);
+    $this->assertElementContainsText("PCP", "{$lastName}, {$firstName}");
   }
 
 }
index 5b67c6c1c0590e82a016df582a93a34fac6be136..70f39ac2cd79e8bfe0e47df10d29da88d33563fb 100644 (file)
@@ -225,7 +225,7 @@ class WebTest_Contribute_StandaloneAddTest extends CiviSeleniumTestCase {
     $this->select("financial_type_id", "label={$financialType['name']}");
     $this->clickLink("_qf_Search_refresh");
     $this->assertElementContainsText("xpath=//div[@class='crm-content-block']//div[@id='search-status']/table/tbody/tr[1]/td[1]", "2 Result");
-    $this->assertElementContainsText("xpath=//div[@class='crm-content-block']//div[@id='search-status']/table/tbody/tr[1]/td[2]", "Financial Type ID In {$financialType['name']}");
+    $this->assertElementContainsText("xpath=//div[@class='crm-content-block']//div[@id='search-status']/table/tbody/tr[1]/td[2]", "Financial Type In {$financialType['name']}");
 
     $this->openCiviPage("contact/search/advanced", "reset=1", "_qf_Advanced_refresh-top");
     $this->clickAjaxLink('CiviContribute', "financial_type_id");
@@ -234,7 +234,7 @@ class WebTest_Contribute_StandaloneAddTest extends CiviSeleniumTestCase {
     $this->select("financial_type_id", "label={$financialType['name']}");
     $this->clickLink("_qf_Advanced_refresh-top");
     $this->assertElementContainsText("xpath=//div[@class='crm-content-block']//div[@id='search-status']//table/tbody/tr[1]/td[1]", "2 Contacts");
-    $this->assertElementContainsText("xpath=//div[@class='crm-content-block']//div[@id='search-status']//table/tbody/tr[1]/td[2]", "Financial Type ID In {$financialType['name']}");
+    $this->assertElementContainsText("xpath=//div[@class='crm-content-block']//div[@id='search-status']//table/tbody/tr[1]/td[2]", "Financial Type In {$financialType['name']}");
   }
 
   /**
index 953b2a2aa249d58b338e531b4d42b79aa3983709..8ebd8dc4296438a33e2c252ef04a3297e00161c6 100644 (file)
@@ -93,8 +93,8 @@ class WebTest_Contribute_UpdateBatchPendingContributionTest extends CiviSelenium
     // Search the participants
     $this->openCiviPage("event/search", "reset=1", '_qf_Search_refresh');
 
-    $eventName = 'Rain';
-    $this->select2("event_id", $eventName);
+    $eventName = 'Rain-forest Cup Youth Soccer Tournament';
+    $this->select2("event_id", $eventName, TRUE);
     $this->click('_qf_Search_refresh');
 
     $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low");