From cb5b38f1e63b79943ed349bb1b9438ca47c66acd Mon Sep 17 00:00:00 2001 From: Ravish Nair Date: Fri, 1 Mar 2013 18:36:25 +0530 Subject: [PATCH] -- webtest cleanup (used openCiviPage function in place of open) --- tests/phpunit/WebTest/Export/ContactTest.php | 15 ++++-------- .../WebTest/Generic/CheckActivityTest.php | 4 +--- .../Generic/GeneralClickAroundTest.php | 23 +++++-------------- 3 files changed, 12 insertions(+), 30 deletions(-) diff --git a/tests/phpunit/WebTest/Export/ContactTest.php b/tests/phpunit/WebTest/Export/ContactTest.php index 268ae3070a..3760756b65 100644 --- a/tests/phpunit/WebTest/Export/ContactTest.php +++ b/tests/phpunit/WebTest/Export/ContactTest.php @@ -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); diff --git a/tests/phpunit/WebTest/Generic/CheckActivityTest.php b/tests/phpunit/WebTest/Generic/CheckActivityTest.php index 0338dcbd22..537b8282e6 100644 --- a/tests/phpunit/WebTest/Generic/CheckActivityTest.php +++ b/tests/phpunit/WebTest/Generic/CheckActivityTest.php @@ -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"); diff --git a/tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php b/tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php index d1f22a098c..3dd39b2ba2 100644 --- a/tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php +++ b/tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php @@ -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'); -- 2.25.1