From: monishdeb Date: Sat, 30 Aug 2014 15:16:07 +0000 (+0530) Subject: 4.5 Webtests fixes X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=5dac229eb87;p=civicrm-core.git 4.5 Webtests fixes --- diff --git a/js/crm.ajax.js b/js/crm.ajax.js index 2dbcdb738f..6fb3eba935 100644 --- a/js/crm.ajax.js +++ b/js/crm.ajax.js @@ -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); diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index d4e257f952..f1c799aace 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -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('

{$text}

');"); @@ -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( diff --git a/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php b/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php index ef2f704323..6188c6a1dc 100644 --- a/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php @@ -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"); } } -