From c51f8adb71e0cfcc2508aae54aca25ff03fe7752 Mon Sep 17 00:00:00 2001 From: Jitendra Purohit Date: Wed, 10 Sep 2014 19:12:21 +0530 Subject: [PATCH] Webtest Fix 4.5.0 --- tests/phpunit/CiviTest/CiviSeleniumTestCase.php | 10 ++++++---- .../phpunit/WebTest/Admin/RelationshipTypeAddTest.php | 2 +- .../Contribute/OnlineMultiplePaymentProcessorTest.php | 2 +- .../Contribute/UpdateBatchPendingContributionTest.php | 2 +- .../WebTest/Financial/FinancialAccountTypeTest.php | 7 ++----- tests/phpunit/WebTest/Pledge/AddCancelPaymentTest.php | 11 +++++++---- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index 83cd0fc1aa..0ed43f0f3f 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -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()); } diff --git a/tests/phpunit/WebTest/Admin/RelationshipTypeAddTest.php b/tests/phpunit/WebTest/Admin/RelationshipTypeAddTest.php index 1de77f0ac1..055ebcb769 100644 --- a/tests/phpunit/WebTest/Admin/RelationshipTypeAddTest.php +++ b/tests/phpunit/WebTest/Admin/RelationshipTypeAddTest.php @@ -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(); diff --git a/tests/phpunit/WebTest/Contribute/OnlineMultiplePaymentProcessorTest.php b/tests/phpunit/WebTest/Contribute/OnlineMultiplePaymentProcessorTest.php index de1bcf98b7..a2c7374013 100644 --- a/tests/phpunit/WebTest/Contribute/OnlineMultiplePaymentProcessorTest.php +++ b/tests/phpunit/WebTest/Contribute/OnlineMultiplePaymentProcessorTest.php @@ -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', diff --git a/tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php b/tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php index 43ed835982..e5ec62e8f2 100644 --- a/tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php @@ -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", diff --git a/tests/phpunit/WebTest/Financial/FinancialAccountTypeTest.php b/tests/phpunit/WebTest/Financial/FinancialAccountTypeTest.php index 26e786054d..0bedad28af 100644 --- a/tests/phpunit/WebTest/Financial/FinancialAccountTypeTest.php +++ b/tests/phpunit/WebTest/Financial/FinancialAccountTypeTest.php @@ -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 diff --git a/tests/phpunit/WebTest/Pledge/AddCancelPaymentTest.php b/tests/phpunit/WebTest/Pledge/AddCancelPaymentTest.php index 76484ae6b2..798927b9c2 100644 --- a/tests/phpunit/WebTest/Pledge/AddCancelPaymentTest.php +++ b/tests/phpunit/WebTest/Pledge/AddCancelPaymentTest.php @@ -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"); -- 2.25.1