Webtest fixes
[civicrm-core.git] / tests / phpunit / WebTest / Import / MatchExternalIdTest.php
index 822ed2782aa4961931135a1dd0a0aefa279de710..e8a1df5f26c696d3f3cd8d5d33c74abd81b4ef5e 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.4                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
 */
 
 require_once 'WebTest/Import/ImportCiviSeleniumTestCase.php';
+
+/**
+ * Class WebTest_Import_MatchExternalIdTest
+ */
 class WebTest_Import_MatchExternalIdTest extends ImportCiviSeleniumTestCase {
 
   protected function setUp() {
@@ -74,6 +78,9 @@ class WebTest_Import_MatchExternalIdTest extends ImportCiviSeleniumTestCase {
   /*
       *  Helper function to provide data for contribution  import for Individual.
       */
+  /**
+   * @return array
+   */
   function _contributionIndividualCSVData() {
     $firstName1  = substr(sha1(rand()), 0, 7);
     $lastName1   = substr(sha1(rand()), 0, 7);
@@ -122,6 +129,9 @@ class WebTest_Import_MatchExternalIdTest extends ImportCiviSeleniumTestCase {
   /*
      *  Helper function to provide data for membership import for Individual.
      */
+  /**
+   * @return array
+   */
   function _memberIndividualCSVData() {
     $memTypeParams = $this->webtestAddMembershipType();
 
@@ -169,6 +179,9 @@ class WebTest_Import_MatchExternalIdTest extends ImportCiviSeleniumTestCase {
   /*
      *  Helper function to provide data for participant import for Individual.
      */
+  /**
+   * @return array
+   */
   function _participantIndividualCSVData() {
     $eventInfo = $this->_addNewEvent();
 
@@ -229,6 +242,13 @@ class WebTest_Import_MatchExternalIdTest extends ImportCiviSeleniumTestCase {
      *
      * @return int external id
      */
+  /**
+   * @param $firstName
+   * @param $lastName
+   * @param $externalId
+   *
+   * @return mixed
+   */
   function _addContact($firstName, $lastName, $externalId) {
     $this->openCiviPage('contact/add', 'reset=1&ct=Individual');
 
@@ -256,12 +276,17 @@ class WebTest_Import_MatchExternalIdTest extends ImportCiviSeleniumTestCase {
      *
      * @return array $params event details of newly created event
      */
+  /**
+   * @param array $params
+   *
+   * @return array
+   */
   function _addNewEvent($params = array(
     )) {
     if (empty($params)) {
 
-      // We need a payment processor
-      $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7);
+      // Use default payment processor
+      $processorName = 'Test Processor';
       $this->webtestAddPaymentProcessor($processorName);
 
       // create an event
@@ -317,16 +342,16 @@ class WebTest_Import_MatchExternalIdTest extends ImportCiviSeleniumTestCase {
     }
 
     $this->click("_qf_Fee_upload-bottom");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->waitForElementPresent("_qf_Fee_upload-bottom");
 
     // Go to Online Registration tab
     $this->click("link=Online Registration");
     $this->waitForElementPresent("_qf_Registration_upload-bottom");
 
-    $this->check("is_online_registration");
+    $this->click("is_online_registration");
     $this->assertChecked("is_online_registration");
 
-    $this->fillRichTextField("intro_text", "Fill in all the fields below and click Continue.");
+    $this->fillRichTextField("intro_text", "Fill in all the fields below and click Continue.", 'CKEditor', TRUE);
 
     // enable confirmation email
     $this->click("CIVICRM_QFID_1_is_email_confirm");
@@ -334,8 +359,8 @@ class WebTest_Import_MatchExternalIdTest extends ImportCiviSeleniumTestCase {
     $this->type("confirm_from_email", "jane.doe@example.org");
 
     $this->click("_qf_Registration_upload-bottom");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->waitForText('crm-notification-container', "Saved");
+    $this->waitForElementPresent("_qf_Registration_upload-bottom");
+    $this->waitForText('crm-notification-container', "'Online Registration' information has been saved");
 
     // verify event input on info page
     // start at Manage Events listing