}
/**
+ * Use a contact EntityRef field to add a new contact
+ * @param string $field selector
+ * @param string $contactType
+ * @return array of contact attributes (id, names, email)
+ */
+ function createDialogContact($field = 'contact_id', $contactType = 'Individual') {
+ $selectId = 's2id_' . $this->getAttribute($field . '@id');
+ $this->clickAt("xpath=//div[@id='$selectId']/a");
+ $this->clickAjaxLink("xpath=//li[@class='select2-no-results']//a[contains(text(), 'New $contactType')]", '_qf_Edit_next');
+
+ $name = substr(sha1(rand()), 0, rand(6, 8));
+ $params = array();
+ if ($contactType == 'Individual') {
+ $params['first_name'] = "$name $contactType";
+ $params['last_name'] = substr(sha1(rand()), 0, rand(5, 9));
+ }
+ else {
+ $params[strtolower($contactType) . '_name'] = "$name $contactType";
+ }
+ foreach($params as $param => $val) {
+ $this->type($param, $val);
+ }
+ $this->type('email-Primary', $params['email'] = "{$name}@example.com");
+ $this->clickAjaxLink('_qf_Edit_next');
+
+ $this->waitForText("xpath=//div[@id='$selectId']","$name");
+
+ $params['sort_name'] = $contactType == 'Individual' ? $params['last_name'] . ', ' . $params['first_name'] : "$name $contactType";
+ $params['display_name'] = $contactType == 'Individual' ? $params['first_name'] . ' ' . $params['last_name'] : $params['sort_name'];
+ $params['id'] = $this->getValue($field);
+ return $params;
+ }
+
+ /**
+ * @deprecated in favor of createDialogContact
*/
function webtestNewDialogContact($fname = 'Anthony', $lname = 'Anderson', $email = 'anthony@anderson.biz',
$type = 4, $selectId = 's2id_contact_id', $row = 1, $prefix = '') {
function testAddActivityToCase() {
// Log in as admin first to verify permissions for CiviCase
- $this->webtestLogin('true');
+ $this->webtestLogin('admin');
// Enable CiviCase module if necessary
$this->enableComponents("CiviCase");
// Adding contact with randomized first name (so we can then select that contact when creating case)
// We're using pop-up New Contact dialog
- $firstName = substr(sha1(rand()), 0, 7);
- $lastName = "Fraser";
- $contactName = "{$lastName}, {$firstName}";
- $displayName = "{$firstName} {$lastName}";
- $email = "{$lastName}.{$firstName}@example.org";
- $this->webtestNewDialogContact($firstName, $lastName, $email, $type = 4, "s2id_client_id");
+ $contact = $this->createDialogContact("client_id");
// Fill in other form values. We'll use a case type which is included in CiviCase sample data / xml files.
$caseTypeLabel = "Adult Day Care Referral";
$this->clickLink('_qf_Case_upload-bottom', '_qf_CaseView_cancel-bottom', FALSE);
// Is status message correct?
- $this->waitForText('crm-notification-container', "Case opened successfully.");
+ $this->checkCRMAlert("Case opened successfully.");
$customGroupTitle = 'Custom_' . substr(sha1(rand()), 0, 7);
- $this->_testAddNewActivity($firstName, $subject, $customGroupTitle, $contactName);
+ $this->_testAddNewActivity($contact['first_name'], $subject, $customGroupTitle, $contact['sort_name']);
}
function testLinkCases() {
// Adding contact with randomized first name (so we can then select that contact when creating case)
// We're using pop-up New Contact dialog
- $firstName = substr(sha1(rand()), 0, 7);
- $lastName = "Fraser";
- $contactName = "{$lastName}, {$firstName}";
- $displayName = "{$firstName} {$lastName}";
- $email = "{$lastName}.{$firstName}@example.org";
- $this->webtestNewDialogContact($firstName, $lastName, $email, $type = 4, "s2id_client_id");
+ $contact1 = $this->createDialogContact('client_id');
// Fill in other form values. We'll use a case type which is included in CiviCase sample data / xml files.
$caseTypeLabel = "Adult Day Care Referral";
$today = date('F jS, Y', strtotime('now'));
$this->type('duration', "20");
- $this->clickLink('_qf_Case_upload-bottom', '_qf_CaseView_cancel-bottom', FALSE);
+ $this->clickLink('_qf_Case_upload-bottom', '_qf_CaseView_cancel-bottom');
// Is status message correct?
- $this->waitForText('crm-notification-container', "Case opened successfully.");
+ $this->checkCRMAlert("Case opened successfully.");
//Add Case 2
$this->openCiviPage('case/add', 'reset=1&action=add&atype=13&context=standalone', '_qf_Case_upload-bottom');
// Adding contact with randomized first name (so we can then select that contact when creating case)
// We're using pop-up New Contact dialog
- $firstName2 = substr(sha1(rand()), 0, 7);
- $lastName2 = "Fraser";
- $contactName2 = "{$lastName}, {$firstName}";
- $displayName2 = "{$firstName} {$lastName}";
- $email2 = "{$lastName2}.{$firstName2}@example.org";
- $this->webtestNewDialogContact($firstName2, $lastName2, $email2, $type = 4, "s2id_client_id");
+ $contact2 = $this->createDialogContact('client_id');
// Fill in other form values. We'll use a case type which is included in CiviCase sample data / xml files.
$caseTypeLabel2 = "Adult Day Care Referral";
$today = date('F jS, Y', strtotime('now'));
$this->type('duration', "20");
- $this->clickLink('_qf_Case_upload-bottom', '_qf_CaseView_cancel-bottom', FALSE);
+ $this->clickLink('_qf_Case_upload-bottom', '_qf_CaseView_cancel-bottom');
// Is status message correct?
- $this->waitForText('crm-notification-container', "Case opened successfully.");
+ $this->checkCRMAlert("Case opened successfully.");
- //Add Link Case Activity
+ // We should now be on the "manage case" screen for case 2
+ //Add Link Case Activity to case 1
$this->select('add_activity_type_id', 'Link Cases');
$this->waitForElementPresent("_qf_Activity_cancel-bottom");
- $this->select2('link_to_case_id', $firstName);
+ $this->select2('link_to_case_id', $contact1['sort_name']);
$activitydetails = 'Details of Link Case Activity';
$this->fillRichTextField("details", $activitydetails, 'CKEditor');
- $this->click('activity-details');
- $this->waitForElementPresent('subject');
+ $this->click('css=#activity-details .crm-accordion-header');
+ $this->waitForVisible('subject');
$activitySubject = 'Link Case Activity between case 1 and case 2';
$activitylocation = 'Main Office Building';
- $this->select2('source_contact_id', $firstName2);
+ $this->select2('source_contact_id', $contact2['sort_name']);
$this->type('subject', $activitySubject);
$this->type('location', $activitylocation);
- $this->click('_qf_Activity_upload-bottom');
+ $this->clickAjaxLink('_qf_Activity_upload-bottom');
$id = $this->urlArg('id');
$this->waitForText("case_id_$id", $activitySubject);
$this->click("xpath=//a[contains(text(),'$activitySubject')]");
$LinkCaseActivityData = array(
- "Client" => $firstName2,
+ "Client" => $contact2['first_name'],
"Activity Type" => "Link Cases",
"Subject" => $activitySubject,
- "Reported By" => "{$firstName2} {$lastName2}",
+ "Reported By" => $contact2['display_name'],
"Medium" => "Phone",
"Location" => $activitylocation,
"Date and Time" => $today,
// Adding contact with randomized first name (so we can then select that contact when creating case)
// We're using pop-up New Contact dialog
- $firstName = substr(sha1(rand()), 0, 7);
- $lastName = "Fraser";
- $contactName = "{$lastName}, {$firstName}";
- $displayName = "{$firstName} {$lastName}";
- $email = "{$lastName}.{$firstName}@example.org";
- $this->webtestNewDialogContact($firstName, $lastName, $email, $type = 4, "s2id_client_id");
+ $client = $this->createDialogContact("client_id");
// Fill in other form values. We'll use a case type which is included in CiviCase sample data / xml files.
$caseTypeLabel = "Adult Day Care Referral";
$summaryStrings = array(
"Summary",
- $displayName,
+ $client['display_name'],
"Type: {$caseTypeLabel}",
"Open Date: {$today}",
"Status: {$caseStatusLabel}",
$this->_testVerifyCaseActivities($activityTypes);
$openCaseData = array(
- "Client" => $displayName,
+ "Client" => $client['display_name'],
"Activity Type" => "Open Case",
"Subject" => $subject,
"Created By" => "{$testUserFirstName} {$testUserLastName}",
$this->select("case_status_id","value=2");
$this->click("_qf_Activity_upload-top");
- $this->_testSearchbyDate($firstName, $lastName, "this.quarter");
- $this->_testSearchbyDate($firstName, $lastName, "0");
- $this->_testSearchbyDate($firstName, $lastName, "this.year");
- $this->_testAssignToClient($firstName, $lastName, $caseTypeLabel);
+ $this->_testSearchbyDate($client['first_name'], $client['last_name'], "this.quarter");
+ $this->_testSearchbyDate($client['first_name'], $client['last_name'], "0");
+ $this->_testSearchbyDate($client['first_name'], $client['last_name'], "this.year");
+ $this->_testAssignToClient($client['first_name'], $client['last_name'], $caseTypeLabel);
}
function testAjaxCustomGroupLoad() {
function _testAssignToClient($firstName, $lastName, $caseTypeLabel) {
$this->openCiviPage('case/search', 'reset=1', '_qf_Search_refresh-bottom');
$this->type('sort_name', $firstName);
- $this->click('_qf_Search_refresh-bottom');
+ $this->clickLink('_qf_Search_refresh-bottom');
$this->waitForElementPresent("xpath=//table[@class='caseSelector']/tbody//tr/td[3]/a[text()='{$lastName}, {$firstName}']");
- $this->click("xpath=//table[@class='caseSelector']/tbody//tr/td[3]/a[text()='{$lastName}, {$firstName}']/../../td[11]/span[2]/ul/li/a[contains(text(),'Assign to Another Client')]");
- $clientFirstName = substr(sha1(rand()), 0, 7);
- $clientLastName = "Fraser";
- $clientEmail = "{$clientLastName}.{$clientFirstName}@example.org";
- $this->waitForElementPresent('_qf_EditClient_done-bottom');
- $this->webtestNewDialogContact($clientFirstName, $clientLastName, $clientEmail, $type = 4, "s2id_reassign_contact_id");
+ $this->clickAjaxLink("xpath=//table[@class='caseSelector']/tbody//tr/td[3]/a[text()='{$lastName}, {$firstName}']/../../td[11]/span[2]/ul/li/a[contains(text(),'Assign to Another Client')]");
+ $client = $this->createDialogContact("reassign_contact_id");
$this->clickLink('_qf_EditClient_done-bottom');
- $this->assertElementContainsText('page-title', "$clientFirstName $clientLastName - $caseTypeLabel");
+ $this->assertElementContainsText('page-title', "{$client['display_name']} - $caseTypeLabel");
}
}
$this->clickAjaxLink("xpath=//div[@class='crm-submit-buttons']/span/input[@value='Save']", NULL);
$this->openCiviPage('case/add', 'reset=1&action=add&atype=13&context=standalone', '_qf_Case_upload-bottom');
- $firstName = substr(sha1(rand()), 0, 7);
- $lastName = "Fraser";
- $contactName = "{$lastName}, {$firstName}";
- $displayName = "{$firstName} {$lastName}";
- $email = "{$lastName}.{$firstName}@example.org";
- $this->webtestNewDialogContact($firstName, $lastName, $email, $type = 4, "s2id_client_id");
+ $client = $this->createDialogContact("client_id");
$caseStatusLabel = "Ongoing";
$subject = "Safe daytime setting - senior female";
// create custom group1
$this->openCiviPage('admin/custom/group', 'reset=1');
- $this->click("newCustomDataGroup");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("newCustomDataGroup");
$this->type("title", $customGrp1);
$this->select("extends[0]", "value=Case");
// Because it tends to cause problems, all uses of sleep() must be justified in comments
// Justification for this instance: FIXME
sleep(1);
$this->select("extends_1", "value=2");
- $this->click("_qf_Group_next-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("_qf_Group_next-bottom");
// get custom group id
$customGrpId1 = $this->urlArg('gid');
$this->openCiviPage('case/add', 'reset=1&action=add&atype=13&context=standalone', '_qf_Case_upload-bottom');
- // Try submitting the form without creating or selecting a contact (test for CRM-7971)
- $this->clickLink("_qf_Case_upload-bottom", "css=span.crm-error");
-
// Adding contact with randomized first name (so we can then select that contact when creating case)
- // We're using pop-up New Contact dialog
- $firstName = substr(sha1(rand()), 0, 7);
- $lastName = "Fraser";
- $contactName = "{$lastName}, {$firstName}";
- $displayName = "{$firstName} {$lastName}";
- $email = "{$lastName}.{$firstName}@example.org";
$custFname = "Mike" . substr(sha1(rand()), 0, 7);
$custMname = "Dav" . substr(sha1(rand()), 0, 7);
$custLname = "Krist" . substr(sha1(rand()), 0, 7);
- $this->webtestNewDialogContact($firstName, $lastName, $email, $type = 4, "s2id_client_id");
+ // We're using pop-up New Contact dialog
+ $client = $this->createDialogContact("client_id");
// Fill in other form values. We'll use a case type which is included in CiviCase sample data / xml files.
$caseTypeLabel = "Adult Day Care Referral";
- // activity types we expect for this case type
- $activityTypes = array("ADC referral", "Follow up", "Medical evaluation", "Mental health evaluation");
- $caseRoles = array("Senior Services Coordinator", "Health Services Coordinator", "Benefits Specialist", "Client");
$caseStatusLabel = "Ongoing";
$subject = "Safe daytime setting - senior female";
$this->select("medium_id", "value=1");
$this->type("activity_subject", $subject);
$this->select("case_type_id", "label={$caseTypeLabel}");
- // 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
- // Justification for this instance: FIXME
- sleep(3);
+ $this->waitForAjaxContent();
$this->select("status_id", "label={$caseStatusLabel}");
// Choose Case Start Date.
$this->clickLink("_qf_Case_upload-bottom", "_qf_CaseView_cancel-bottom");
// Is status message correct?
- $this->assertTextPresent("Case opened successfully.", "Save successful status message didn't show up after saving!");
- $this->click("_qf_CaseView_cancel-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->openCiviPage('case', 'reset=1', "xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$contactName}']/../../td[8]/a[text()='Open Case']");
- $this->click("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$contactName}']/../../td[8]/a[text()='Open Case']");
- $this->waitForElementPresent("xpath=//span[@class='ui-button-icon-primary ui-icon ui-icon-closethick']");
- // 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
- // Justification for this instance: FIXME
- sleep(3);
+ $this->checkCRMAlert("Case opened successfully.");
+ $this->clickLink("_qf_CaseView_cancel-bottom");
+ $this->openCiviPage('case', 'reset=1', "xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$client['sort_name']}']/../../td[8]/a[text()='Open Case']");
+ $this->clickAjaxLink("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$client['sort_name']}']/../../td[8]/a[text()='Open Case']");
$openCaseData = array(
- "Client" => $displayName,
+ "Client" => $client['display_name'],
"Activity Type" => "Open Case",
"Subject" => $subject,
"Created By" => "{$testUserFirstName} {$testUserLastName}",
// verify if custom data is present
$this->openCiviPage('case', 'reset=1');
- $this->click("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$contactName}']/../../td[9]/span/a[text()='Manage']");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->click("css=#{$customGrp1} .crm-accordion-header");
- $this->waitForElementPresent("css=#{$customGrp1} a.button");
+ $this->clickLink("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$client['sort_name']}']/../../td[9]/span/a[text()='Manage']");
+
+ $this->clickAjaxLink("css=#{$customGrp1} .crm-accordion-header", "css=#{$customGrp1} a.button");
$cusId_1 = 'custom_' . $customId[0] . '_1';
$cusId_2 = 'custom_' . $customId[1] . '_1';
$cusId_3 = 'custom_' . $customId[2] . '_1';
- $this->click("css=#{$customGrp1} a.button");
- // 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
- // Justification for this instance: FIXME
- sleep(2);
- $this->waitForElementPresent("{$cusId_1}");
+ $this->clickAjaxLink("css=#{$customGrp1} a.button", $cusId_1);
+
$custFname = "Miky" . substr(sha1(rand()), 0, 7);
$custMname = "Davy" . substr(sha1(rand()), 0, 7);
$custLname = "Kristy" . substr(sha1(rand()), 0, 7);
$this->type("{$cusId_1}", $custFname);
$this->type("{$cusId_2}", $custMname);
$this->type("{$cusId_3}", $custLname);
- $this->click("_qf_CustomData_upload");
- // 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
- // Justification for this instance: FIXME
- sleep(2);
+ $this->clickAjaxLink("_qf_CustomData_upload");
+
$this->openCiviPage('case', 'reset=1');
- $this->click("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$contactName}']/../../td[8]/a[text()='Change Custom Data']");
- // 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
- // Justification for this instance: FIXME
- sleep(3);
+ $this->clickAjaxLink("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$client['sort_name']}']/../../td[8]/a[text()='Change Custom Data']");
+
$openCaseChangeData = array(
- "Client" => $displayName,
+ "Client" => $client['display_name'],
"Activity Type" => "Change Custom Data",
"Subject" => $customGrp1 . " : change data",
"Created By" => "{$testUserFirstName} {$testUserLastName}",
"Priority" => "Normal",
);
$this->webtestVerifyTabularData($openCaseChangeData);
- $this->click("xpath=//span[@class='ui-button-icon-primary ui-icon ui-icon-closethick']");
- // 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
- // Justification for this instance: FIXME
- sleep(2);
$this->_testAdvansearchCaseData($customId, $custFname, $custMname, $custLname);
$this->_testDeleteCustomData($customGrpId1, $customId);
}
- /**
- * @param $validateStrings
- * @param $activityTypes
- */
- function _testVerifyCaseSummary($validateStrings, $activityTypes) {
- $this->assertStringsPresent($validateStrings);
- foreach ($activityTypes as $aType) {
- $this->assertText("activity_type_id", $aType);
- }
- $this->assertElementPresent("link=Assign to Another Client", "Assign to Another Client link is missing.");
- $this->assertElementPresent("name=case_report_all", "Print Case Summary button is missing.");
- }
-
/**
* @param $customGrpId1
* @param bool $noteRichEditor
*/
function _testGetCustomFieldId($customGrpId1, $noteRichEditor=FALSE) {
$customId = array();
+ $this->openCiviPage('admin/custom/group/field/add', array('reset' => 1, 'action' => 'add', 'gid' => $customGrpId1));
if ($noteRichEditor) {
// Create a custom data to add in profile
$field2 = "Note_Richtexteditor" . substr(sha1(rand()), 0, 7);
// add custom fields for group 1
- $this->openCiviPage('admin/custom/group/field/add', array('reset' => 1, 'action' => 'add', 'gid' => $customGrpId1));
$this->type("label", $field1);
$this->select("data_type_0", "value=4");
$this->select("data_type_1", "value=TextArea");
$field3 = "Lname" . substr(sha1(rand()), 0, 7);
// add custom fields for group 1
- $this->openCiviPage('admin/custom/group/field/add', array('reset' => 1, 'action' => 'add', 'gid' => $customGrpId1));
$this->type("label", $field1);
$this->check("is_searchable");
- $this->click("_qf_Field_next_new-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("_qf_Field_next_new-bottom");
$this->type("label", $field2);
$this->check("is_searchable");
- $this->click("_qf_Field_next_new-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("_qf_Field_next_new-bottom");
$this->type("label", $field3);
$this->check("is_searchable");
- $this->click("_qf_Field_done-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("_qf_Field_done-bottom");
// get id of custom fields
$this->openCiviPage("admin/custom/group/field", array('reset' => 1, 'action' => 'browse', 'gid' => $customGrpId1));
$this->openCiviPage('case/add', 'reset=1&action=add&atype=13&context=standalone', '_qf_Case_upload-bottom');
- // Try submitting the form without creating or selecting a contact (test for CRM-7971)
- $this->clickLink("_qf_Case_upload-bottom", "css=span.crm-error");
-
// Adding contact with randomized first name (so we can then select that contact when creating case)
- // We're using pop-up New Contact dialog
- $firstName = substr(sha1(rand()), 0, 7);
- $lastName = "Fraser";
- $contactName = "{$lastName}, {$firstName}";
- $displayName = "{$firstName} {$lastName}";
- $email = "{$lastName}.{$firstName}@example.org";
$custFname = "Mike" . substr(sha1(rand()), 0, 7);
$custLname = "Krist" . substr(sha1(rand()), 0, 7);
- $this->webtestNewDialogContact($firstName, $lastName, $email, $type = 4, "s2id_client_id");
+ // We're using pop-up New Contact dialog
+ $client = $this->createDialogContact("client_id");
// Fill in other form values. We'll use a case type which is included in CiviCase sample data / xml files.
$caseTypeLabel = "Adult Day Care Referral";
- // activity types we expect for this case type
- $activityTypes = array("ADC referral", "Follow up", "Medical evaluation", "Mental health evaluation");
- $caseRoles = array("Senior Services Coordinator", "Health Services Coordinator", "Benefits Specialist", "Client");
$caseStatusLabel = "Ongoing";
$subject = "Safe daytime setting - senior female";
$this->select("medium_id", "value=1");
$this->clickLink("_qf_Case_upload-bottom", "_qf_CaseView_cancel-bottom");
// Is status message correct?
- $this->assertTextPresent("Case opened successfully.", "Save successful status message didn't show up after saving!");
+ $this->checkCRMAlert("Case opened successfully.");
$this->clickLink("_qf_CaseView_cancel-bottom");
$this->openCiviPage('case', 'reset=1');
- $this->waitForElementPresent("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$contactName}']/../../td[8]/a[text()='Open Case']");
+ $this->waitForElementPresent("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$client['sort_name']}']/../../td[8]/a[text()='Open Case']");
- $this->click("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$contactName}']/../../td[8]/a[text()='Open Case']");
+ $this->click("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$client['sort_name']}']/../../td[8]/a[text()='Open Case']");
$openCaseData = array(
- "Client" => $displayName,
+ "Client" => $client['display_name'],
"Activity Type" => "Open Case",
"Subject" => $subject,
"Created By" => "{$testUserFirstName} {$testUserLastName}",
// verify if custom data is present
$this->openCiviPage('case', 'reset=1');
- $this->clickLink("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$contactName}']/../../td[9]/span/a[text()='Manage']", "css=#{$customGrp1} .crm-accordion-header");
+ $this->clickLink("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$client['sort_name']}']/../../td[9]/span/a[text()='Manage']", "css=#{$customGrp1} .crm-accordion-header");
$this->click("css=#{$customGrp1} .crm-accordion-header");
function testAllOrMyCases() {
// Log in as admin first to verify permissions for CiviCase
- $this->webtestLogin('true');
+ $this->webtestLogin('admin');
// Enable CiviCase module if necessary
$this->enableComponents("CiviCase");
//Add case to get drilldown cell on Case dashboard
$this->openCiviPage('case/add', 'reset=1&action=add&atype=13&context=standalone', '_qf_Case_upload-bottom');
- // Adding contact with randomized first name (so we can then select that contact when creating case)
// We're using pop-up New Contact dialog
- $firstName = substr(sha1(rand()), 0, 7);
- $lastName = "Fraser";
- $contactName = "{$lastName}, {$firstName}";
- $displayName = "{$firstName} {$lastName}";
- $email = "{$lastName}.{$firstName}@example.org";
- $this->webtestNewDialogContact($firstName, $lastName, $email, $type = 4, "s2id_client_id");
+ $this->createDialogContact('client_id');
// Fill in other form values. We'll use a case type which is included in CiviCase sample data / xml files.
$caseTypeLabel = "Adult Day Care Referral";
*
*/
function testSearchBuilderfinancialType() {
- // 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();
// add financial type
$financialType = $financialTypeName2;
}
// create new contact using dialog
- $firstName = substr(sha1(rand()), 0, 7);
- $this->webtestNewDialogContact($firstName, 'Contributor', $firstName . '@example.com');
+ $this->createDialogContact();
$this->select('financial_type_id', $financialType);
$this->type('total_amount', 100 * $i);
$this->clickLink('_qf_Contribution_upload_new', '_qf_Contribution_upload_new');
$this->openCiviPage("contact/search/builder", "reset=1", "_qf_Builder_refresh");
$this->enterValues(1, 1, 'Contribution', 'Financial Type', NULL, '=', array($financialTypeName1));
- $this->click('_qf_Builder_refresh');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink('_qf_Builder_refresh');
$this->assertTrue($this->isTextPresent('3 Contacts'), 'Missing text: ' . '3 Contacts');
$this->click("xpath=//div[@class='crm-accordion-header crm-master-accordion-header']");
$this->enterValues(1, 1, 'Contribution', 'Financial Type', NULL, '=', array($financialTypeName2));
- $this->click('_qf_Builder_refresh');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink('_qf_Builder_refresh');
+
$this->assertTrue($this->isTextPresent('3 Contacts'), 'Missing text: ' . '3 Contacts');
$this->click("xpath=//div[@class='crm-accordion-header crm-master-accordion-header']");
$financialTypeName1,
$financialTypeName2
));
- $this->click('_qf_Builder_refresh');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink('_qf_Builder_refresh');
+
$this->assertTrue($this->isTextPresent('6 Contacts'), 'Missing text: ' . '6 Contacts');
}
$this->openCiviPage("contribute/add", "reset=1&action=add&context=standalone", '_qf_Contribution_upload');
// create new contact using dialog
- $firstName = substr(sha1(rand()), 0, 7);
- $this->webtestNewDialogContact($firstName, 'Contributor', $firstName . '@example.com');
+ $this->createDialogContact();
// select financial type
$this->select('financial_type_id', "label={$financialType}");
$this->openCiviPage("contribute/add", "reset=1&action=add&context=standalone", '_qf_Contribution_upload');
// create new contact using dialog
- $firstName = substr(sha1(rand()), 0, 7);
- $this->webtestNewDialogContact($firstName, 'Contributor', $firstName . '@example.com');
+ $contact = $this->createDialogContact();
// select contribution type
$this->select('financial_type_id', "label={$financialType}");
// View Contribution Record and test for expected values
$expected = array(
- 'From' => "{$firstName} Contributor",
+ 'From' => $contact['display_name'],
'Financial Type' => $financialType,
'Contribution Amount' => 'Contribution Total: $ 590.00',
'Paid By' => 'Check',
);
// Retrieve contribution from the DB via api and verify DB values against view contribution page
- require_once 'api/api.php';
$fields = $this->webtest_civicrm_api('contribution', 'get', $params);
$params['id'] = $params['contact_id'] = $fields['values'][$fields['id']]['soft_credit_to'];
$this->openCiviPage("contribute/add", "reset=1&context=standalone", "_qf_Contribution_upload");
// create new contact using dialog
- $firstName = substr(sha1(rand()), 0, 7);
- $this->webtestNewDialogContact($firstName, "Contributor", $firstName . "@example.com");
+ $contact = $this->createDialogContact();
// select financial type
$this->select("financial_type_id", "value=1");
// verify soft credit details
$expected = array(
- 1 => "{$firstName} Contributor",
+ 1 => $contact['display_name'],
2 => 'Donation',
1 => '100.00',
6 => 'Completed',
$this->assertElementContainsText("xpath=//div[@id='search-status']/table/tbody/tr[1]/td[2]", "Financial Type IN {$financialType['name']}");
$this->openCiviPage("contact/search/advanced", "reset=1", "_qf_Advanced_refresh-top");
- $this->click('CiviContribute');
- $this->waitForElementPresent("financial_type_id");
+ $this->clickAjaxLink('CiviContribute', "financial_type_id");
// select group
$this->select("financial_type_id", "label={$financialType['name']}");
$this->openCiviPage("contribute/add", "reset=1&context=standalone", "_qf_Contribution_upload");
// create new contact using dialog
- $firstName = substr(sha1(rand()), 0, 7);
- $this->webtestNewDialogContact($firstName, "Contributor", $firstName . "@example.com");
+ $this->createDialogContact();
// select financial type
$this->select("financial_type_id", "label={$financialType['name']}");
$this->webtestFillDate('thankyou_date');
// Clicking save.
- $this->click("_qf_Contribution_upload");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("_qf_Contribution_upload");
// Is status message correct?
- $this->assertTrue($this->isTextPresent("The contribution record has been saved."), "Status message didn't show up after saving!");
+ $this->checkCRMAlert("The contribution record has been saved.");
// verify if Membership is created
$this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']");
$this->type("sort_name", "Contributor");
$this->click('contribution_status_id_2');
- $this->click("_qf_Search_refresh");
+ $this->clickLink("_qf_Search_refresh");
- $this->waitForPageToLoad($this->getTimeoutMsec());
$this->click('radio_ts', 'ts_all');
$this->select('task', "label=Update Pending Contribution Status");
- $this->click("_qf_Search_next_action");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("_qf_Search_next_action");
$this->select('contribution_status_id', 'label=Completed');
$this->click('_qf_Status_next');
$this->waitForElementPresent("_qf_Result_done");
}
function _testOfflineContribution() {
- $firstName = substr(sha1(rand()), 0, 7);
- $lastName = 'Contributor';
- $email = $firstName . "@example.com";
-
$this->openCiviPage("contribute/add", "reset=1&context=standalone", "_qf_Contribution_upload");
// create new contact using dialog
- $this->webtestNewDialogContact($firstName, "Contributor", $email);
+ $this->createDialogContact();
// select financial type
$this->select( "financial_type_id", "value=1" );
function testChangeContributionAmount() {
$this->webtestLogin();
- $firstName = substr(sha1(rand()), 0, 7);
- $lastName = 'Contributor';
- $email = $firstName . "@example.com";
$amount = 100;
//Offline Pay Later Contribution
- $this->_testOfflineContribution($firstName, $lastName, $email, $amount, "Pending");
+ $contact = $this->_testOfflineContribution($amount, "Pending");
$this->openCiviPage("contribute/search", "reset=1", "contribution_date_low");
- $this->type("sort_name", "$lastName, $firstName");
+ $this->type("sort_name", $contact['sort_name']);
$this->click("_qf_Search_refresh");
$this->waitForElementPresent("xpath=//*[@id='Search']//div[@id='contributionSearch']");
function testPayLater() {
$this->webtestLogin();
- $firstName = substr(sha1(rand()), 0, 7);
- $lastName = 'Contributor';
- $email = $firstName . "@example.com";
$amount = 100.00;
//Offline Pay Later Contribution
- $this->_testOfflineContribution($firstName, $lastName, $email, $amount, "Pending");
+ $this->_testOfflineContribution($amount, "Pending");
$this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
- $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
- $contId = explode('&', $contId[1]);
- $contId = $contId[0];
- $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE);
+ $contId = $this->urlArg('id', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
+ $this->clickAjaxLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom');
$this->select("contribution_status_id", "label=Completed");
- $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE);
- $this->waitForText('crm-notification-container', "The contribution record has been saved.");
+ $this->clickAjaxLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
+ $this->checkCRMAlert("The contribution record has been saved.");
//Assertions
$search = array('id' => $contId);
function testChangePremium() {
$this->webtestLogin();
- $firstName = substr(sha1(rand()), 0, 7);
- $lastName = 'Contributor';
- $email = $firstName . "@example.com";
$from = 'Premiums';
$to = 'Premiums inventory';
$financialType = array(
$this->openCiviPage("contribute/add", "reset=1&action=add&context=standalone");
// create new contact using dialog
- $this->webtestNewDialogContact($firstName, $lastName, $email);
+ $this->createDialogContact();
// select financial type
$this->select( "financial_type_id", "value=1" );
// total amount
$this->checkCRMAlert("The contribution record has been saved.");
// verify if Contribution is created
//click through to the Contribution edit screen
- $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
- $contId = explode('&', $contId[1]);
- $contId = $contId[0];
- $this->clickAjaxLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", "_qf_Contribution_upload-bottom");
- $this->waitForElementPresent("product_name_0");
+ $contId = $this->urlArg('id', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
+ $this->clickAjaxLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", "product_name_0");
+
$this->select('product_name_0', "label=$premiumName2 ( $sku2 )");
// Clicking save.
$this->clickAjaxLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[7][text()='$premiumName2']");
function testDeletePremium() {
$this->webtestLogin();
- $firstName = substr(sha1(rand()), 0, 7);
- $lastName = 'Contributor';
- $email = $firstName . "@example.com";
$from = 'Premiums';
$to = 'Premiums inventory';
$financialType = array(
$this->openCiviPage("contribute/add", "reset=1&action=add&context=standalone");
// create new contact using dialog
- $this->webtestNewDialogContact($firstName, $lastName, $email);
+ $this->createDialogContact();
// select financial type
$this->select("financial_type_id", "value=1");
// total amount
function testChangePaymentInstrument() {
$this->webtestLogin();
- $firstName = substr(sha1(rand()), 0, 7);
- $lastName = 'Contributor';
- $email = $firstName . "@example.com";
$label = 'TEST'.substr(sha1(rand()), 0, 7);
$amount = 100.00;
$financialAccount = CRM_Contribute_PseudoConstant::financialAccount();
$to = array_search('Accounts Receivable', $financialAccount);
$from = array_search('Deposit Bank Account', $financialAccount);
$this->addPaymentInstrument($label, $to);
- $this->_testOfflineContribution($firstName, $lastName, $email, $amount);
+ $this->_testOfflineContribution($amount);
$this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
$this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE);
$contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
function testRefundContribution() {
$this->webtestLogin();
- $firstName = substr(sha1(rand()), 0, 7);
- $lastName = 'Contributor';
- $email = $firstName . "@example.com";
- $label = 'TEST'.substr(sha1(rand()), 0, 7);
$amount = 100.00;
- $this->_testOfflineContribution($firstName, $lastName, $email, $amount);
+ $this->_testOfflineContribution($amount);
$this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
$this->clickAjaxLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom');
//Contribution status
function testCancelPayLater() {
$this->webtestLogin();
- $firstName = substr(sha1(rand()), 0, 7);
- $lastName = 'Contributor';
- $email = $firstName . "@example.com";
- $label = 'TEST'.substr(sha1(rand()), 0, 7);
$amount = 100.00;
- $this->_testOfflineContribution($firstName, $lastName, $email, $amount, "Pending");
+ $this->_testOfflineContribution($amount, "Pending");
$this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
$this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE);
//Contribution status
function testChangeFinancialType() {
$this->webtestLogin();
- $firstName = substr(sha1(rand()), 0, 7);
- $lastName = 'Contributor';
- $email = $firstName . "@example.com";
- $label = 'TEST'.substr(sha1(rand()), 0, 7);
$amount = 100.00;
- $this->_testOfflineContribution($firstName, $lastName, $email, $amount);
+ $this->_testOfflineContribution($amount);
$this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
$this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE);
//Contribution status
}
/**
- * @param $firstName
- * @param $lastName
- * @param $email
* @param $amount
* @param string $status
+ * @return array
*/
- function _testOfflineContribution($firstName, $lastName, $email, $amount, $status="Completed") {
+ function _testOfflineContribution($amount, $status="Completed") {
$this->openCiviPage("contribute/add", "reset=1&context=standalone", "_qf_Contribution_upload");
// create new contact using dialog
- $this->webtestNewDialogContact($firstName, $lastName, $email);
+ $contact = $this->createDialogContact();
// select financial type
$this->select( "financial_type_id", "value=1" );
$this->clickLink("_qf_Contribution_upload");
// Is status message correct?
- $this->waitForText('crm-notification-container', "The contribution record has been saved.");
+ $this->checkCRMAlert("The contribution record has been saved.");
$this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']");
// verify if Membership is created
);
$this->webtestVerifyTabularData($expected);
$this->click("_qf_ContributionView_cancel-bottom");
+
+ return $contact;
}
}
function testUpdatePendingContribution() {
$this->webtestLogin();
- $firstName = substr(sha1(rand()), 0, 7);
- $lastName = 'Contributor';
- $email = $firstName . "@example.com";
//Offline Pay Later Contribution
- $this->_testOfflineContribution($firstName, $lastName, $email);
+ $contact = $this->_testOfflineContribution();
//Online Pay Later Contribution
- $this->_testOnlineContribution($firstName, $lastName, $email);
+ $this->_testOnlineContribution($contact);
$this->openCiviPage("contribute/search", "reset=1", "contribution_date_low");
- $this->type("sort_name", "$lastName, $firstName");
+ $this->type("sort_name", $contact['sort_name']);
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad($this->getTimeoutMsec());
}
/**
- * @param $firstName
- * @param $lastName
- * @param $email
+ * @return array of contact details
*/
- function _testOfflineContribution($firstName, $lastName, $email) {
+ function _testOfflineContribution() {
// Create a contact to be used as soft creditor
$softCreditFname = substr(sha1(rand()), 0, 7);
$softCreditLname = substr(sha1(rand()), 0, 7);
$this->openCiviPage("contribute/add", "reset=1&context=standalone", "_qf_Contribution_upload");
// create new contact using dialog
- $this->webtestNewDialogContact($firstName, "Contributor", $email);
+ $contact = $this->createDialogContact();
// select financial type
$this->select( "financial_type_id", "value=1" );
4 => 'Donation',
2 => '100.00',
6 => 'Pending',
- 1 => "{$firstName} Contributor",
+ 1 => $contact['display_name'],
);
foreach ($expected as $value => $label) {
$this->verifyText("xpath=id('Search')/div[2]/table[2]/tbody/tr[2]/td[$value]", preg_quote($label));
}
+ return $contact;
}
/**
- * @param $firstName
- * @param $lastName
- * @param $email
+ * @param array $contact
*/
- function _testOnlineContribution($firstName, $lastName, $email) {
+ function _testOnlineContribution($contact) {
// Use default payment processor
$processorName = 'Test Processor';
$this->webtestLogout();
$this->openCiviPage("contribute/transact", "reset=1&id=$pageId", "_qf_Main_upload-bottom");
- $this->type("email-5", $email);
+ $this->type("email-5", $contact['email']);
- $this->type("first_name", $firstName);
- $this->type("last_name", $lastName);
+ $this->type("first_name", $contact['first_name']);
+ $this->type("last_name", $contact['last_name']);
$this->click("xpath=//div[@class='crm-section other_amount-section']//div[2]/input");
$this->type("xpath=//div[@class='crm-section other_amount-section']//div[2]/input", 100);
//Find Contribution
$this->openCiviPage("contribute/search", "reset=1", "contribution_date_low");
- $this->type("sort_name", "$lastName, $firstName");
+ $this->type("sort_name", $contact['sort_name']);
$this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[2]/td[11]/span/a[text()='View']");
$this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[2]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom", FALSE);
// View Contribution Record and test for expected values
$expected = array(
- 'From' => "{$firstName} {$lastName}",
+ 'From' => $contact['display_name'],
'Financial Type' => 'Donation',
'Total Amount' => '100.00',
'Contribution Status' => 'Pending : Pay Later',
}
function testEventParticipationAddWithMultipleRoles() {
-
- // Log in using webtestLogin() method
$this->webtestLogin();
// Adding contact with randomized first name (so we can then select that contact when creating event registration)
}
function testEventAddMultipleParticipants() {
-
- // Log in using webtestLogin() method
$this->webtestLogin();
- $processorId = $this->webtestAddPaymentProcessor('dummy' . substr(sha1(rand()), 0, 7));
- $rand = substr(sha1(rand()), 0, 7);
- $firstName = 'First' . $rand;
- $lastName = 'Last' . $rand;
- $rand = substr(sha1(rand()), 0, 7);
- $lastName2 = 'Last' . $rand;
+ $processorId = $this->webtestAddPaymentProcessor();
$this->openCiviPage("participant/add", "reset=1&action=add&context=standalone&mode=test&eid=3");
+ $contacts = array();
+
$this->assertTrue($this->isTextPresent("New Event Registration"), "Page title 'New Event Registration' missing");
$this->assertTrue($this->isTextPresent("A TEST transaction will be submitted"), "test mode status 'A TEST transaction will be submitted' missing");
- $this->_fillParticipantDetails($firstName, $lastName, $processorId);
- $this->click('_qf_Participant_upload_new-bottom');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $contacts[] = $this->_fillParticipantDetails($processorId);
+ $this->clickLink('_qf_Participant_upload_new-bottom');
$this->assertTrue($this->isTextPresent("New Event Registration"), "Page title 'New Event Registration' missing");
$this->assertTrue($this->isTextPresent("A TEST transaction will be submitted"), "test mode status 'A TEST transaction will be submitted' missing");
- $this->_fillParticipantDetails($firstName, $lastName2, $processorId);
- $this->click('_qf_Participant_upload_new-bottom');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $contacts[] = $this->_fillParticipantDetails($processorId);
+ $this->clickLink('_qf_Participant_upload_new-bottom');
//searching the paricipants
$this->openCiviPage("event/search", "reset=1");
- $this->type('sort_name', $firstName);
+ $this->type('sort_name', 'Individual');
$eventName = "Rain-forest Cup Youth Soccer Tournament";
$this->select2("event_id", $eventName, FALSE, FALSE);
$this->check('participant_test');
- $this->click("_qf_Search_refresh");
- $this->waitForElementPresent("participantSearch");
+ $this->clickLink("_qf_Search_refresh", "participantSearch");
//verifying the registered participants
- $names = array( "{$lastName}, {$firstName}", "{$lastName2}, {$firstName}" );
$status = "Registered (test)";
- foreach($names as $name) {
- $this->verifyText("xpath=//div[@id='participantSearch']//table//tbody//tr/td[@class='crm-participant-sort_name']/a[text()='{$name}']/../../td[9]", preg_quote($status));
- $this->verifyText("xpath=//div[@id='participantSearch']//table//tbody//tr/td[@class='crm-participant-sort_name']/a[text()='{$name}']/../../td[4]/a", preg_quote($eventName));
+ foreach($contacts as $contact) {
+ $this->verifyText("xpath=//div[@id='participantSearch']//table//tbody//tr/td[@class='crm-participant-sort_name']/a[text()='{$contact['sort_name']}']/../../td[9]", preg_quote($status));
+ $this->verifyText("xpath=//div[@id='participantSearch']//table//tbody//tr/td[@class='crm-participant-sort_name']/a[text()='{$contact['sort_name']}']/../../td[4]/a", preg_quote($eventName));
}
}
// Select role.
$this->multiselect2('role_id', array('Volunteer'));
- foreach($return as $values) {
+ foreach ($return as $values) {
foreach ($values as $entityType => $customData) {
//checking for duplicate custom data present or not
$this->assertElementPresent("xpath=//*[@class='crm-customData-block']/div[@class='custom-group custom-group-{$customData['cgtitle']} crm-accordion-wrapper ']");
* @param $lastName
* @param $processorId
*/
- function _fillParticipantDetails($firstName, $lastName, $processorId) {
- $this->webtestNewDialogContact($firstName, $lastName);
+ function _fillParticipantDetails($processorId) {
+ $contact = $this->createDialogContact();
$this->select('payment_processor_id', "value={$processorId}");
$event_id = $this->getAttribute("xpath=//*[@id='event_id']@value");
$this->select("role_id", "value=1");
$this->webtestAddCreditCardDetails();
$this->webtestAddBillingDetails();
+ return $contact;
}
}
// Create new Grant
$this->openCiviPage('grant/add', 'reset=1&action=add&context=standalone', '_qf_Grant_upload-bottom');
- $firstName = 'First' . $rand;
- $lastName = 'Last' . $rand;
- $this->webtestNewDialogContact($firstName, $lastName);
+ $contact = $this->createDialogContact();
$this->select('id=status_id', 'label=Approved for Payment');
$this->select('id=grant_type_id', "label=$grantType");
$this->waitForTextPresent($grantField);
// verify tabular data for grant view
$this->webtestVerifyTabularData(array(
- 'Name' => "$firstName $lastName",
+ 'Name' => $contact['display_name'],
'Grant Status' => 'Approved',
'Grant Type' => $grantType,
$grantField => '$ 99.99',
$this->openCiviPage('grant/add', 'reset=1&context=standalone', '_qf_Grant_upload');
// create new contact using dialog
- $firstName = substr(sha1(rand()), 0, 7);
- $this->webtestNewDialogContact($firstName, "Grantor", $firstName . "@example.com");
+ $contact = $this->createDialogContact();
// select grant Status
$this->select("status_id", "value=1");
$this->openCiviPage('pledge/add', 'reset=1&context=standalone', '_qf_Pledge_upload');
// create new contact using dialog
- $firstName = 'Ma' . substr(sha1(rand()), 0, 4);
- $lastName = 'Za' . substr(sha1(rand()), 0, 7);
- $this->webtestNewDialogContact($firstName, $lastName, $firstName . '@example.com');
+ $contact = $this->createDialogContact();
$this->type('amount', '1200');
$this->type('installments', '12');
$pledgeDate = date('F jS, Y', strtotime('now'));
$this->webtestVerifyTabularData(array(
- 'Pledge By' => $firstName . ' ' . $lastName,
+ 'Pledge By' => $contact['display_name'],
'Total Pledge Amount' => '$ 1,200.00',
'To be paid in' => '12 installments of $ 100.00 every 1 month(s)',
'Payments are due on the' => '1 day of the period',
$this->openCiviPage('pledge/add', 'reset=1&context=standalone', '_qf_Pledge_upload');
// create new contact using dialog
- $firstName = 'Ma' . substr(sha1(rand()), 0, 4);
- $lastName = 'Za' . substr(sha1(rand()), 0, 7);
- $this->webtestNewDialogContact($firstName, $lastName, $firstName . '@example.com');
+ $contact = $this->createDialogContact();
$this->type('amount', '2400');
$this->type('installments', '10');
$pledgeDate = date('F jS, Y', strtotime('now'));
$this->webtestVerifyTabularData(array(
- 'Pledge By' => $firstName . ' ' . $lastName,
+ 'Pledge By' => $contact['display_name'],
'Total Pledge Amount' => '$ 2,400.00',
'To be paid in' => '10 installments of $ 240.00 every 1 month(s)',
'Payments are due on the' => '2 day of the period',
$this->openCiviPage('pledge/add', 'reset=1&context=standalone', '_qf_Pledge_upload');
// create new contact using dialog
- $firstName = 'Ma' . substr(sha1(rand()), 0, 4);
- $lastName = 'An' . substr(sha1(rand()), 0, 7);
- $this->webtestNewDialogContact($firstName, $lastName, $firstName . '@example.com');
+ $contact = $this->createDialogContact();
$this->type('amount', '100');
$this->type('installments', '10');
$pledgeDate = date('F jS, Y', strtotime('now'));
$this->webtestVerifyTabularData(array(
- 'Pledge By' => $firstName . ' ' . $lastName,
+ 'Pledge By' => $contact['display_name'],
'Total Pledge Amount' => '$ 100.00',
'To be paid in' => '10 installments of $ 10.00 every 1 week(s)',
'Payments are due on the' => '2 day of the period',