Merge pull request #4865 from eileenmcnaughton/my-first-factory
[civicrm-core.git] / tests / phpunit / WebTest / Contribute / ContributionPageAddTest.php
index 90ee4516896963d4d8d57a8ed21ae5b9630fd8e8..09bd4a5879c8ff8106d9d0250a7e32d3768ca4c5 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -30,7 +30,7 @@ require_once 'CiviTest/CiviSeleniumTestCase.php';
  * Class WebTest_Contribute_ContributionPageAddTest
  */
 class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase {
-  function testContributionPageAdd() {
+  public function testContributionPageAdd() {
     // open browser, login
     $this->webtestLogin();
 
@@ -57,8 +57,8 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase {
     $texts = array(
       "Title - New Membership $hash",
       "This is introductory message for $pageTitle",
-      '$ 50.00 Student',
-      "$ $rand.00 Label $hash",
+      'Student - $ 50.00',
+      "Label $hash - $ $rand.00",
       "Pay later label $hash",
       'Organization Details',
       'Other Amount',
@@ -68,6 +68,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase {
     );
     foreach ($texts as $text) {
       $this->assertTrue($this->isTextPresent($text), 'Missing text: ' . $text);
+      $this->waitForAjaxContent();
     }
 
     // Disable and re-enable Other Amounts (verify fix for CRM-15021)
@@ -85,7 +86,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase {
   }
 
   // CRM-12510 Test copy contribution page
-  function testContributionPageCopy() {
+  public function testContributionPageCopy() {
     // open browser, login
     $this->webtestLogin();
 
@@ -125,8 +126,8 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase {
     $texts = array(
       "Title - New Membership $hash",
       "This is introductory message for $pageTitle",
-      '$ 50.00 Student',
-      "$ $rand.00 Label $hash",
+      'Student - $ 50.00',
+      "Label $hash - $ $rand.00",
       "Pay later label $hash",
       'Organization Details',
       'Other Amount',
@@ -136,13 +137,14 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase {
     );
     foreach ($texts as $text) {
       $this->assertTrue($this->isTextPresent($text), 'Missing text: ' . $text);
+      $this->waitForAjaxContent();
     }
   }
 
   /**
-   * check CRM-7943
+   * Check CRM-7943
    */
-  function testContributionPageSeparatePayment() {
+  public function testContributionPageSeparatePayment() {
     // open browser, login
     $this->webtestLogin();
 
@@ -171,7 +173,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase {
     $texts = array(
       "Title - New Membership $hash",
       "This is introductory message for $pageTitle",
-      "$ $rand.00 Label $hash",
+      "Label $hash - $ $rand.00",
       "Pay later label $hash",
       'Organization Details',
       'Other Amount',
@@ -181,13 +183,14 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase {
     );
     foreach ($texts as $text) {
       $this->assertTrue($this->isTextPresent($text), 'Missing text: ' . $text);
+      $this->waitForAjaxContent();
     }
   }
 
   /**
-   * check CRM-7949
+   * Check CRM-7949
    */
-  function testContributionPageSeparatePaymentPayLater() {
+  public function testContributionPageSeparatePaymentPayLater() {
     // open browser, login
     $this->webtestLogin();
 
@@ -222,7 +225,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase {
     $this->type('first_name', $firstName);
     $this->type('last_name', $lastName);
 
-    $this->select('state_province-1',"value=1002");
+    $this->select('state_province-1', "value=1002");
     $this->clickLink('_qf_Main_upload-bottom', '_qf_Confirm_next-bottom');
 
     $this->click('_qf_Confirm_next-bottom');
@@ -234,8 +237,8 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase {
     //Find Contribution
     $this->openCiviPage("contribute/search", "reset=1", 'contribution_date_low');
 
-    $this->type('sort_name', "$firstName $lastName");
-    $this->select('financial_type_id',"label=Member Dues");
+    $this->type('sort_name', "$lastName $firstName");
+    $this->select('financial_type_id', "label=Member Dues");
     $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', FALSE);
     $expected = array(
@@ -253,7 +256,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase {
     $this->click("xpath=id('Search')/div[2]/div/div[1]");
     $this->waitForElementPresent("financial_type_id");
     $this->type("sort_name", $firstName);
-    $this->select('financial_type_id',"label=Donation");
+    $this->select('financial_type_id', "label=Donation");
     $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', FALSE);
@@ -267,7 +270,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase {
 
     //Find Member
     $this->openCiviPage("member/search", "reset=1", 'member_source');
-    $this->type('sort_name', "$firstName $lastName");
+    $this->type('sort_name', "$lastName $firstName");
     $this->clickLink('_qf_Search_refresh', "xpath=//div[@id='memberSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", FALSE);
     $this->clickLink("xpath=//div[@id='memberSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", '_qf_MembershipView_cancel-bottom', FALSE);
 
@@ -284,7 +287,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase {
   /**
    * CRM-12994
    */
-  function testContributionPageAddPremiumRequiredField() {
+  public function testContributionPageAddPremiumRequiredField() {
     // open browser, login
     $this->webtestLogin();
 
@@ -353,7 +356,9 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase {
 
     // fill in Receipt details
     $this->type('thankyou_title', "Thank-you Page Title $hash");
+    $this->click("xpath=//form[@id='ThankYou']/div[2]/table[1]/tbody/tr[2]/td[2]/div/a/span");
     $this->fillRichTextField('thankyou_text', 'This is thankyou message for ' . $pageTitle, 'CKEditor');
+    $this->click("xpath=//form[@id='ThankYou']/div[2]/table[1]/tbody/tr[3]/td[2]/div/a/span");
     $this->fillRichTextField('thankyou_footer', 'This is thankyou footer message for ' . $pageTitle, 'CKEditor');
     $this->click('is_email_receipt');
     $this->waitForElementPresent('bcc_receipt');
@@ -435,4 +440,3 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase {
     $this->assertTrue($this->isTextPresent($premiumSavedText));
   }
 }
-