* @return mixed either a string with the (either generated or provided) email or null (if no email)
*/
function webtestAddContact($fname = 'Anthony', $lname = 'Anderson', $email = NULL, $contactSubtype = NULL) {
- $url = $this->sboxPath . 'civicrm/contact/add?reset=1&ct=Individual';
+ $args = 'reset=1&ct=Individual';
if ($contactSubtype) {
- $url = $url . "&cst={$contactSubtype}";
+ $args .= "&cst={$contactSubtype}";
}
- $this->open($url);
- $this->waitForElementPresent('_qf_Contact_upload_view-bottom');
+ $this->openCiviPage('contact/add', $args, '_qf_Contact_upload_view-bottom');
$this->type('first_name', $fname);
$this->type('last_name', $lname);
if ($email === TRUE) {
if ($email) {
$this->type('email_1_email', $email);
}
- $this->waitForElementPresent('_qf_Contact_upload_view-bottom');
- $this->click('_qf_Contact_upload_view-bottom');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink('_qf_Contact_upload_view-bottom');
return $email;
}
* @return null|string
*/
function webtestAddHousehold($householdName = "Smith's Home", $email = NULL) {
-
$this->openCiviPage("contact/add", "reset=1&ct=Household");
$this->click('household_name');
$this->type('household_name', $householdName);
$this->type('email_1_email', $email);
}
- $this->click('_qf_Contact_upload_view');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink('_qf_Contact_upload_view');
return $email;
}
* @return null|string
*/
function webtestAddOrganization($organizationName = "Organization XYZ", $email = NULL, $contactSubtype = NULL) {
-
- $url = $this->sboxPath . 'civicrm/contact/add?reset=1&ct=Organization';
+ $args = 'reset=1&ct=Organization';
if ($contactSubtype) {
- $url = $url . "&cst={$contactSubtype}";
+ $args .= "&cst={$contactSubtype}";
}
- $this->open($url);
+ $this->openCiviPage('contact/add', $args, '_qf_Contact_upload_view-bottom');
$this->click('organization_name');
$this->type('organization_name', $organizationName);
if ($email) {
$this->type('email_1_email', $email);
}
- $this->click('_qf_Contact_upload_view');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink('_qf_Contact_upload_view');
return $email;
}
$paymentProcessorLink = $this->getAttribute("xpath=//table[@class='selector row-highlight']//tbody//tr/td[text()='{$processorName}']/../td[7]/span/a[1]@href");
return $this->urlArg('id', $paymentProcessorLink);
}
-
+
function webtestAddCreditCardDetails() {
$this->waitForElementPresent('credit_card_type');
$this->select('credit_card_type', 'label=Visa');
else {
$text = "The financial type \"{$financialType['name']}\" has been updated.";
}
- $this->assertSuccessMsg($text);
+ $this->checkCRMAlert($text);
}
/**
}
/**
- * Wait for unobtrusive status message as set by CRM.status
+ * Check for unobtrusive status message as set by CRM.status
*/
- function waitForStatusMsg() {
+ function checkCRMStatus($text=NULL) {
$this->waitForElementPresent("css=.crm-status-box-outer.status-success");
+ if ($text) {
+ $this->assertElementContainsText("css=.crm-status-box-outer.status-success", $text);
+ }
}
-
+
/**
- * Wait for unobtrusive status message as set by CRM.status
+ * Check for obtrusive status message as set by CRM.alert
*/
- function assertSuccessMsg($text) {
- $this->waitForElementPresent("css=div.success");
- $this->assertElementContainsText("css=div.success", $text);
+ function checkCRMAlert($text, $type='success') {
+ $this->waitForElementPresent("css=div.ui-notify-message.$type");
+ $this->waitForText("css=div.ui-notify-message.$type", $text);
}
-
+
/**
* function to enable or disable Pop-ups via Display Preferences
*/
$this->click('ajaxPopupsEnabled');
}
if ($enabled) {
- $this->assertChecked('ajaxPopupsEnabled');
+ $this->assertChecked('ajaxPopupsEnabled');
}
else {
$this->assertNotChecked('ajaxPopupsEnabled');