From 7051f2e530dad02859a2afcf3f057a7558bd7790 Mon Sep 17 00:00:00 2001 From: Web Access Date: Mon, 2 Nov 2015 18:01:47 +0530 Subject: [PATCH] Webtest Fix-Master --- CRM/Contribute/BAO/Query.php | 1 + .../phpunit/CiviTest/CiviSeleniumTestCase.php | 64 +++++++++++++++++++ .../WebTest/Contribute/AddBatchesTest.php | 2 +- .../Contribute/OnlineContributionTest.php | 1 + .../UpdateBatchPendingContributionTest.php | 4 +- .../UpdatePendingContributionTest.php | 4 +- .../WebTest/Pledge/StandaloneAddTest.php | 56 +--------------- 7 files changed, 72 insertions(+), 60 deletions(-) diff --git a/CRM/Contribute/BAO/Query.php b/CRM/Contribute/BAO/Query.php index ea46aaaa40..0e697e97c0 100644 --- a/CRM/Contribute/BAO/Query.php +++ b/CRM/Contribute/BAO/Query.php @@ -368,6 +368,7 @@ class CRM_Contribute_BAO_Query { case 'payment_instrument_id': case 'contribution_payment_instrument_id': case 'contribution_page_id': + case 'contribution_status_id': case 'contribution_id': case 'contribution_currency_type': case 'contribution_currency': diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index 33b2bfa2a7..2d8cea4dfd 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -1382,6 +1382,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { $this->click("xpath=//div[@class='messages status no-popup']/a[text()='add one']"); $this->waitForElementPresent('_qf_AddProduct_cancel-bottom'); $this->select('product_id', "value=1"); + $this->select('financial_type_id', "value=1"); $this->click('_qf_AddProduct_next-bottom'); $this->waitForElementPresent('_qf_Premium_cancel-bottom'); $this->click('_qf_Premium_next-bottom'); @@ -2440,4 +2441,67 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { //$this->assertEquals(0, $apiResult['is_error']); } + /** + * Add a pledge + * + * @return array + */ + public function webtestStandalonePledgeAdd() { + $this->webtestLogin(); + + $this->openCiviPage('pledge/add', 'reset=1&context=standalone', '_qf_Pledge_upload'); + + // create new contact using dialog + $contact = $this->createDialogContact(); + + $this->type('amount', '100'); + $this->type('installments', '10'); + $this->select('frequency_unit', 'value=week'); + $this->type('frequency_day', '2'); + + $this->webtestFillDate('acknowledge_date', 'now'); + + $this->select('contribution_page_id', 'value=3'); + + //PaymentReminders + $this->click('PaymentReminders'); + $this->waitForElementPresent('additional_reminder_day'); + $this->type('initial_reminder_day', '4'); + $this->type('max_reminders', '2'); + $this->type('additional_reminder_day', '4'); + + $this->click('_qf_Pledge_upload-bottom'); + + $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created."); + + // verify if Pledge is created + $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); + + //click through to the Pledge view screen + $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); + $this->waitForElementPresent('_qf_PledgeView_next-bottom'); + $pledgeDate = date('F jS, Y', strtotime('now')); + + $this->webtestVerifyTabularData(array( + 'Pledge By' => $contact['display_name'], + 'Total Pledge Amount' => '$ 100.00', + 'To be paid in' => '10 installments of $ 10.00 every 1 week(s)', + 'Payments are due on the' => '2 day of the period', + 'Pledge Made' => $pledgeDate, + 'Financial Type' => 'Donation', + 'Pledge Status' => 'Pending', + 'Initial Reminder Day' => '4 days prior to schedule date', + 'Maximum Reminders Send' => 2, + '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->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']"); + return $contact; + } + } diff --git a/tests/phpunit/WebTest/Contribute/AddBatchesTest.php b/tests/phpunit/WebTest/Contribute/AddBatchesTest.php index ab40ed4559..527c28a407 100644 --- a/tests/phpunit/WebTest/Contribute/AddBatchesTest.php +++ b/tests/phpunit/WebTest/Contribute/AddBatchesTest.php @@ -120,7 +120,7 @@ class WebTest_Contribute_AddBatchesTest extends CiviSeleniumTestCase { $this->webtestLogin(); // create a new pledge for contact - $contact = WebTest_Pledge_StandaloneAddTest::testStandalonePledgeAdd(); + $contact = $this->webtestStandalonePledgeAdd(); $itemCount = 2; $softCreditTypes = CRM_Core_OptionGroup::values("soft_credit_type", FALSE); diff --git a/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php b/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php index bc77c29a82..a87ffe6d2b 100644 --- a/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php @@ -304,6 +304,7 @@ class WebTest_Contribute_OnlineContributionTest extends CiviSeleniumTestCase { //Find Contribution $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low"); $this->type("sort_name", "$email"); + $this->click("xpath=//tr/td[1]/label[contains(text(), 'Contribution is a Test?')]/../../td[2]/label[contains(text(), 'Yes')]/preceding-sibling::input[1]"); $this->waitForAjaxContent(); $this->click("xpath=//div[@class='crm-accordion-wrapper crm-contribution_search_form-accordion ']/div[2]/table/tbody/tr[8]/td[1]/table/tbody/tr[3]/td[2]/label[1]"); $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", FALSE); diff --git a/tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php b/tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php index bf9116901c..cbb65c8cc7 100644 --- a/tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php @@ -49,7 +49,7 @@ class WebTest_Contribute_UpdateBatchPendingContributionTest extends CiviSelenium $this->click('radio_ts', 'ts_all'); - $this->select('task', "label=Update Pending Contribution Status"); + $this->select('task', "label=Update pending contribution status"); $this->clickLink("_qf_Search_next_action"); $this->select('contribution_status_id', 'label=Completed'); $this->click('_qf_Status_next'); @@ -105,7 +105,7 @@ class WebTest_Contribute_UpdateBatchPendingContributionTest extends CiviSelenium $this->waitForPageToLoad($this->getTimeoutMsec()); $this->click('radio_ts', 'ts_all'); - $this->select('task', "label=Update Pending Contribution Status"); + $this->select('task', "label=Update pending contribution status"); $this->waitForElementPresent("_qf_Search_next_action"); $this->click("_qf_Search_next_action"); $this->waitForPageToLoad($this->getTimeoutMsec()); diff --git a/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php b/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php index 63f71f9b45..90f471d352 100644 --- a/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php @@ -257,8 +257,8 @@ class WebTest_Contribute_UpdatePendingContributionTest extends CiviSeleniumTestC $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low"); $this->click("xpath=//tr/td[1]/label[contains(text(), 'Contribution is a Test?')]/../../td[2]/label[contains(text(), 'Yes')]/preceding-sibling::input[1]"); $this->type("sort_name", $contact['sort_name']); - $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[2]/td[11]/span/a[text()='View']"); - $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[2]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom", FALSE); + $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[2]/td[11]/span/a[text()='View']", FALSE); + $this->click("xpath=//div[@id='contributionSearch']/table/tbody/tr//td/a[text()='{$contact['sort_name']}']/../td[11]/span/a[text()='View']"); // View Contribution Record and test for expected values $expected = array( 'From' => $contact['display_name'], diff --git a/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php b/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php index f519163704..0acd95bfd8 100644 --- a/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php @@ -39,61 +39,7 @@ class WebTest_Pledge_StandaloneAddTest extends CiviSeleniumTestCase { * @return array */ public function testStandalonePledgeAdd() { - $this->webtestLogin(); - - $this->openCiviPage('pledge/add', 'reset=1&context=standalone', '_qf_Pledge_upload'); - - // create new contact using dialog - $contact = $this->createDialogContact(); - - $this->type('amount', '100'); - $this->type('installments', '10'); - $this->select('frequency_unit', 'value=week'); - $this->type('frequency_day', '2'); - - $this->webtestFillDate('acknowledge_date', 'now'); - - $this->select('contribution_page_id', 'value=3'); - - //PaymentReminders - $this->click('PaymentReminders'); - $this->waitForElementPresent('additional_reminder_day'); - $this->type('initial_reminder_day', '4'); - $this->type('max_reminders', '2'); - $this->type('additional_reminder_day', '4'); - - $this->click('_qf_Pledge_upload-bottom'); - - $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created."); - - // verify if Pledge is created - $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); - - //click through to the Pledge view screen - $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); - $this->waitForElementPresent('_qf_PledgeView_next-bottom'); - $pledgeDate = date('F jS, Y', strtotime('now')); - - $this->webtestVerifyTabularData(array( - 'Pledge By' => $contact['display_name'], - 'Total Pledge Amount' => '$ 100.00', - 'To be paid in' => '10 installments of $ 10.00 every 1 week(s)', - 'Payments are due on the' => '2 day of the period', - 'Pledge Made' => $pledgeDate, - 'Financial Type' => 'Donation', - 'Pledge Status' => 'Pending', - 'Initial Reminder Day' => '4 days prior to schedule date', - 'Maximum Reminders Send' => 2, - '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->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']"); - return $contact; + $this->webtestStandalonePledgeAdd(); } } -- 2.25.1