// Create new group
$parentGroupName = 'TestSuffixPrefixGender_' . substr(sha1(rand()), 0, 7);
- $this->addContactGroup($parentGroupName);
+ $this->WebtestAddGroup($parentGroupName);
// Adding Parent group contact
// We're using Quick Add block on the main page for this.
// Add to group.
$this->select("group_id", "label=$parentGroupName");
$this->click("_qf_GroupContact_next");
- $this->waitForElementPresent("//*[@id='GroupContact']");
+ $this->waitForAjaxContent();
$secondContactName = 'TestExport2' . substr(sha1(rand()), 0, 7);
list($emailContactSecond,$prefixLabelContactScnd,$suffixLabelContactScnd,$genderLabelContactScnd) = WebTest_Export_ContactTest::webtestAddContactWithGenderPrefixSuffix($secondContactName, "John", "$secondContactName.john@example.org", Null);
// Add to group.
$this->select("group_id", "label=$parentGroupName");
$this->click("_qf_GroupContact_next");
- $this->waitForElementPresent("//*[@id='GroupContact']");
+ $this->waitForAjaxContent();
$this->openCiviPage("contact/search", "reset=1");
$this->select("group", "label=$parentGroupName");
// Click to search.
- $this->click("_qf_Basic_refresh");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("_qf_Basic_refresh");
// Is contact present in search result?
$this->assertElementContainsText('css=div.crm-search-results', $sortFirstName, "Contact did not found in search result!");
// Create new group
$parentGroupName = 'Parentgroup_' . substr(sha1(rand()), 0, 7);
- $this->addContactGroup($parentGroupName);
+ $this->WebtestAddGroup($parentGroupName);
// Create new group and select the previously selected group as parent group for this new group.
$childGroupName = 'Childgroup_' . substr(sha1(rand()), 0, 7);
- $this->addContactGroup($childGroupName, $parentGroupName);
+ $this->WebtestAddGroup($childGroupName, $parentGroupName);
// Adding Parent group contact
// We're using Quick Add block on the main page for this.
// Add to group.
$this->select("group_id", "label=$parentGroupName");
$this->click("_qf_GroupContact_next");
- $this->waitForElementPresent("//*[@id='GroupContact']");
+ $this->waitForAjaxContent();
// Adding child group contact
// We're using Quick Add block on the main page for this.
// Add to child group.
$this->select("group_id", "label=regexp:$childGroupName");
$this->click("_qf_GroupContact_next");
- $this->waitForElementPresent("//*[@id='GroupContact']");
+ $this->waitForAjaxContent();
// Visit contact search page.
$this->openCiviPage("contact/search", "reset=1");
$this->select("group", "label=$parentGroupName");
// Click to search.
- $this->click("_qf_Basic_refresh");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("_qf_Basic_refresh");
// Is contact present in search result?
$this->assertElementContainsText('css=div.crm-search-results', $sortName, "Contact did not found in search result!");
// Create new group
$groupName = 'TestGroup_' . substr(sha1(rand()), 0, 7);
- $this->addContactGroup($groupName);
+ $this->WebtestAddGroup($groupName);
// Adding Parent group contact
// We're using Quick Add block on the main page for this.
// Add to group.
$this->select("group_id", "label=$groupName");
$this->click("_qf_GroupContact_next");
- $this->waitForElementPresent("//*[@id='GroupContact']");
+ $this->waitForAjaxContent();
$firstName1 = 'aa' . substr(sha1(rand()), 0, 5);
$this->webtestAddContact($firstName1, "Smith", "{$firstName1}.smith@example.org");
// Add to group.
$this->select("group_id", "label=$groupName");
$this->click("_qf_GroupContact_next");
- $this->waitForElementPresent("//*[@id='GroupContact']");
+ $this->waitForAjaxContent();
$firstName2 = 'bb' . substr(sha1(rand()), 0, 5);
// Add to group.
$this->select("group_id", "label=$groupName");
$this->click("_qf_GroupContact_next");
- $this->waitForElementPresent("//*[@id='GroupContact']");
+ $this->waitForAjaxContent();
$this->openCiviPage("contact/search", "reset=1", NULL);
$this->select("group", "label=$groupName");
// Click to search.
- $this->click("_qf_Basic_refresh");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("_qf_Basic_refresh");
// Is contact present in search result?
$this->assertElementContainsText('css=div.crm-search-results', $sortName1, "Contact did not found in search result!");
$this->reviewCSV($csvFile, $checkHeaders, $checkRows, 2);
}
- /**
- * @param string $groupName
- * @param string $parentGroupName
- */
- function addContactGroup($groupName = 'New Group', $parentGroupName = "- select group -") {
- $this->openCiviPage("group/add", "reset=1", "_qf_Edit_upload");
-
- // Fill group name.
- $this->type("title", $groupName);
-
- // Fill description.
- $this->type("description", "Adding new group.");
-
- // Check Access Control.
- $this->click("group_type[1]");
-
- // Check Mailing List.
- $this->click("group_type[2]");
-
- // Select Visibility as Public Pages.
- $this->select("visibility", "value=Public Pages");
-
- // Select parent group.
- $this->select("parents", "label=$parentGroupName");
-
- // Clicking save.
- $this->click("_qf_Edit_upload");
- $this->waitForPageToLoad($this->getTimeoutMsec());
-
- // Is status message correct?
- $this->waitForText('crm-notification-container', "The Group '$groupName' has been saved.");
- }
-
/**
* @param string $fname
* @param string $lname
) {
// Go to contact import page.
- $this->open($this->sboxPath . $this->_getImportComponentUrl($component));
-
- $this->waitForPageToLoad($this->getTimeoutMsec());
-
- // check for upload field.
- $this->waitForElementPresent("uploadFile");
+ $this->openCiviPage($this->_getImportComponentUrl($component), 'reset=1', "uploadFile");
// Create csv file of sample data.
$csvFile = $this->webtestCreateCSV($headers, $rows);
* @param array $other
* @param string $type
*/
- function importContacts($headers, $rows, $contactType = 'Individual', $mode = 'Skip', $fieldMapper = array(
- ), $other = array(), $type = 'csv') {
+ function importContacts($headers, $rows, $contactType = 'Individual', $mode = 'Skip', $fieldMapper = array(), $other = array(), $type = 'csv') {
// Go to contact import page.
$this->openCiviPage("import/contact", "reset=1", "uploadFile");
// Select contact subtype
if (isset($other['contactSubtype'])) {
- if ($contactType != 'Individual') {
- // Because it tends to cause problems, all uses of sleep() must be justified in comments
- // Sleep should never be used for wait for anything to load from the server
- // FIXME: this is bad, using sleep to wait for AJAX
- // Need to use a better way to wait for contact subtypes to repopulate
- sleep(5);
- }
- $this->waitForElementPresent("subType");
- $this->select('subType', 'label=' . $other['contactSubtype']);
+ $this->waitForElementPresent("css=#subType option[value={$other['contactSubtype']}]");
+ $this->select('subType', $other['contactSubtype']);
}
if (isset($other['dedupe'])) {
}
// Submit form.
- $this->click('_qf_DataSource_upload');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink('_qf_DataSource_upload');
if (isset($other['checkMapperHeaders'])) {
$checkMapperHeaders = $other['checkMapperHeaders'];
*
* @return mixed
*/
- function _getImportComponentUrl($component) {
-
+ private function _getImportComponentUrl($component) {
$importComponentUrl = array(
- 'Event' => 'civicrm/event/import?reset=1',
- 'Contribution' => 'civicrm/contribute/import?reset=1',
- 'Membership' => 'civicrm/member/import?reset=1',
- 'Activity' => 'civicrm/import/activity?reset=1',
+ 'Event' => 'event/import',
+ 'Contribution' => 'contribute/import',
+ 'Membership' => 'member/import',
+ 'Activity' => 'import/activity',
);
return $importComponentUrl[$component];