4.5 Webtests fixes
authormonishdeb <monish.deb@webaccessglobal.com>
Sat, 30 Aug 2014 15:16:07 +0000 (20:46 +0530)
committermonishdeb <monish.deb@webaccessglobal.com>
Sat, 30 Aug 2014 15:16:07 +0000 (20:46 +0530)
js/crm.ajax.js
tests/phpunit/CiviTest/CiviSeleniumTestCase.php
tests/phpunit/WebTest/Contribute/UpdateContributionTest.php

index 2dbcdb738fea73dccf1f9e46204a87cf7ba8a28f..6fb3eba935a869d29c00f5ee9f512066d5375fc6 100644 (file)
@@ -9,12 +9,15 @@
    * @param string|object params
    * @param string mode - optionally specify "front" or "back"
    */
-  var tplURL;
+  var tplURL = '/civicrm/example?placeholder';
+  var urlInitted = false;
   CRM.url = function (p, params, mode) {
     if (p == "init") {
-      return tplURL = params;
+      tplURL = params;
+      urlInitted = true;
+      return;
     }
-    if (!tplURL) {
+    if (!urlInitted) {
       console && console.log && console.log('Warning: CRM.url called before initialization');
     }
     if (!mode) {
@@ -22,7 +25,7 @@
     }
     params = params || '';
     var frag = p.split ('?');
-    var url = tplURL[mode].replace("civicrm/example", frag[0]);
+    var url = tplURL.replace("civicrm/example", frag[0]);
 
     if (typeof(params) == 'string') {
       url = url.replace("placeholder", params);
index d4e257f952cf524e5991f9d94b1056b6d5187156..f1c799aace9b3e2c8ffd5c0e8d70e7d9f63df3b8 100644 (file)
@@ -545,7 +545,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
     $this->fireEvent($fieldName, 'focus');
     if ($editor == 'CKEditor') {
       if ($compressed) {
-        $this->click("{$fieldName}-plain");        
+        $this->click("{$fieldName}-plain");
       }
       $this->waitForElementPresent("xpath=//div[@id='cke_{$fieldName}']//iframe");
       $this->runScript("CKEDITOR.instances['{$fieldName}'].setData('<p>{$text}</p>');");
@@ -2007,7 +2007,6 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
     $return = $this->addCustomGroupField($customSets);
 
     $this->openCiviPage($pageUrl['url'], $pageUrl['args']);
-
     foreach($return as $values) {
       foreach ($values as $entityType => $customData) {
         //initiate necessary variables
@@ -2037,7 +2036,6 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
             $this->select2($elementName, $entityData);
           }
         }
-
         //checking for proper custom data which is loading through ajax
         $this->waitForElementPresent("xpath=//div[contains(@class, 'custom-group-{$customData['cgtitle']}')]",
           "The on the fly custom group has not been rendered for entity : {$entity} => {$entityData}");
@@ -2073,16 +2071,17 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
 
       // Save
       $this->click('_qf_Group_next-bottom');
-      $this->waitForElementPresent('_qf_Field_cancel-bottom');
 
       //Is custom group created?
       $this->waitForText('crm-notification-container', "Your custom field set '{$customGroupTitle}' has been added.");
+      $this->click('css=a#newCustomField');
+
       $gid = $this->urlArg('gid');
+      $this->waitForTextPresent("{$customGroupTitle} - New Field");
 
       $fieldLabel = "custom_field_for_{$customSet['entity']}_{$customSet['subEntity']}" . substr(sha1(rand()), 0, 4);
       $this->type('label', $fieldLabel);
       $this->click('_qf_Field_next_new-bottom');
-      $this->waitForPageToLoad($this->getTimeoutMsec());
       $customGroupTitle = preg_replace('/\s/', '_', trim($customGroupTitle));
 
       $return[] = array(
index ef2f70432358ca14a41cde0cbc21af23c9c7d221..6188c6a1dc237e28d4d703a1bff1cba9139eec54 100644 (file)
@@ -101,6 +101,7 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase {
    $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE);
    $this->select("contribution_status_id", "label=Completed");
    $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE);
+   $this->waitForText('crm-notification-container', "The contribution record has been saved.");
 
    //Assertions
    $search = array('id' => $contId);
@@ -325,6 +326,7 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase {
    $contId = explode('&', $contId[1]);
    $contId = $contId[0];
    $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE);
+   $this->waitForText('crm-notification-container', "The contribution record has been saved.");
 
    //Assertions
    $search = array('id' => $contId);
@@ -360,6 +362,7 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase {
    $contId = explode('&', $contId[1]);
    $contId = $contId[0];
    $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE);
+   $this->waitForText('crm-notification-container', "The contribution record has been saved.");
 
    //Assertions
    $search = array( 'id' => $contId );
@@ -519,4 +522,3 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase {
    $this->click("_qf_ContributionView_cancel-bottom");
  }
 }
-