<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.4 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
+--------------------------------------------------------------------+
*/
-
require_once 'WebTest/Export/ExportCiviSeleniumTestCase.php';
class WebTest_Export_ContactTest extends ExportCiviSeleniumTestCase {
* Test Contact Export.
*/
function testContactExport() {
- $this->open($this->sboxPath);
-
- // Logging in. Remember to wait for page to load. In most cases,
- // you can rely on 30000 as the value that allows your test to pass, however,
- // sometimes your test might fail because of this. In such cases, it's better to pick one element
- // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole
- // page contents loaded and you can continue your test execution.
$this->webtestLogin();
// Create new group
$this->waitForPageToLoad($this->getTimeoutMsec());
// Visit contact search page.
- $this->open($this->sboxPath . "civicrm/contact/search?reset=1");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->openCiviPage("contact/search", "reset=1");
// Select contact type as Indiividual.
$this->select("contact_type", "value=Individual");
$this->waitForPageToLoad($this->getTimeoutMsec());
// Is contact present in search result?
- $this->assertTrue($this->isTextPresent("$sortName"), "Contact did not found in search result!");
+ $this->assertElementContainsText('css=div.crm-search-results', $sortName, "Contact did not found in search result!");
// Is contact present in search result?
- $this->assertTrue($this->isTextPresent("$childSortName"), "Contact did not found in search result!");
+ $this->assertElementContainsText('css=div.crm-search-results', $childSortName, "Contact did not found in search result!");
// select to export all the contasct from search result.
$this->click("CIVICRM_QFID_ts_all_4");
}
function testMergeHousehold() {
- $this->open($this->sboxPath);
-
- // Logging in. Remember to wait for page to load. In most cases,
- // you can rely on 30000 as the value that allows your test to pass, however,
- // sometimes your test might fail because of this. In such cases, it's better to pick one element
- // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole
- // page contents loaded and you can continue your test execution.
$this->webtestLogin();
// Create new group
// 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);
$this->type("address_1_street_address", "121A Sherman St. Apt. 12");
$this->type("address_1_city", "Dumfries");
$this->type("address_1_postal_code", "1234");
- $this->assertTrue($this->isTextPresent("- select - United States"));
+ $this->assertElementContainsText('address_1', "- select - United States");
$this->select("address_1_state_province_id", "value=1019");
$this->click('_qf_Contact_upload_view');
$this->click("_qf_GroupContact_next");
$this->waitForPageToLoad($this->getTimeoutMsec());
-
$firstName1 = 'aa' . substr(sha1(rand()), 0, 5);
$this->webtestAddContact($firstName1, "Smith", "{$firstName1}.smith@example.org");
$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");
$this->click("_qf_GroupContact_next");
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->open($this->sboxPath . "civicrm/contact/search?reset=1");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->openCiviPage("contact/search", "reset=1", NULL);
// Select group.
$this->select("group", "label=$groupName");
$this->waitForPageToLoad($this->getTimeoutMsec());
// Is contact present in search result?
- $this->assertTrue($this->isTextPresent("$sortName1"), "Contact did not found in search result!");
+ $this->assertElementContainsText('css=div.crm-search-results', $sortName1, "Contact did not found in search result!");
// Is contact present in search result?
- $this->assertTrue($this->isTextPresent("$sortName2"), "Contact did not found in search result!");
+ $this->assertElementContainsText('css=div.crm-search-results', $sortName2, "Contact did not found in search result!");
// Is contact present in search result?
- $this->assertTrue($this->isTextPresent("$houseHold"), "Contact did not found in search result!");
+ $this->assertElementContainsText('css=div.crm-search-results', $houseHold, "Contact did not found in search result!");
// select to export all the contasct from search result.
$this->click("CIVICRM_QFID_ts_all_4");
}
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);
$this->waitForPageToLoad($this->getTimeoutMsec());
// Is status message correct?
- $this->assertTrue($this->isTextPresent("The Group '$groupName' has been saved."));
+ $this->waitForText('crm-notification-container', "The Group '$groupName' has been saved.");
}
}
-