Merge pull request #4207 from TeNNoX/bettertagoverview3
[civicrm-core.git] / tests / phpunit / WebTest / Pledge / ContactContextAddTest.php
index 3de9033c0d990472a68cd8c4f467a14d5974e7cd..559f5e34ff48655ac7a89671327e4e27b294368e 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.4                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
 */
 
 require_once 'CiviTest/CiviSeleniumTestCase.php';
+
+/**
+ * Class WebTest_Pledge_ContactContextAddTest
+ */
 class WebTest_Pledge_ContactContextAddTest extends CiviSeleniumTestCase {
 
   protected function setUp() {
@@ -33,6 +37,8 @@ class WebTest_Pledge_ContactContextAddTest extends CiviSeleniumTestCase {
 
   function testContactContextAddTest() {
     $this->webtestLogin();
+    // Disable pop-ups for this test. Running test w/ pop-ups causes a spurious failure. dgg
+    $this->enableDisablePopups(FALSE);
 
     // create unique name
     $name      = substr(sha1(rand()), 0, 7);
@@ -68,18 +74,6 @@ class WebTest_Pledge_ContactContextAddTest extends CiviSeleniumTestCase {
 
     $this->select("contribution_page_id", "value=3");
 
-    //Honoree section
-    $this->click("Honoree");
-    $this->waitForElementPresent("honor_email");
-
-    $this->click("CIVICRM_QFID_1_2");
-    $this->select("honor_prefix_id", "value=3");
-
-    $honreeFirstName = 'First' . substr(sha1(rand()), 0, 4);
-    $honreeLastName = 'last' . substr(sha1(rand()), 0, 7);
-    $this->type("honor_first_name", $honreeFirstName);
-    $this->type("honor_last_name", $honreeLastName);
-    $this->type("honor_email", $honreeFirstName . "@example.com");
 
     //PaymentReminders
     $this->click("PaymentReminders");
@@ -89,13 +83,12 @@ class WebTest_Pledge_ContactContextAddTest extends CiviSeleniumTestCase {
     $this->type("additional_reminder_day", "4");
 
     $this->click("_qf_Pledge_upload-bottom");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
 
     $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created.");
 
-    $this->waitForElementPresent("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span[1]/a[text()='View']");
+    $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span[1]/a[text()='View']");
     //click through to the Pledge view screen
-    $this->click("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span[1]/a[text()='View']");
+    $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span[1]/a[text()='View']");
     $this->waitForElementPresent("_qf_PledgeView_next-bottom");
     $pledgeDate = date('F jS, Y', strtotime('now'));
 
@@ -107,7 +100,6 @@ class WebTest_Pledge_ContactContextAddTest extends CiviSeleniumTestCase {
       'Pledge Made' => $pledgeDate,
       'Financial Type' => 'Donation',
       'Pledge Status' => 'Pending',
-      'In Honor of' => 'Mr. ' . $honreeFirstName . ' ' . $honreeLastName,
       'Initial Reminder Day' => '4 days prior to schedule date',
       'Maximum Reminders Send' => 2,
       'Send additional reminders' => '4 days after the last one sent',
@@ -117,9 +109,13 @@ class WebTest_Pledge_ContactContextAddTest extends CiviSeleniumTestCase {
       $this->verifyText("xpath=//form[@id='PledgeView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td", preg_quote($value));
     }
 
-    $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span[1]/a[text()='View']");
-    $this->click("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[1]/span/a");
-    $this->waitForElementPresent("xpath=//div[@id='Pledges']//table//tbody//tr//td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment (Check, Cash, EFT ...)']");
+    $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span[1]/a[text()='View']", FALSE);
+
+    $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a");
+    $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a");
+    $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody//tr//td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']");
+    // Re-enable pop-ups to leave things in the same state
+    $this->enableDisablePopups(TRUE);
   }
 }