Ian province abbreviation patch - issue 724
[civicrm-core.git] / tests / phpunit / WebTest / Contribute / OnlineMultiplePaymentProcessorTest.php
index 74802aac0c972165655f2389e6c0b3dc69af9c79..e2e63971f18110b15f7353010e6f4bc3d6375ca9 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
-
+ */
 
 require_once 'CiviTest/CiviSeleniumTestCase.php';
+
+/**
+ * Class WebTest_Contribute_OnlineMultiplePaymentProcessorTest
+ */
 class WebTest_Contribute_OnlineMultiplePaymentProcessorTest extends CiviSeleniumTestCase {
   protected function setUp() {
     parent::setUp();
   }
 
-  function testOnlineMultpiplePaymentProcessor() {
+  public function testOnlineMultpiplePaymentProcessor() {
 
     // Log in using webtestLogin() method
     $this->webtestLogin();
@@ -104,25 +107,20 @@ class WebTest_Contribute_OnlineMultiplePaymentProcessorTest extends CiviSelenium
     $this->select("billing_country_id-5", "value=1228");
     $this->select("billing_state_province_id-5", "value=1004");
     $this->type("billing_postal_code-5", "94129");
-    $this->click("_qf_Main_upload-bottom");
-
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-
-    $this->waitForElementPresent("_qf_Confirm_next-bottom");
+    $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom");
 
     $this->click("_qf_Confirm_next-bottom");
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    
+
     //login to check contribution
-    
+
   }
 
-  function testOnlineMultiplePaymentProcessorWithPayLater() {
+  public function testOnlineMultiplePaymentProcessorWithPayLater() {
 
     // Log in using webtestLogin() method
     $this->webtestLogin();
 
-
     $proProcessorName = "Pro " . substr(sha1(rand()), 0, 7);
     $standardProcessorName = "Standard " . substr(sha1(rand()), 0, 7);
     $donationPageTitle = "Donation" . substr(sha1(rand()), 0, 7);
@@ -148,7 +146,7 @@ class WebTest_Contribute_OnlineMultiplePaymentProcessorTest extends CiviSelenium
       $isPcpApprovalNeeded = FALSE,
       $isSeparatePayment = FALSE,
       $honoreeSection = FALSE,
-      $allowOtherAmmount = TRUE
+      $allowOtherAmount = TRUE
     );
 
     $this->openCiviPage("contribute/transact", "reset=1&action=preview&id=$pageId", NULL);
@@ -156,7 +154,7 @@ class WebTest_Contribute_OnlineMultiplePaymentProcessorTest extends CiviSelenium
 
     $firstName = 'Ma' . substr(sha1(rand()), 0, 4);
     $lastName = 'An' . substr(sha1(rand()), 0, 7);
-    
+
     $this->type("email-5", $firstName . "@example.com");
 
     $this->type("first_name", $firstName);
@@ -176,39 +174,32 @@ class WebTest_Contribute_OnlineMultiplePaymentProcessorTest extends CiviSelenium
     $xpath = "xpath=//label[text() = '{$payLaterText}']/preceding-sibling::input[1]";
     $this->click($xpath);
 
-    $this->click("_qf_Main_upload-bottom");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom");
 
-    $this->waitForElementPresent("_qf_Confirm_next-bottom");
-    
     $payLaterInstructionsText = "Pay later instructions $hash";
-    $this->assertTrue($this->isTextPresent($payLaterInstructionsText));
+    $this->verifyText("xpath=//div[@class='bold pay_later_receipt-section']/p", $payLaterInstructionsText);
 
     $this->click("_qf_Confirm_next-bottom");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    $this->assertTrue($this->isTextPresent($payLaterInstructionsText));
+    $this->verifyText("xpath=//div[@id='help']/div/p", $payLaterInstructionsText);
 
     //login to check contribution
     $this->openCiviPage("contribute/search", "reset=1", 'contribution_date_low');
 
-    $this->type('sort_name', "$firstName $lastName");
+    $this->type('sort_name', "$lastName $firstName");
     $this->check('contribution_test');
     $this->click('_qf_Search_refresh');
-
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-
-    $this->waitForElementPresent("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']");
-    $this->click("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->waitForElementPresent('_qf_ContributionView_cancel-bottom');
+    $this->waitForElementPresent("xpath=//div[@id='contributionSearch']/table/tbody/tr[1]/td[11]/span/a[text()='View']");
+    $this->click("xpath=//div[@id='contributionSearch']/table/tbody/tr[1]/td[11]/span/a[text()='View']");
+    $this->waitForElementPresent("_qf_ContributionView_cancel-bottom");
     $expected = array(
-      'From'            => "{$firstName} {$lastName}",
-      'Financial Type'  => 'Donation',
+      'From' => "{$firstName} {$lastName}",
+      'Financial Type' => 'Donation',
       'Contribution Status' => 'Pending : Pay Later',
     );
     $this->webtestVerifyTabularData($expected);
     $this->click('_qf_ContributionView_cancel-bottom');
   }
-}
 
+}