Webtest Fix-Master
authorWeb Access <rohan.katkar@webaccessglobal.com>
Mon, 2 Nov 2015 12:31:47 +0000 (18:01 +0530)
committerWeb Access <rohan.katkar@webaccessglobal.com>
Mon, 2 Nov 2015 12:31:47 +0000 (18:01 +0530)
CRM/Contribute/BAO/Query.php
tests/phpunit/CiviTest/CiviSeleniumTestCase.php
tests/phpunit/WebTest/Contribute/AddBatchesTest.php
tests/phpunit/WebTest/Contribute/OnlineContributionTest.php
tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php
tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php
tests/phpunit/WebTest/Pledge/StandaloneAddTest.php

index ea46aaaa402ee3d9a5aa9c78f88ff6cac2d411e0..0e697e97c0ce20a4d170ad74170d24025f5c6916 100644 (file)
@@ -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':
index 33b2bfa2a70ea63394033fb8d6ae5abc06663be9..2d8cea4dfdbbd2e0f10b49b58c5f39e38facbdad 100644 (file)
@@ -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;
+  }
+
 }
index ab40ed45597287501aecfd70738d0e75d447054b..527c28a40754817e1f47ddc374d1c0b98a6904ed 100644 (file)
@@ -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);
index bc77c29a82f1a8f7090fd8acf0e4e2fbe5e87ffd..a87ffe6d2b0aa046fdf8c93410a0ffda910ddf20 100644 (file)
@@ -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);
index bf9116901c62fad8417e4b1f49397b7cfcb53d76..cbb65c8cc74454f5b1ef5cee76d15db49601decf 100644 (file)
@@ -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());
index 63f71f9b4584a5ba95d051147f33731a033dc95c..90f471d35252e65e4afc428bcabbd4c5aba5ca76 100644 (file)
@@ -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'],
index f51916370409b9fd0c422cc24004f6fdbd7fc903..0acd95bfd84894cb5a88e684b75db5b2837892b7 100644 (file)
@@ -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();
   }
 
 }