From 9e1bd58f24b98af1608ccd7df6c6a95da997d8fd Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Thu, 26 Feb 2015 02:27:19 +0530 Subject: [PATCH] --CRM-15989, added webtest --- tests/phpunit/WebTest/Contact/AddTest.php | 67 ++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/WebTest/Contact/AddTest.php b/tests/phpunit/WebTest/Contact/AddTest.php index f35f9c19c6..c3470ef344 100644 --- a/tests/phpunit/WebTest/Contact/AddTest.php +++ b/tests/phpunit/WebTest/Contact/AddTest.php @@ -498,4 +498,69 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase { $this->assertElementContainsText('DataTables_Table_0', 'Household Member of'); } -} + public function testContactDeceased() { + $this->webtestLogin(); + $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage('contact/add', 'reset=1&ct=Individual'); + + //contact details section + //fill in first name + $fname = substr(sha1(rand()), 0, 7) . "John"; + $lname = substr(sha1(rand()), 0, 7) . "Smith"; + $this->type("first_name", $fname); + + //fill in last name + $this->type("last_name", $lname); + + //fill in email + $this->type("email_1_email", substr(sha1(rand()), 0, 7) . "john@gmail.com"); + + // Clicking save. + $this->click("_qf_Contact_upload_view"); + + $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForText('crm-notification-container', "Contact Saved"); + + //Edit Contact + $cid = $this->urlArg('cid'); + $dname = $fname . ' ' . $lname . ' (deceased)'; + foreach (array('', 'deceased') as $val) { + $this->openCiviPage("contact/add", "reset=1&action=update&cid={$cid}"); + if ($val) { + $this->assertElementContainsText('page-title', 'Edit ' . $dname); + } + // Click on the Demographics tab + $this->click('demographics'); + $this->waitForElementPresent('is_deceased'); + $this->click('is_deceased'); + + // Click on Save + $this->click('_qf_Contact_upload_view-bottom'); + $this->waitForPageToLoad($this->getTimeoutMsec()); + if (!$val) { + $this->assertElementContainsText('css=div.crm-summary-display_name', $dname); + } + else { + $this->assertTrue(($this->getText('css=div.crm-summary-display_name') != $dname)); + } + } + + foreach (array('', 'deceased') as $val) { + $this->mouseDown('crm-demographic-content'); + $this->mouseUp('crm-demographic-content'); + $this->waitForElementPresent("css=#crm-demographic-content .crm-container-snippet form"); + $this->click('is_deceased'); + $this->click("css=#crm-demographic-content input.crm-form-submit"); + $this->waitForElementPresent("css=#crm-demographic-content > .crm-inline-block-content"); + + if (!$val) { + $this->assertElementContainsText('css=div.crm-summary-display_name', $dname); + } + else { + $this->assertTrue(($this->getText('css=div.crm-summary-display_name') != $dname)); + } + } + $this->openCiviPage("contact/add", "reset=1&action=update&cid={$cid}"); + $this->assertTrue(($this->getText('page-title') != $dname)); + } +} \ No newline at end of file -- 2.25.1