Web Test Fix 4.5alpha1
authorjitendrapurohit <jitendra.purohit@webaccess.co.in>
Thu, 15 May 2014 13:35:57 +0000 (19:05 +0530)
committerjitendrapurohit <jitendra.purohit@webaccess.co.in>
Thu, 15 May 2014 13:35:57 +0000 (19:05 +0530)
tests/phpunit/WebTest/Contact/ContactReferenceFieldTest.php
tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php
tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php
tests/phpunit/WebTest/Event/AddParticipationTest.php
tests/phpunit/WebTest/Member/FixedMembershipTypeTest.php
tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php

index f0b795f26c8e9042d7555e1352725fc25966e39c..ff586fcbf7991d529f817f7f3581ee12742b211d 100644 (file)
@@ -121,7 +121,7 @@ class WebTest_Contact_ContactReferenceFieldTest extends CiviSeleniumTestCase {
     $this->click("xpath=//form[@id='Field']//a[text()='Advanced Filter']");
     $this->waitForElementPresent("filter");
 
-    $this->type("filter", "action=lookup&contact_type=Organization");
+    $this->type("filter", "action=get&contact_type=Organization");
 
     //clicking save
     $this->click("_qf_Field_next-bottom");
@@ -147,20 +147,22 @@ class WebTest_Contact_ContactReferenceFieldTest extends CiviSeleniumTestCase {
     // Visit custom group preview page
     $this->openCiviPage('admin/custom/group', "action=preview&reset=1&id={$customGroupId}");
 
-    $this->type("custom_{$contactRefFieldID1}_-1", "Anderson");
-    $this->fireEvent("custom_{$contactRefFieldID1}_-1", "focus");
-    $this->click("custom_{$contactRefFieldID1}_-1");
-    $this->waitForElementPresent("css=div.ac_results-inner li");
-    $this->assertElementContainsText("css=div.ac_results-inner li", "{$contact1}@example.com");
-    $this->assertElementNotContainsText("css=div.ac_results-inner ul li", "{$contact2}@example.com");
+    $this->clickAt("//*[@id='custom_{$contactRefFieldID1}_-1']/../div/a");
+    $this->keyDown("//*[@id='select2-drop']/div/input", " ");
+    $this->type("//*[@id='select2-drop']/div/input", "Anderson");
+    $this->typeKeys("//*[@id='select2-drop']/div/input", "Anderson");
+    $this->waitForElementPresent("css=div.select2-result-label span");
+    $this->assertElementContainsText("css=div.select2-result-label", "{$contact1}@example.com");
+    $this->assertElementNotContainsText("css=div.select2-result-label", "{$contact2}@example.com");
 
     $this->openCiviPage('admin/custom/group', "action=preview&reset=1&id={$customGroupId}");
 
-    $this->type("custom_{$contactRefFieldID2}_-1", $org1);
-    $this->fireEvent("custom_{$contactRefFieldID2}_-1", "focus");
-    $this->click("custom_{$contactRefFieldID2}_-1");
-    $this->waitForElementPresent("css=div.ac_results-inner li");
-    $this->assertElementContainsText("css=div.ac_results-inner li", "{$org1}@example.com");
+    $this->clickAt("//*[@id='custom_{$contactRefFieldID2}_-1']/../div/a");
+    $this->keyDown("//*[@id='select2-drop']/div/input", " ");
+    $this->type("//*[@id='select2-drop']/div/input", $org1);
+    $this->typeKeys("//*[@id='select2-drop']/div/input", $org1);
+    $this->waitForElementPresent("css=div.select2-result-label");
+    $this->assertElementContainsText("css=div.select2-result-label", "{$org1}@example.com");
   }
 }
 
index ab9a07ca1e62f85f1005efaf31a600e2b93f90e8..9648b8df42d2dd520af90bacf5282cb7d6ff37ac 100644 (file)
@@ -88,7 +88,7 @@ class WebTest_Contact_TaskActionAddToGroupTest extends CiviSeleniumTestCase {
 
     // Search by group membership in newly created group
     $this->openCiviPage('contact/search/advanced', 'reset=1');
-    $this->select("crmasmSelect1", "label=" . $newGroupName);
+    $this->select("group", "label=" . $newGroupName);
     $this->click("_qf_Advanced_refresh");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
@@ -114,10 +114,10 @@ class WebTest_Contact_TaskActionAddToGroupTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     $this->type("xpath=//*[@id='Basic-rows-per-page-select']", '25');
-    $this->waitForElementPresent("xpath=//*[@id='Basic-rows-per-page-select']");
+    $this->waitForElementPresent("toggleSelect");
     $this->click("toggleSelect");
     $this->click("xpath=//div[@class='crm-content-block']/div/div[2]/div/span[2]/a");
-    $this->waitForElementPresent("Go");
+    $this->waitForText("xpath=//div[@class='crm-content-block']/div/div[2]/div/span[2]/a", "First");
     $this->click("toggleSelect");
     $this->select("task", "label=Add Contacts to Group");
     $this->click("Go");
@@ -134,7 +134,7 @@ class WebTest_Contact_TaskActionAddToGroupTest extends CiviSeleniumTestCase {
     $this->waitForText('crm-notification-container', "50 contacts added to group");
 
     $this->openCiviPage('contact/search/advanced', 'reset=1');
-    $this->select("crmasmSelect1", "label=" . $newGroupName);
+    $this->select("group", "label=" . $newGroupName);
     $this->click("_qf_Advanced_refresh");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
index 338558e78c9f7cf16200e0fd844a70f3b9938a2c..56204097ff0e4e80ec790bc60f7d0f5547829ab0 100644 (file)
@@ -157,6 +157,7 @@ class WebTest_Contribute_UpdatePendingContributionTest extends CiviSeleniumTestC
     // go to soft creditor contact view page - this also does the soft credit check
     $this->click("xpath=id('ContributionView')/div[2]/div/div[1][contains(text(), 'Soft Credit')]/../div[2]/table[1]/tbody//tr/td[1]/a[contains(text(), '{$softCreditFname} {$softCreditLname}')]");
 
+    $this->waitForPageToLoad($this->getTimeoutMsec());
     // go to contribution tab
     $this->waitForElementPresent("css=li#tab_contribute a");
     $this->click("css=li#tab_contribute a");
@@ -249,7 +250,7 @@ class WebTest_Contribute_UpdatePendingContributionTest extends CiviSeleniumTestC
 
     $this->type("sort_name", "$lastName, $firstName");
     $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[2]/td[11]/span/a[text()='View']");
-    $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[2]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom");
+    $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[2]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom", FALSE);
     // View Contribution Record and test for expected values
     $expected = array(
       'From' => "{$firstName} {$lastName}",
index ee4852bb94498413766e19ac43175ab219eb7cfe..7b121372927c65c55c7ab92f74830e042b022f0c 100644 (file)
@@ -248,7 +248,7 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent("xpath=//div[@class='crm-customData-block']//div[@class='custom-group custom-group-$customGroupTitle crm-accordion-wrapper collapsed']");
     $this->click("xpath=//div[@class='crm-customData-block']//div[@class='custom-group custom-group-$customGroupTitle crm-accordion-wrapper collapsed']//div[1]");
     $this->click("xpath=//div[@class='crm-customData-block']//div[@class='custom-group custom-group-$customGroupTitle crm-accordion-wrapper']//div[2]//table//tbody//tr[2]//td[2]//table//tbody//tr[1]//td[1]//label");
-    $this->click("xpath=//div[@class='crm-customData-block']//sdiv[@class='custom-group custom-group-$customGroupTitle crm-accordion-wrapper']//div[2]//table//tbody//tr[4]//td[2]//table//tbody//tr[1]//td[1]//label");
+    $this->click("xpath=//div[@class='crm-customData-block']//div[@class='custom-group custom-group-$customGroupTitle crm-accordion-wrapper']//div[2]//table//tbody//tr[4]//td[2]//table//tbody//tr[1]//td[1]//label");
 
     // Choose Registration Date.
     // Using helper webtestFillDate function.
@@ -313,12 +313,12 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase {
       array(
         'From' => $displayName,
         'Financial Type' => 'Event Fee',
-        'Total Amount' => '$ 800.00',
         'Contribution Status' => 'Completed',
         'Paid By' => 'Check',
         'Check Number' => '1044',
       )
     );
+    $this->verifyText("xpath=//table/tbody/tr/td[text()='Total Amount']/following-sibling::td/strong", preg_quote('$ 800.00'), 'In line ' . __LINE__);
   }
 
   function testEventAddMultipleParticipants() {
index 68e3e92a94e60b91db3a061af49a6c4623d9d201..52b6de6d5e809c0b6854a740e68f386e066542f3 100644 (file)
@@ -161,11 +161,11 @@ SELECT end_event_adjust_interval
 
     // Clicking save.
     $this->click('_qf_Membership_upload');
-    $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // page was loaded
     $this->waitForTextPresent($sourceText);
 
+    $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
     // Is status message correct?
     $this->assertTrue($this->isTextPresent("Membership Type $title membership for $firstName $lastName has been added."),
       "Status message didn't show up after saving!"
@@ -317,7 +317,7 @@ SELECT end_event_adjust_interval
 
     // Clicking save.
     $this->click('_qf_Membership_upload');
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
 
     // page was loaded
     $this->waitForTextPresent($sourceText);
@@ -466,7 +466,7 @@ SELECT end_event_adjust_interval
 
     // Clicking save.
     $this->click('_qf_Membership_upload');
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
 
     // page was loaded
     $this->waitForTextPresent($sourceText);
@@ -617,7 +617,7 @@ SELECT end_event_adjust_interval
 
     // Clicking save.
     $this->click('_qf_Membership_upload');
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
 
     // page was loaded
     $this->waitForTextPresent($sourceText);
index fcf49e94430ec5a7fd0fd95b3aa5ac363350b05e..719dca4164e5bf8ad253492561de1285dfa21863 100644 (file)
@@ -406,7 +406,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent('link=Add Membership Type');
     $this->waitForText('crm-notification-container', "The membership type 'Membership Type $title' has been saved.");
 
-    $url = $this->getAttribute("xpath=//div[@id='membership_type']//div[@class='dataTables_wrapper']//table/tbody//tr/td[1][text()='{$membershipTypeTitle}']/../td[12]/span/a[3][text()='Delete']/@href");
+    $url = $this->getAttribute("xpath=//div[@id='membership_type']//div[@id='option11_wrapper']//table/tbody//tr/td[1][text()='{$membershipTypeTitle}']/../td[12]/span/a[3][text()='Delete']/@href");
 
     $matches = array();
     preg_match('/id=([0-9]+)/', $url, $matches);
@@ -459,7 +459,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase {
     $this->click('link=Title');
     $this->waitForElementPresent('_qf_Settings_cancel-bottom');
     $this->click('is_organization');
-    $this->select('onbehalf_profile_id', "value=9");
+    $this->select("xpath=//input[@id='onbehalf_profile_id']/parent::td/div/div/span/select", "value=9");
     $this->type('for_organization', "On behalf $hash");
     $this->click('_qf_Settings_next-bottom');
     $this->waitForPageToLoad($this->getTimeoutMsec());