Skip to content

Commit

Permalink
Merge pull request #4 from ravishnair/webtest-fixes
Browse files Browse the repository at this point in the history
-- webtest cleanup (used openCiviPage function in place of open)
  • Loading branch information
kurund committed Mar 1, 2013
2 parents da5202b + cb5b38f commit 59535ee
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 30 deletions.
15 changes: 5 additions & 10 deletions tests/phpunit/WebTest/Export/ContactTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function testContactExport() {
$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.
Expand Down Expand Up @@ -173,7 +173,7 @@ function testMergeHousehold() {
// 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);

Expand Down Expand Up @@ -221,8 +221,7 @@ function testMergeHousehold() {

$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");
Expand Down Expand Up @@ -254,7 +253,7 @@ function testMergeHousehold() {
$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.
Expand Down Expand Up @@ -319,11 +318,7 @@ function testMergeHousehold() {
}

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);
Expand Down
4 changes: 1 addition & 3 deletions tests/phpunit/WebTest/Generic/CheckActivityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@ function testCheckDashboardElements() {
// 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");
Expand Down
23 changes: 6 additions & 17 deletions tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ function testManageGroups() {
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");
Expand All @@ -135,9 +133,7 @@ function testEventDashboard() {
$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");
Expand Down Expand Up @@ -170,9 +166,7 @@ function testMembershipsDashboard() {
$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");
Expand All @@ -197,9 +191,7 @@ function testFindContributions() {
$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");
Expand Down Expand Up @@ -233,9 +225,7 @@ function testNewMailing() {
$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");
Expand All @@ -246,8 +236,7 @@ function testNewMailing() {
}

// 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');
Expand Down

0 comments on commit 59535ee

Please sign in to comment.