Ian province abbreviation patch - issue 724
[civicrm-core.git] / tests / phpunit / WebTest / Contribute / UpdateContributionTest.php
index 96f59940469a98d4684a1708758630d2cbca9493..fdef735f3621e66a2ffc8243fd603d05360d412b 100755 (executable)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.6                                                |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
@@ -54,8 +54,13 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase {
     }
 
     $this->clickLink("xpath=//tr[@id='rowid{$contriIDOff}']/td[11]/span/a[2]", "total_amount", FALSE);
+    $this->waitForAjaxContent();
     $this->type("total_amount", "90");
     $this->clickLink('_qf_Contribution_upload', '', FALSE);
+    $this->waitForAjaxContent();
+    $this->waitForText('crm-notification-container', "The sum of fee amount and net amount must be equal to total amount");
+    $this->type("net_amount", "90");
+    $this->clickLink('_qf_Contribution_upload', '', FALSE);
 
     // Is status message correct?
     $this->waitForText('crm-notification-container', "The contribution record has been saved.");
@@ -174,10 +179,10 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase {
 
     //Assertions
     $actualAmount = $this->_getPremiumActualCost($contId, $to, $from, $cost2, "'civicrm_contribution'");
-    $this->assertEquals($actualAmount, NULL, "Verify actual cost for changed premium");
+    $this->assertEquals($actualAmount, $cost2, "Verify actual cost for changed premium");
 
     $deletedAmount = $this->_getPremiumActualCost($contId, $from, $to, $cost, "'civicrm_contribution'");
-    $this->assertEquals($deletedAmount, NULL, "Verify actual cost for deleted premium");
+    $this->assertEquals($deletedAmount, $cost, "Verify actual cost for deleted premium");
   }
 
   public function testDeletePremium() {
@@ -235,11 +240,12 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent("product_name_0");
     $this->select('product_name_0', "value=0");
     // Clicking save.
-    $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[7][not(text())]", FALSE);
+    $this->click("_qf_Contribution_upload");
+    $this->waitForElementPresent("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[8]//span/a[text()='View']");
 
     //Assertions
     $actualAmount = $this->_getPremiumActualCost($contId, $from, $to, NULL, "'civicrm_contribution'");
-    $this->assertEquals($actualAmount, NULL, "Verify actual cost for deleted premium");
+    $this->assertEquals($actualAmount, $cost, "Verify actual cost for deleted premium");
   }
 
   public function testChangePaymentInstrument() {