Merge pull request #2975 from atif-shaikh/WebTextFix
[civicrm-core.git] / tests / phpunit / WebTest / Import / ImportCiviSeleniumTestCase.php
index 68ab6a87b24b977ad3984eaf1dd1b941ece06146..0e2c0e3354506b91f5bf1f7215cf0175cc54f322 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -24,7 +24,6 @@
  +--------------------------------------------------------------------+
 */
 
-
 require_once 'CiviTest/CiviSeleniumTestCase.php';
 require_once 'CRM/Utils/Array.php';
 class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase {
@@ -39,7 +38,8 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase {
      * @params string $mode        import mode
      * @params array  $fieldMapper select mapper fields while import
      * @params array  $other       other parameters
-     *                             useMappingName     : to reuse mapping 
+     *                             useMappingName     : to reuse mapping
+
      *                             dateFormat         : date format of data
      *                             checkMapperHeaders : to override default check mapper headers
      *                             saveMapping        : save current mapping?
@@ -108,7 +108,7 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase {
     }
 
     // Submit form.
-    $this->click('_qf_UploadFile_upload');
+    $this->click('_qf_DataSource_upload');
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // Select matching field for cvs data.
@@ -142,11 +142,7 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase {
     $this->_checkImportMapperData($headers, $rows, $existingMapping, isset($other['checkMapperHeaders']) ? $other['checkMapperHeaders'] : array());
 
     // Submit form.
-    $this->click('_qf_Preview_next-bottom');
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-
-    // Visit summary page.
-    $this->waitForElementPresent("_qf_Summary_next");
+    $this->clickLink('_qf_Preview_next-bottom', "_qf_Summary_next");
 
     // Check success message.
     $this->assertTrue($this->isTextPresent("Import has completed successfully. The information below summarizes the results."));
@@ -172,7 +168,8 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase {
      * @params string $mode        import mode
      * @params array  $fieldMapper select mapper fields while import
      * @params array  $other       other parameters
-     *                             contactSubtype     : import for selected Contact Subtype           
+     *                             contactSubtype     : import for selected Contact Subtype
+
      *                             useMappingName     : to reuse mapping
      *                             dateFormat         : date format of data
      *                             checkMapperHeaders : to override default check mapper headers
@@ -187,7 +184,8 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase {
      *                             callbackImportSummary : function to override default import summary assertions
      *
      * @params string $type        import type (csv/sql)
-     *                             @todo:currently only supports csv, need to work on sql import 
+     *                             @todo:currently only supports csv, need to work on sql import
+
      */
   function importContacts($headers, $rows, $contactType = 'Individual', $mode = 'Skip', $fieldMapper = array(
     ), $other = array(), $type = 'csv') {
@@ -433,7 +431,8 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase {
      *
      * @params string $component component name
      *
-     * @return string import url 
+     * @return string import url
+
      */
   function _getImportComponentUrl($component) {
 
@@ -452,7 +451,8 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase {
      *
      * @params string $component component name
      *
-     * @return string import url 
+     * @return string import url
+
      */
   function _getImportComponentContactType($component, $contactType) {
     $importComponentMode = array(
@@ -520,7 +520,8 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase {
      * Helper function to get imported contact ids.
      *
      * @params array  $rows        fields rows
-     * @params string $contactType contact type 
+     * @params string $contactType contact type
+
      *
      * @return array  $contactIds  imported contact ids
      */
@@ -549,16 +550,14 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase {
       $this->typeKeys("css=input#sort_name_navigation", $searchName);
 
       // Wait for result list.
-      $this->waitForElementPresent("css=div.ac_results-inner li");
+      $this->waitForElementPresent("css=ul.ui-autocomplete li");
 
       // Visit contact summary page.
-      $this->click("css=div.ac_results-inner li");
+      $this->click("css=ul.ui-autocomplete li");
       $this->waitForPageToLoad($this->getTimeoutMsec());
 
       // Get contact id from url.
-      $matches = array();
-      preg_match('/cid=([0-9]+)/', $this->getLocation(), $matches);
-      $contactIds[] = $matches[1];
+      $contactIds[] = $this->urlArg('cid');
     }
 
     return $contactIds;