From: Rohan Katkar Date: Tue, 12 Aug 2014 06:28:18 +0000 (+0530) Subject: Webtest for X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f6262e1a8edbfda5b20d3430af8c451b098746b3;p=civicrm-core.git Webtest for --- diff --git a/tests/phpunit/WebTest/Case/AddCaseTest.php b/tests/phpunit/WebTest/Case/AddCaseTest.php index 98ddd48437..bab7a97ec2 100644 --- a/tests/phpunit/WebTest/Case/AddCaseTest.php +++ b/tests/phpunit/WebTest/Case/AddCaseTest.php @@ -141,6 +141,7 @@ class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase { $this->_testSearchbyDate($firstName, $lastName, "this.quarter"); $this->_testSearchbyDate($firstName, $lastName, "0"); $this->_testSearchbyDate($firstName, $lastName, "this.year"); + $this->_testAssignToClient($firstName, $lastName, $caseTypeLabel); } function testAjaxCustomGroupLoad() { @@ -176,13 +177,14 @@ class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase { * @param $creatorName */ function _testVerifyCaseRoles($caseRoles, $creatorName) { - $this->waitForElementPresent("xpath=//table[@id='caseRoles-selector']/tbody/tr[4]/td[2]/a"); + $id = $this->urlArg('id'); + $this->waitForElementPresent("xpath=//table[@id='caseRoles-selector-$id']/tbody/tr[4]/td[2]/a"); // check that expected roles are listed in the Case Roles pane foreach ($caseRoles as $role) { $this->assertText("css=div.crm-case-roles-block", $role); } // check that case creator role has been assigned to logged in user - $this->verifyText("xpath=//table[@id='caseRoles-selector']/tbody/tr[4]/td[2]", $creatorName); + $this->verifyText("xpath=//table[@id='caseRoles-selector-$id']/tbody/tr[4]/td[2]", $creatorName); } /** @@ -266,5 +268,28 @@ class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); $this->assertElementContainsText('Advanced', "$lastName, $firstName"); } + + /** + * @param $firstName + * @param $lastName + * @param $caseTypeLabel + * + * test for assign case to another client + */ + 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->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->clickLink('_qf_EditClient_done-bottom'); + $this->assertElementContainsText('page-title', "$clientFirstName $clientLastName - $caseTypeLabel"); + } }