-- webtest cleanup (used openCiviPage function in place of open)
authorRavish Nair <ravish@ravish.(none)>
Fri, 1 Mar 2013 13:06:25 +0000 (18:36 +0530)
committerRavish Nair <ravish@ravish.(none)>
Fri, 1 Mar 2013 13:06:25 +0000 (18:36 +0530)
tests/phpunit/WebTest/Export/ContactTest.php
tests/phpunit/WebTest/Generic/CheckActivityTest.php
tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php

index 268ae3070a8b8cec744ba4123b2857f5c136cdf1..3760756b65b490181b22329908503e02d58260c9 100644 (file)
@@ -90,7 +90,7 @@ class WebTest_Export_ContactTest extends ExportCiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // Visit contact search page.
-    $this->open($this->sboxPath . "civicrm/contact/search?reset=1");
+    $this->openCiviPage("contact/search", "reset=1");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // Select contact type as Indiividual.
@@ -173,7 +173,7 @@ class WebTest_Export_ContactTest extends ExportCiviSeleniumTestCase {
     // We're using Quick Add block on the main page for this.
     $houseHold = 'H' . substr(sha1(rand()), 0, 5) . ' House';
 
-    $this->open($this->sboxPath . 'civicrm/contact/add?reset=1&ct=Household');
+    $this->openCiviPage("contact/add", "reset=1&ct=Household");
     $this->click('household_name');
     $this->type('household_name', $houseHold);
 
@@ -221,8 +221,7 @@ class WebTest_Export_ContactTest extends ExportCiviSeleniumTestCase {
 
     $firstName2 = 'bb' . substr(sha1(rand()), 0, 5);
 
-    $this->open($this->sboxPath . 'civicrm/contact/add?reset=1&ct=Individual');
-    $this->waitForElementPresent('_qf_Contact_upload_view-bottom');
+    $this->openCiviPage("contact/add", "reset=1&ct=Individual", "_qf_Contact_upload_view-bottom");
     $this->type('first_name', $firstName2);
     $this->type('last_name', "Smith");
     $this->type('email_1_email', "{$firstName2}.smith@example.org");
@@ -254,7 +253,7 @@ class WebTest_Export_ContactTest extends ExportCiviSeleniumTestCase {
     $this->click("_qf_GroupContact_next");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    $this->open($this->sboxPath . "civicrm/contact/search?reset=1");
+    $this->openCiviPage("contact/search", "reset=1");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // Select group.
@@ -319,11 +318,7 @@ class WebTest_Export_ContactTest extends ExportCiviSeleniumTestCase {
   }
 
   function addContactGroup($groupName = 'New Group', $parentGroupName = "- select -") {
-    $this->open($this->sboxPath . "civicrm/group/add?reset=1");
-
-    // As mentioned before, waitForPageToLoad is not always reliable. Below, we're waiting for the submit
-    // button at the end of this page to show up, to make sure it's fully loaded.
-    $this->waitForElementPresent("_qf_Edit_upload");
+    $this->openCiviPage("group/add", "reset=1", "_qf_Edit_upload");
 
     // Fill group name.
     $this->type("title", $groupName);
index 0338dcbd22702cd35929a20f8776386969c2f402..537b8282e64bffd41f44e327cbbd85748d621caa 100644 (file)
@@ -50,10 +50,8 @@ class WebTest_Generic_CheckActivityTest extends CiviSeleniumTestCase {
     // We're using Quick Add block on the main page for this.
     $contactFirstName2 = substr(sha1(rand()), 0, 7);
     $this->webtestAddContact($contactFirstName2, "Anderson", TRUE);
-    $this->open($this->sboxPath . "civicrm/activity?reset=1&action=add&context=standalone");
+    $this->openCiviPage("activity", "reset=1&action=add&context=standalone", "_qf_Activity_upload");
 
-    // make sure the form loaded, check the end element
-    $this->waitForElementPresent("_qf_Activity_upload");
     $this->select("activity_type_id", "label=Meeting");
 
     $this->click("css=tr.crm-activity-form-block-target_contact_id input#token-input-contact_1");
index d1f22a098c376471ce29584a3a20e1d748b09d25..3dd39b2ba2c541ffb3ba73ac8c35df92c04b2af4 100644 (file)
@@ -108,9 +108,7 @@ class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase {
   function testContributionDashboard() {
     $this->login();
     // Enable CiviContribute module if necessary
-    $this->open($this->sboxPath . "civicrm/admin/setting/component?reset=1");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->waitForElementPresent("_qf_Component_next-bottom");
+    $this->openCiviPage("admin/setting/component", "reset=1", "_qf_Component_next-bottom");
     $enabledComponents = $this->getSelectOptions("enableComponents-t");
     if (!in_array("CiviContribute", $enabledComponents)) {
       $this->addSelection("enableComponents-f", "label=CiviContribute");
@@ -135,9 +133,7 @@ class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase {
     $this->login();
 
     // Enable CiviEvent module if necessary
-    $this->open($this->sboxPath . "civicrm/admin/setting/component?reset=1");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->waitForElementPresent("_qf_Component_next-bottom");
+    $this->openCiviPage("admin/setting/component", "reset=1", "_qf_Component_next-bottom");
     $enabledComponents = $this->getSelectOptions("enableComponents-t");
     if (!in_array("CiviEvent", $enabledComponents)) {
       $this->addSelection("enableComponents-f", "label=CiviEvent");
@@ -170,9 +166,7 @@ class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase {
     $this->login();
 
     // Enable CiviMember module if necessary
-    $this->open($this->sboxPath . "civicrm/admin/setting/component?reset=1");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->waitForElementPresent("_qf_Component_next-bottom");
+    $this->openCiviPage("admin/setting/component", "reset=1", "_qf_Component_next-bottom");
     $enabledComponents = $this->getSelectOptions("enableComponents-t");
     if (!in_array("CiviMember", $enabledComponents)) {
       $this->addSelection("enableComponents-f", "label=CiviMember");
@@ -197,9 +191,7 @@ class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase {
     $this->login();
 
     // Enable CiviContribute module if necessary
-    $this->open($this->sboxPath . "civicrm/admin/setting/component?reset=1");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->waitForElementPresent("_qf_Component_next-bottom");
+    $this->openCiviPage("admin/setting/component", "reset=1", "_qf_Component_next-bottom");
     $enabledComponents = $this->getSelectOptions("enableComponents-t");
     if (!in_array("CiviContribute", $enabledComponents)) {
       $this->addSelection("enableComponents-f", "label=CiviContribute");
@@ -233,9 +225,7 @@ class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase {
     $this->login();
 
     // Enable CiviMail module if necessary
-    $this->open($this->sboxPath . "civicrm/admin/setting/component?reset=1");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->waitForElementPresent("_qf_Component_next-bottom");
+    $this->openCiviPage("admin/setting/component", "reset=1", "_qf_Component_next-bottom");
     $enabledComponents = $this->getSelectOptions("enableComponents-t");
     if (!in_array("CiviMail", $enabledComponents)) {
       $this->addSelection("enableComponents-f", "label=CiviMail");
@@ -246,8 +236,7 @@ class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase {
     }
 
     // configure default mail-box
-    $this->open($this->sboxPath . "civicrm/admin/mailSettings?action=update&id=1&reset=1");
-    $this->waitForElementPresent('_qf_MailSettings_cancel-bottom');
+    $this->openCiviPage("admin/mailSettings", "action=update&id=1&reset=1", "_qf_MailSettings_cancel-bottom");
     $this->type('name', 'Test Domain');
     $this->type('domain', 'example.com');
     $this->select('protocol', 'value=1');