Webtest Fix 4.5.0
authorJitendra Purohit <jitendra.purohit@webaccessglobal.com>
Wed, 10 Sep 2014 13:42:21 +0000 (19:12 +0530)
committerJitendra Purohit <jitendra.purohit@webaccessglobal.com>
Wed, 10 Sep 2014 13:42:21 +0000 (19:12 +0530)
tests/phpunit/CiviTest/CiviSeleniumTestCase.php
tests/phpunit/WebTest/Admin/RelationshipTypeAddTest.php
tests/phpunit/WebTest/Contribute/OnlineMultiplePaymentProcessorTest.php
tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php
tests/phpunit/WebTest/Financial/FinancialAccountTypeTest.php
tests/phpunit/WebTest/Pledge/AddCancelPaymentTest.php

index 83cd0fc1aa66d3559d72ad69270b11aec9e0b231..0ed43f0f3f01cabc0af6a3085a899271a14c24a2 100644 (file)
@@ -784,6 +784,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
     $this->type('billing_city-5', 'San Bernadino');
     $this->select('billing_country_id-5', 'value=1228');
     $this->click('billing_state_province_id-5');
+    $this->waitForVisible('billing_state_province_id-5');
     $this->select('billing_state_province_id-5', 'label=California');
     $this->type('billing_postal_code-5', '93245');
 
@@ -1871,9 +1872,10 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
       $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.";
+      $text = "The financial type \"{$financialType['name']}\" has been updated.";
     }
-    $this->waitForText("xpath=//div[@class='notify-content']", $text);
+    $this->waitForElementPresent("xpath=//div[@class='notify-content']");
+    $this->assertElementContainsText('crm-notification-container', $text);
   }
 
   /**
@@ -1934,7 +1936,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
    * @param $financialType
    */
   function addPremium($name, $sku, $amount, $price, $cost, $financialType) {
-    $this->waitForElementPresent("_qf_ManagePremiums_upload-bottom");
+    $this->waitForElementPresent("_qf_ManagePremiums_next-bottom");
     $this->type("name", $name);
     $this->type("sku", $sku);
     $this->click("CIVICRM_QFID_noImage_16");
@@ -1944,7 +1946,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
     if ($financialType) {
       $this->select("financial_type_id", "label={$financialType}");
     }
-    $this->click("_qf_ManagePremiums_upload-bottom");
+    $this->click("_qf_ManagePremiums_next-bottom");
     $this->waitForPageToLoad($this->getTimeoutMsec());
   }
 
index 1de77f0ac199db55eedd2a7b1e7bd5d33b961b2d..055ebcb769f56419e851e4b782eda00850329694 100644 (file)
@@ -99,7 +99,7 @@ class WebTest_Admin_RelationshipTypeAddTest extends CiviSeleniumTestCase {
     $this->type('description', $description);
 
     $this->click('_qf_RelationshipType_next-bottom');
-    $this->waitForText("xpath=//*[@id='RelationshipType']/div[2]/table/tbody/tr[1]/td[2]/label[@class='error']", 'This field is required.');
+    $this->waitForText("xpath=//*[@id='RelationshipType']/div[2]/table/tbody/tr[1]/td[2]/label[@class='crm-inline-error']", 'This field is required.');
 
     //enter the relationship type values.
     $labelAB = 'Test Relationship Type A - B - DUPLICATE TO BE' . rand();
index de1bcf98b796a346c49b0c912d82a8dc5e70fe41..a2c73740131df2743e923113b529624bc7c72c8c 100644 (file)
@@ -190,7 +190,7 @@ class WebTest_Contribute_OnlineMultiplePaymentProcessorTest extends CiviSelenium
     $this->type('sort_name', "$firstName $lastName");
     $this->check('contribution_test');
     $this->clickLink('_qf_Search_refresh', "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']");
-    $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", '_qf_ContributionView_cancel-bottom');
+    $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", '_qf_ContributionView_cancel-bottom', FALSE);
     $expected = array(
       'From'            => "{$firstName} {$lastName}",
       'Financial Type'  => 'Donation',
index 43ed8359825b604d6e352eb3181b63ef8b846fb9..e5ec62e8f2b0c9702ac5ae7dbb124cfb7baa1263 100644 (file)
@@ -123,7 +123,7 @@ class WebTest_Contribute_UpdateBatchPendingContributionTest extends CiviSelenium
 
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $this->click("xpath=//div[@id='contributionSearch']/table[@class='selector row-highlight']/tbody/tr[1]/td[11]/span/a[text()='View']");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->waitForElementPresent("_qf_ContributionView_cancel-bottom");
     $expected = array(
       'Received Into'        => "Deposit Bank Account",
       'Contribution Status' => "Completed",
index 26e786054d321f16885ebff2369dd42c61df5d85..0bedad28afa7ab5b521d0a0f0406057f324c4dd8 100644 (file)
@@ -79,18 +79,15 @@ class WebTest_Financial_FinancialAccountTypeTest extends CiviSeleniumTestCase {
     $this->click("xpath=//div[@id='ltype']/div/table/tbody/tr/td[2][text()='Banking Fees']/../td[7]/span/a[text()='Edit']");
     $this->waitForElementPresent('_qf_FinancialTypeAccount_next');
     $this->select('account_relationship', "value=select");
-    // Because it tends to cause problems, all uses of sleep() must be justified in comments
-    // Sleep should never be used for wait for anything to load from the server
-    // Justification for this instance: FIXME
-    sleep(1);
+    $this->waitForElementPresent("xpath=//select[@id='account_relationship']/option[text()='- Select Financial Account Relationship -']");
     $this->select('account_relationship', "label=Premiums Inventory Account is");
+    $this->waitForElementPresent("xpath=//select[@id='financial_account_id']/option[3][text()='Deposit Bank Account']");
     $this->select('financial_account_id', "label=Premiums inventory");
     $this->click('_qf_FinancialTypeAccount_next');
     $this->waitForElementPresent("xpath=//div[@id='ltype']/div/table/tbody/tr/td[2][text()='Premiums inventory']/../td[7]/span/a[text()='Edit']");
     $this->verifyText("xpath=//div[@id='ltype']/div/table/tbody/tr/td[2][text()='Premiums inventory']/../td[1]", preg_quote('Premiums Inventory Account is'));
     $this->clickLink("xpath=//div[@id='ltype']/div/table/tbody/tr/td[2][text()='Premiums inventory']/../td[7]/span/a[text()='Delete']", '_qf_FinancialTypeAccount_next-botttom', FALSE);
     $this->click('_qf_FinancialTypeAccount_next-botttom');
-    $this->waitForElementPresent("newfinancialTypeAccount");
     $this->waitForText('crm-notification-container', 'Selected financial type account has been deleted.');
 
     //edit financial type
index 76484ae6b2183030d288a553ba36ee0b75bccfa7..798927b9c200129633b79975f3a1d98bac771349 100644 (file)
@@ -74,16 +74,17 @@ class WebTest_Pledge_AddCancelPaymentTest extends CiviSeleniumTestCase {
         'Pledge Status' => 'Pending',
       )
     );
-    $this->clickLink('_qf_PledgeView_next-bottom', "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']", FALSE);
-    $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a");
     //Edit and add the first payment for 300.00
-    $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody//tr//td/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[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a", 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[@class='selector row-highlight']//tbody/tr[1]/td[1]/span[2]/a");
+    $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody//tr//td/table/tbody/tr[2]/td[8]/a[text()='Record Payment']");
     $this->click("xpath=//div[@class='view-content']//table//tbody//tr//td/table/tbody/tr[2]/td[8]/a");
     $this->waitForElementPresent("xpath=//form[@id='Contribution']//div[2]/table/tbody/tr[3]/td[2]/a");
     $this->click("xpath=//form[@id='Contribution']//div[2]/table/tbody/tr[3]/td[2]/a");
     $this->type('total_amount', '300.00');
     $this->click('_qf_Contribution_upload-bottom');
-    $this->waitForPageToLoad("30000");
     $this->waitForText('crm-notification-container', "The contribution record has been saved.");
 
     $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
@@ -103,6 +104,8 @@ class WebTest_Pledge_AddCancelPaymentTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent("_qf_Contribution_upload-bottom");
     $this->select('contribution_status_id', 'value=3');
     $this->click("_qf_Contribution_upload-bottom");
+    $this->waitForElementPresent("_qf_ContributionView_cancel-bottom");
+    $this->click("_qf_ContributionView_cancel-bottom");
 
     $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
     $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[1]/span/a");