Webtest Fix
authorJitendra Purohit <jitendra.purohit@webaccessglobal.com>
Thu, 4 Sep 2014 13:33:11 +0000 (19:03 +0530)
committerJitendra Purohit <jitendra.purohit@webaccessglobal.com>
Thu, 4 Sep 2014 13:33:11 +0000 (19:03 +0530)
tests/phpunit/CiviTest/CiviSeleniumTestCase.php
tests/phpunit/WebTest/Campaign/ActivityTest.php
tests/phpunit/WebTest/Campaign/MembershipTest.php
tests/phpunit/WebTest/Contact/AdvanceSearchPaneTest.php
tests/phpunit/WebTest/Contribute/AddPricesetTest.php
tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php

index e0110ef8b3836bec23fdd404305edfa6e69f821a..2de3b3cee144698edc1c5b20856dfd36a7d2b90a 100644 (file)
@@ -1868,12 +1868,12 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
 
     $this->click('_qf_FinancialType_next');
     if ($option == 'new') {
-      $text = "Your Financial '{$financialType['name']}' Type has been created, along with a corresponding income account '{$financialType['name']}'. That income account, along with standard financial accounts 'Accounts Receivable', 'Banking Fees' and 'Premiums' have been linked to the financial type. You may edit or replace those relationships here.";
+      $text = "Your Financial \"{$financialType['name']}\" Type has been created, along with a corresponding income account \"{$financialType['name']}\". That income account, along with standard financial accounts \"Accounts Receivable\", \"Banking Fees\" and \"Premiums\" have been linked to the financial type. You may edit or replace those relationships here.";
     }
     else {
       $text = "The financial type '{$financialType['name']}' has been saved.";
     }
-    $this->waitForText('crm-notification-container', $text);
+    $this->waitForText("xpath=//div[@class='notify-content']", $text);
   }
 
   /**
index 86194681527f2e5b8cc78072775f279260247d74..e314cdad044e69e79068208fd364a703ad1b4b8b 100644 (file)
@@ -92,9 +92,7 @@ class WebTest_Campaign_ActivityTest extends CiviSeleniumTestCase {
     $this->type("description", "This is a test campaign");
 
     // include groups for the campaign
-    $this->addSelection("includeGroups-f", "label=$groupName");
-    $this->click("//option[@value=4]");
-    $this->click("add");
+    $this->multiselect2("includeGroups", array("$groupName", "Advisory Board"));
 
     // fill the end date for campaign
     $this->webtestFillDate("end_date", "+1 year");
@@ -108,8 +106,8 @@ class WebTest_Campaign_ActivityTest extends CiviSeleniumTestCase {
 
     $this->waitForText('crm-notification-container', "Campaign $title");
 
-    $this->waitForElementPresent("//div[@id='campaignList']/div[@id='campaigns_wrapper']/table/tbody/tr/td[text()='{$campaignTitle}']/../td[1]");
-    $id = (int) $this->getText("//div[@id='campaignList']/div[@id='campaigns_wrapper']/table/tbody/tr/td[text()='{$campaignTitle}']/../td[1]");
+    $this->waitForElementPresent("//div[@id='campaignList']/div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[text()='{$campaignTitle}']/../td[1]");
+    $id = (int) $this->getText("//div[@id='campaignList']/div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[text()='{$campaignTitle}']/../td[1]");
     $this->activityAddTest($campaignTitle, $id);
   }
 
@@ -196,15 +194,14 @@ class WebTest_Campaign_ActivityTest extends CiviSeleniumTestCase {
     // Is status message correct?
     $this->waitForText('crm-notification-container', $subject);
 
-    $this->waitForElementPresent("
-    xpath=//table[@id='contact-activity-selector-activity']//tbody//tr[1]/td[8]/span/a[text()='View']");
+    $this->waitForElementPresent("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody/tr[1]/td[8]/span/a[text()='View']");
 
     // click through to the Activity view screen
-    $this->click("xpath=//table[@id='contact-activity-selector-activity']//tbody//tr[1]/td[8]/span/a[text()='View']");
+    $this->click("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody//tr[1]/td[8]/span/a[text()='View']");
     $this->waitForElementPresent('_qf_Activity_cancel-bottom');
 
     // verify Activity created
-    $this->verifyText("xpath=id('Activity')/div[2]/table[1]/tbody/tr[5]/td[2]/span", preg_quote($campaignTitle));
+    $this->waitForText("xpath=id('Activity')/div[2]/table[1]/tbody/tr[5]/td[2]/span", $campaignTitle);
   }
 }
 
index e5e7219b28d8aaad5ed56923fbffbc018327fcbe..ce9d06c8731049a2630801f4ee22fe2ab096e29f 100644 (file)
@@ -90,9 +90,7 @@ class WebTest_Campaign_MembershipTest extends CiviSeleniumTestCase {
     $this->type("description", "This is a test campaign");
 
     // include groups for the campaign
-    $this->addSelection("includeGroups-f", "label=$groupName");
-    $this->click("//option[@value=4]");
-    $this->click("add");
+    $this->multiselect2("includeGroups", array("$groupName", "Advisory Board"));
 
     // fill the end date for campaign
     $this->webtestFillDate("end_date", "+1 year");
@@ -106,8 +104,8 @@ class WebTest_Campaign_MembershipTest extends CiviSeleniumTestCase {
 
     $this->waitForText('crm-notification-container', "Campaign $title");
 
-    $this->waitForElementPresent("//div[@id='campaignList']/div[@id='campaigns_wrapper']/table/tbody/tr/td[text()='{$campaignTitle}']/../td[1]");
-    $id = (int) $this->getText("//div[@id='campaignList']/div[@id='campaigns_wrapper']/table/tbody/tr/td[text()='{$campaignTitle}']/../td[1]");
+    $this->waitForElementPresent("//div[@id='campaignList']/div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[text()='{$campaignTitle}']/../td[1]");
+    $id = (int) $this->getText("//div[@id='campaignList']/div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[text()='{$campaignTitle}']/../td[1]");
     $this->memberAddTest($campaignTitle, $id);
   }
 
index ae3e5aab7ed7919ee7ccff45aa7b1081fc6fac80..964d20d1a346b03d8e2364cd468c72e6d7471f0b 100644 (file)
@@ -151,6 +151,13 @@ class WebTest_Contact_AdvanceSearchPaneTest extends CiviSeleniumTestCase {
           }
           break;
 
+        case 'multiselect2':
+          foreach ($field['values'] as $op) {
+            $this->waitForVisible($fldLocator);
+            $this->multiselect2($fldLocator, $op);
+          }
+          break;
+
         case 'date':
           $this->webtestFillDate($fldLocator, current($field['values']));
           break;
@@ -177,8 +184,9 @@ class WebTest_Contact_AdvanceSearchPaneTest extends CiviSeleniumTestCase {
           array(
             'Location Type' =>
             array(
-              'type' => 'checkbox',
-              'values' => array('location_type[1]', 'location_type[2]'),
+              'type' => 'multiselect2',
+              'locator' => 'location_type',
+              'values' => array(array('Home', 'Work')),
             ),
             'Country' =>
             array(
@@ -188,9 +196,9 @@ class WebTest_Contact_AdvanceSearchPaneTest extends CiviSeleniumTestCase {
             ),
             'State' =>
             array(
-              'type' => 'select',
+              'type' => 'multiselect2',
               'locator' => 'state_province',
-              'values' => array('Alabama', 'California', 'New Jersey', 'New York'),
+              'values' => array(array('Alabama', 'California', 'New Jersey', 'New York')),
             ),
           ),
         ),
index 130b3c4b0b57888ee9061630a6feb60da7b3ae25..c579e79b0b878eb4d8f1c4147921829335323bc5 100644 (file)
@@ -92,7 +92,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase {
     $this->type('help_pre', $setHelp);
 
     $this->assertChecked('is_active', 'Verify that Is Active checkbox is set.');
-    $this->clickLink('_qf_Set_next-bottom', '_qf_Field_next-bottom');
+    $this->clickLink('_qf_Set_next-bottom', 'newPriceField');
   }
 
   /**
@@ -103,6 +103,8 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase {
    */
   function _testAddPriceFields(&$fields, &$validateString, $financialType, $dateSpecificFields = FALSE) {
     $validateStrings[] = $financialType;
+    $this->click('newPriceField');
+    $this->waitForElementPresent('label');
     foreach ($fields as $label => $type) {
       $validateStrings[] = $label;
 
@@ -177,7 +179,8 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase {
           break;
       }
       $this->select('financial_type_id', "label={$financialType}");
-      $this->clickLink('_qf_Field_next_new-bottom', '_qf_Field_next-bottom');
+      $this->clickLink('_qf_Field_next_new-bottom', '_qf_Field_next-bottom', FALSE);
+      $this->waitForText('crm-notification-container', "Price Field '$label' has been saved.");
     }
   }
 
index f44f03b44507f0219ffe6033f9224a1562c2c7f1..d9a9cea3e5b1d463a43c5a9ebd17329ac3ff706a 100755 (executable)
@@ -190,7 +190,7 @@ class WebTest_Member_DefaultMembershipPricesetTest extends CiviSeleniumTestCase
     $this->type('help_pre', $setHelp);
 
     $this->assertChecked('is_active', 'Verify that Is Active checkbox is set.');
-    $this->clickLink('_qf_Set_next-bottom', '_qf_Field_next-bottom');
+    $this->clickLink('_qf_Set_next-bottom', 'newPriceField');
     $this->assertTrue($this->isTextPresent("Your Set '{$setTitle}' has been added. You can add fields to this set now."));
   }
 
@@ -220,17 +220,17 @@ class WebTest_Member_DefaultMembershipPricesetTest extends CiviSeleniumTestCase
     elseif (!$defaultPriceSet) {
       $memTypeParams1 = $this->webtestAddMembershipType();
       $memTypeTitle1  = $memTypeParams1['membership_type'];
-      $memTypeId1     = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/div[1]/table/tbody//tr/td[text()='{$memTypeTitle1}']/../td[12]/span/a[3]@href"));
+      $memTypeId1     = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/table/tbody//tr/td[text()='{$memTypeTitle1}']/../td[12]/span/a[3]@href"));
       $memTypeId1     = $memTypeId1[1];
 
       $memTypeParams2 = $this->webtestAddMembershipType();
       $memTypeTitle2  = $memTypeParams2['membership_type'];
-      $memTypeId2     = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/div[1]/table/tbody//tr/td[text()='{$memTypeTitle2}']/../td[12]/span/a[3]@href"));
+      $memTypeId2     = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/table/tbody//tr/td[text()='{$memTypeTitle2}']/../td[12]/span/a[3]@href"));
       $memTypeId2     = $memTypeId2[1];
 
       $memTypeParams3 = $this->webtestAddMembershipType();
       $memTypeTitle3  = $memTypeParams3['membership_type'];
-      $memTypeId3     = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/div[1]/table/tbody//tr/td[text()='{$memTypeTitle3}']/../td[12]/span/a[3]@href"));
+      $memTypeId3     = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/table/tbody//tr/td[text()='{$memTypeTitle3}']/../td[12]/span/a[3]@href"));
       $memTypeId3     = $memTypeId3[1];
     }