<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
*/
require_once 'CiviTest/CiviSeleniumTestCase.php';
+
+/**
+ * Class WebTest_Case_CaseCustomFieldsTest
+ */
class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase {
protected function setUp() {
$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);
+ $this->webtestNewDialogContact($firstName, $lastName, $email, $type = 4, "s2id_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->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=//div[@class='ui-dialog-buttonset']/button/span[text()='Done']");
+ $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
"Priority" => "Normal",
);
$this->webtestVerifyTabularData($openCaseData);
- $this->click("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Done']");
+ $this->click("xpath=//span[@class='ui-button-icon-primary ui-icon ui-icon-closethick']");
// verify if custom data is present
$this->openCiviPage('case', 'reset=1');
"Priority" => "Normal",
);
$this->webtestVerifyTabularData($openCaseChangeData);
- $this->click("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Done']");
+ $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
$this->_testDeleteCustomData($customGrpId1, $customId);
}
+ /**
+ * @param $validateStrings
+ * @param $activityTypes
+ */
function _testVerifyCaseSummary($validateStrings, $activityTypes) {
$this->assertStringsPresent($validateStrings);
foreach ($activityTypes as $aType) {
$this->assertElementPresent("name=case_report_all", "Print Case Summary button is missing.");
}
+ /**
+ * @param $customGrpId1
+ * @param bool $noteRichEditor
+ *
+ * @return array
+ */
function _testGetCustomFieldId($customGrpId1, $noteRichEditor=FALSE) {
$customId = array();
array_push($customId, $custom1);
$custom2 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody//tr[2]/td[8]/span/a[text()='Edit Field']/@href"));
$custom2 = $custom2[1];
- array_push($customId, $custom2);
+ array_push($customId, $custom2);
}
else {
// Create a custom data to add in profile
return $customId;
}
+ /**
+ * @param $customGrpId1
+ * @param $customId
+ */
function _testDeleteCustomData($customGrpId1, $customId) {
// delete all custom data
foreach ($customId as $cKey => $cValue) {
$this->openCiviPage("admin/custom/group/field", array('action' => 'delete', 'reset' => '1', 'gid' => $customGrpId1, 'id' => $cValue));
$this->clickLink("_qf_DeleteField_next-bottom");
}
-
+
// delete custom group
$this->openCiviPage("admin/custom/group", "action=delete&reset=1&id=" . $customGrpId1);
$this->clickLink("_qf_DeleteGroup_next-bottom");
function testCaseCustomNoteRichEditor() {
$this->webtestLogin('admin');
+ //setting ckeditor as WYSIWYG
+ $this->openCiviPage('admin/setting/preferences/display', 'reset=1', '_qf_Display_next-bottom');
+ $this->select('editor_id', 'CKEditor');
+ $this->clickLink('_qf_Display_next-bottom');
+
// Enable CiviCase module if necessary
$this->enableComponents("CiviCase");
$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);
+ $this->webtestNewDialogContact($firstName, $lastName, $email, $type = 4, "s2id_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->waitForElementPresent("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=//div[@class='ui-dialog-buttonset']/button/span[text()='Done']");
$openCaseData = array(
"Client" => $displayName,
$this->waitForElementPresent("xpath=//table/tbody/tr/td[text()='{$label}']/following-sibling::td");
}
$this->webtestVerifyTabularData($openCaseData);
- $this->click("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Done']");
// verify if custom data is present
$this->openCiviPage('case', 'reset=1');
$cusId_1 = 'custom_' . $customId[0] . '_1';
$cusId_2 = 'custom_' . $customId[1] . '_1';
- $this->click("css=#{$customGrp1} a.button");
+ $this->clickLink("css=#{$customGrp1} a.button");
- // wait for dialog element
- $this->waitForElementPresent("css=div.ui-dialog div.ui-dialog-titlebar");
- // check for dialog box Title
- $this->assertElementContainsText("css=div.ui-dialog div.ui-dialog-titlebar", 'Update Case Information');
+ $this->assertElementContainsText("page-title", "Edit $customGrp1");
$custFname = "Miky" . substr(sha1(rand()), 0, 7);
$custLname = "Kristy" . substr(sha1(rand()), 0, 7);
$this->_testDeleteCustomData($customGrpId1, $customId);
}
+ /**
+ * @param $customId
+ * @param $custFname
+ * @param $custMname
+ * @param $custLname
+ */
function _testAdvansearchCaseData($customId, $custFname, $custMname, $custLname) {
// search casecontact
$this->openCiviPage('contact/search/advanced', 'reset=1', '_qf_Advanced_refresh');