) {
// 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];