From e24146727f87a3c754b4b5c77742afb5a2d6beb6 Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Tue, 8 Dec 2015 18:55:19 +0530 Subject: [PATCH] webtest fixes --- .../phpunit/CiviTest/CiviSeleniumTestCase.php | 8 +- .../WebTest/Contact/MergeContactsTest.php | 4 +- .../Contribute/UpdateContributionTest.php | 4 +- .../WebTest/Pledge/AddCancelPaymentTest.php | 28 +++---- .../ContactContextPledgePaymentAddTest.php | 83 ++++++++++--------- .../Pledge/StandaloneAddDeleteTest.php | 38 ++++----- 6 files changed, 84 insertions(+), 81 deletions(-) diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index 44e82f0116..1a1cd621eb 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -2477,12 +2477,10 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { 'Send additional reminders' => '4 days after the last one sent', ) ); - $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->clickLink('_qf_PledgeView_next-bottom', "xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a", FALSE); $this->waitForAjaxContent(); - $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[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); + $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); return $contact; } diff --git a/tests/phpunit/WebTest/Contact/MergeContactsTest.php b/tests/phpunit/WebTest/Contact/MergeContactsTest.php index 824eba63b2..5824f9201e 100644 --- a/tests/phpunit/WebTest/Contact/MergeContactsTest.php +++ b/tests/phpunit/WebTest/Contact/MergeContactsTest.php @@ -385,7 +385,9 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//a[text()='$firstName $lastName']"); $this->click("xpath=//a[text()='$firstName $lastName']/../../td[8]/a[text()='merge']"); $this->waitForElementPresent('_qf_Merge_cancel-bottom'); - $this->clickLink("css=div.crm-contact-merge-form-block div.action-link a", "xpath=//form[@id='Merge']/div[2]/table/tbody/tr[3]/td[4]/span[text()='(overwrite)']", FALSE); + $this->clickLink("css=div.crm-contact-merge-form-block div.action-link a"); + + $this->waitForElementPresent("xpath=//form[@id='Merge']/div[2]/table/tbody/tr[3]/td[4]/span[text()='(overwrite)']"); $this->waitForElementPresent("xpath=//form[@id='Merge']/div[2]/table/tbody/tr[5]/td[4]/span[text()='(add)']"); $this->waitForElementPresent('_qf_Merge_cancel-bottom'); diff --git a/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php b/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php index 74df3b5ace..e682016b0f 100755 --- a/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php @@ -48,12 +48,12 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase { $this->click("_qf_Search_refresh"); $this->waitForElementPresent("xpath=//*[@id='Search']//div[@id='contributionSearch']"); - $contriIDOff = explode('&', $this->getAttribute("xpath=//div[@id='contributionSearch']//table[@class='selector row-highlight']/tbody/tr[1]/td[11]/span/a[1]@href")); + $contriIDOff = explode('&', $this->getAttribute("xpath=//div[@id='contributionSearch']//table[@class='selector row-highlight']/tbody/tr[1]//td//span/a[1]@href")); if (!empty($contriIDOff)) { $contriIDOff = substr($contriIDOff[1], (strrpos($contriIDOff[1], '=') + 1)); } - $this->clickLink("xpath=//tr[@id='rowid{$contriIDOff}']/td[11]/span/a[2]", "total_amount", FALSE); + $this->clickLink("xpath=//tr[@id='rowid{$contriIDOff}']//td//span/a[2]", "total_amount", FALSE); $this->waitForAjaxContent(); $this->type("total_amount", "90"); $this->clickLink('_qf_Contribution_upload', '', FALSE); diff --git a/tests/phpunit/WebTest/Pledge/AddCancelPaymentTest.php b/tests/phpunit/WebTest/Pledge/AddCancelPaymentTest.php index ff73036ef2..d498582f73 100644 --- a/tests/phpunit/WebTest/Pledge/AddCancelPaymentTest.php +++ b/tests/phpunit/WebTest/Pledge/AddCancelPaymentTest.php @@ -76,9 +76,9 @@ class WebTest_Pledge_AddCancelPaymentTest extends CiviSeleniumTestCase { $this->click('_qf_PledgeView_next-bottom'); $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); $this->waitForAjaxContent(); - $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/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->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody//tr//td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); + $this->click("xpath=//div[@class='view-content']//table//tbody//tr//td/div/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'); @@ -86,17 +86,16 @@ class WebTest_Pledge_AddCancelPaymentTest extends CiviSeleniumTestCase { $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']"); - $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); //Check whether the next two payments are done or not $this->waitForAjaxContent(); - $this->waitForElementPresent("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']//div/table/tbody//tr//td/table/tbody/tr[2]/td[8]/a[text()='View Payment']"); - $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]", "Completed"); - $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[4]/td[7]", "Completed"); + $this->waitForElementPresent("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']//div/table/tbody//tr//td/div/table/tbody/tr[2]/td[8]/a[text()='View Payment']"); + $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr/td/div/table/tbody/tr[3]/td[7]", "Completed"); + $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr/td/div/table/tbody/tr[4]/td[7]", "Completed"); //Cancel the contribution made for amount of 300.00 - $this->waitForElementPresent("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']//div/table/tbody//tr//td/table/tbody/tr[2]/td[8]/a[text()='View Payment']"); - $this->click("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a"); + $this->waitForElementPresent("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']//div/table/tbody//tr//td/div/table/tbody/tr[2]/td[8]/a[text()='View Payment']"); + $this->click("xpath=//div[@class='view-content']//table/tbody/tr/td/div/table/tbody/tr[2]/td[8]/a"); $this->waitForElementPresent("xpath=//form[@id='ContributionView']//div[2]/div/div/a"); $this->click("xpath=//form[@id='ContributionView']//div[2]/div/div/a"); $this->waitForElementPresent("_qf_Contribution_upload-bottom"); @@ -108,16 +107,15 @@ class WebTest_Pledge_AddCancelPaymentTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); $this->waitForAjaxContent(); - $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[1]/span/a"); - $this->waitForElementPresent("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table/tbody/tr/td/div/table/tbody/tr[3]/td[7]"); // verify that first paayment is cancelled and the rest two payments are revert back to the pending status - $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td[7]", "Cancelled"); - $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]", "Pending"); - $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[4]/td[7]", "Pending"); + $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr/td/div/table/tbody/tr[2]/td[7]", "Cancelled"); + $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr/td/div/table/tbody/tr[3]/td[7]", "Pending"); + $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr/td/div/table/tbody/tr[4]/td[7]", "Pending"); // Check whether a new payment with pending status is added at the last or not - $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[14]/td[7]", "Pending"); + $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr/td/div/table/tbody/tr[14]/td[7]", "Pending"); // verify that Balance sum is correct $this->verifyText("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']//div[@class='view-content']//table//tbody/tr[1]/td[4]", "1,200.00"); diff --git a/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php b/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php index ddc55861a2..f734f948ea 100644 --- a/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php +++ b/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php @@ -43,9 +43,6 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest $this->click("_qf_Localization_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); - // 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); $firstName = 'Adam' . $name; @@ -115,26 +112,30 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest ); $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"); - $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); - $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); + $this->waitForAjaxContent(); + $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); + $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); $this->click("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); $this->waitForElementPresent("adjust-option-type"); $this->type("total_amount", "5"); $this->click("_qf_Contribution_upload"); + $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']"); - $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[1]/span/a"); + $this->waitForAjaxContent(); + $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[1]/a"); - $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); - $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); + $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); $this->click("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); $this->waitForElementPresent("adjust-option-type"); $this->type("total_amount", "10"); $this->click("_qf_Contribution_upload"); + $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']"); //click through to the Pledge view screen @@ -157,9 +158,10 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest ); $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"); - $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); - $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); + $this->waitForAjaxContent(); + $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); + $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); @@ -169,15 +171,18 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest $this->waitForElementPresent("_qf_Contribution_upload"); $this->click("_qf_Contribution_upload"); + $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']"); - $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); + $this->waitForAjaxContent(); + $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a"); - $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[5]/td[8]/a[text()='Record Payment']"); - $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[5]/td[8]/a[text()='Record Payment']"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[5]/td[8]/a[text()='Record Payment']"); + $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[5]/td[8]/a[text()='Record Payment']"); $this->waitForElementPresent("_qf_Contribution_upload"); $this->click("_qf_Contribution_upload"); + $this->waitForText('crm-notification-container', "The contribution record has been saved."); $this->waitForElementPresent("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); @@ -202,11 +207,9 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest $this->click("remove"); $this->click("_qf_Localization_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); - // Re-enable pop-ups to leave things in the same state - $this->enableDisablePopups(TRUE); } - public function testAddPledgePaymentWithAdjustTotalPledgeAmount() { + public function testAdedPledgePaymentWithAdjustTotalPledgeAmount() { $this->webtestLogin(); // Disable pop-ups for this test. Running test w/ pop-ups causes a spurious failure. dgg $this->enableDisablePopups(FALSE); @@ -277,9 +280,9 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest ) ); $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=//table[@class='selector row-highlight']/tbody/tr[1]/td[1]/span/a"); - $this->waitForElementPresent("xpath=//table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); - $this->click("xpath=//table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); + $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[1]/a"); + $this->waitForElementPresent("xpath=//table/tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); + $this->click("xpath=//table/tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); $this->click("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); $this->waitForElementPresent("adjust-option-type"); @@ -289,10 +292,9 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest $this->click("_qf_Contribution_upload"); $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[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); - - $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); - $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); + $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[1]/a"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); + $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); $this->click("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); $this->waitForElementPresent("adjust-option-type"); @@ -323,9 +325,10 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest ); $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"); - $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); - $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); + $this->waitForAjaxContent(); + $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); + $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); $this->waitForElementPresent("_qf_Contribution_upload"); $this->click("_qf_Contribution_upload"); @@ -353,8 +356,6 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest public function testAddPledgePayment() { $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); @@ -404,23 +405,27 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest //Add payments $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[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); - $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); - $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); + $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); + $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); $this->waitForElementPresent("_qf_Contribution_upload"); $this->click("_qf_Contribution_upload"); + $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']"); - $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[2]/td[2]/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); - $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); + $this->waitForAjaxContent(); + $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); + $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); $this->waitForElementPresent("_qf_Contribution_upload"); $this->click("_qf_Contribution_upload"); + $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']"); - $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[2]/td[2]/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); - $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); + $this->waitForAjaxContent(); + $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); + $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); $this->waitForElementPresent("_qf_Contribution_upload"); $this->click("_qf_Contribution_upload"); diff --git a/tests/phpunit/WebTest/Pledge/StandaloneAddDeleteTest.php b/tests/phpunit/WebTest/Pledge/StandaloneAddDeleteTest.php index c6e9fb5665..c18a3e7cd7 100644 --- a/tests/phpunit/WebTest/Pledge/StandaloneAddDeleteTest.php +++ b/tests/phpunit/WebTest/Pledge/StandaloneAddDeleteTest.php @@ -73,11 +73,11 @@ class WebTest_Pledge_StandaloneAddDeleteTest extends CiviSeleniumTestCase { ) ); $this->click('_qf_PledgeView_next-bottom'); - $this->waitForElementPresent("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]/a"); $this->waitForAjaxContent(); - $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[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); - $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a"); + $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); + $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/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'); @@ -87,9 +87,9 @@ class WebTest_Pledge_StandaloneAddDeleteTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); $this->waitForAjaxContent(); - $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[2]/td[2]/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); - $this->click("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[8]/a"); + $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table/tbody/tr[2]/td/div/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); + $this->click("xpath=//div[@class='view-content']//table/tbody/tr[2]/td/div/table/tbody/tr[3]/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', '250.00'); @@ -98,9 +98,9 @@ class WebTest_Pledge_StandaloneAddDeleteTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); $this->waitForAjaxContent(); - $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[2]/td[2]/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); - $this->click("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[4]/td[8]/a"); + $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table/tbody/tr[2]/td/div/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); + $this->click("xpath=//div[@class='view-content']//table/tbody/tr[2]/td/div/table/tbody/tr[4]/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"); @@ -111,9 +111,9 @@ class WebTest_Pledge_StandaloneAddDeleteTest extends CiviSeleniumTestCase { // delete the contribution associated with the 2nd payment $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[10]/span/a[text()='View']"); $this->waitForAjaxContent(); - $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[2]/td[2]/table[@class='nestedSelector']/tbody/tr[3]/td[8]/a[text()='View Payment']"); - $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[2]/td[2]/table[@class='nestedSelector']/tbody/tr[3]/td[8]/a"); + $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[2]/td/div/table[@class='nestedSelector']/tbody/tr[3]/td[8]/a[text()='View Payment']"); + $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[2]/td/div/table[@class='nestedSelector']/tbody/tr[3]/td[8]/a"); $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button[2]"); $this->click("xpath=//div[@class='ui-dialog-buttonset']/button[2]"); $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']//button/span[text()='Delete']"); @@ -124,19 +124,19 @@ class WebTest_Pledge_StandaloneAddDeleteTest extends CiviSeleniumTestCase { $this->click("xpath=//li[@id='tab_pledge']/a"); $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[10]/span/a[text()='View']"); $this->waitForAjaxContent(); - $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[2]/td[2]/table/tbody/tr[3]/td[7]"); + $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table/tbody/tr[2]/td/div/table/tbody/tr[3]/td[7]"); $this->waitForAjaxContent(); - $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]", "Pending"); - $this->waitForElementPresent("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td"); + $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td/div/table/tbody/tr[3]/td[7]", "Pending"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table/tbody/tr[2]/td/div/table/tbody/tr[3]/td"); // verify that payment owed amount is correct (250.00) $this->waitForAjaxContent(); - $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td", "250.00"); + $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td/div/table/tbody/tr[3]/td", "250.00"); // verify that Total Paid and Balance sums are correct $this->waitForAjaxContent(); - $this->verifyText("xpath=//div[@class='view-content' and contains(., 'view pledge payments')]/table[@class='selector row-highlight']//tbody/tr[1]/td[3]", "470.00"); + $this->verifyText("xpath=//div[@class='view-content']/table[@class='selector row-highlight']//tbody/tr[1]/td[3]", "470.00"); $this->verifyText("xpath=//div[@class='view-content' and contains(., 'view pledge payments')]/table[@class='selector row-highlight']//tbody/tr[1]/td[4]", "1,930.00"); } -- 2.25.1