synchronizeUsers minor fixups
[civicrm-core.git] / tests / phpunit / WebTest / Contact / AdvancedSearchTest.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
81621fee 4 | CiviCRM version 4.7 |
6a488035 5 +--------------------------------------------------------------------+
e7112fa7 6 | Copyright CiviCRM LLC (c) 2004-2015 |
6a488035
TO
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License along with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
d25dd0ee 25 */
6a488035 26
6a488035 27require_once 'CiviTest/CiviSeleniumTestCase.php';
e9479dcf
EM
28
29/**
30 * Class WebTest_Contact_AdvancedSearchTest
31 */
6a488035
TO
32class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase {
33
34 protected function setUp() {
35 parent::setUp();
36 }
37
00be9182 38 public function testAdvanceSearch() {
a49e5dea 39 $this->markTestSkipped('Skipping for now as it works fine locally.');
6a488035
TO
40 $this->webtestLogin();
41 $this->waitForPageToLoad($this->getTimeoutMsec());
42
43 //------- first create new group and tag -----
44
45 // take group name and create group
46 $groupName = 'group_' . substr(sha1(rand()), 0, 7);
47 $this->WebtestAddGroup($groupName);
48
49 // take a tag name and create tag
50 include_once 'WebTest/Contact/SearchTest.php';
51 $tagName = 'tag_' . substr(sha1(rand()), 0, 7);
52 WebTest_Contact_SearchTest::addTag($tagName, $this);
53
54 //---------- create detailed contact ---------
55
56 $firstName = substr(sha1(rand()), 0, 7);
57 $this->createDetailContact($firstName);
58
59 // go to group tab and add to new group
57d32317 60 $this->clickAjaxLink("css=li#tab_group a", "_qf_GroupContact_next");
6a488035 61 $this->select("group_id", "$groupName");
a5d61f09 62 $this->clickAjaxLink("_qf_GroupContact_next");
57d32317 63 $this->waitForText('crm-notification-container', "Contact has been added to '$groupName'");
6a488035
TO
64
65 // go to tag tab and add to new tag
57d32317 66 $this->clickAjaxLink("css=li#tab_tag a", "css=div#tagtree");
3e60ff7f 67 $this->click("xpath=//ul/li/span/label[text()=\"$tagName\"]");
5c88df60 68 $this->checkCRMStatus();
6a488035 69
57d32317 70 // register for event ( auto add activity and contribution )
a5d61f09 71 $this->clickPopupLink("link=Register for Event");
673c7418 72 $this->waitForText('s2id_event_id', "- select event -");
673c7418 73 $this->select2("event_id", "Fall Fundraiser Dinner");
6a488035 74 $this->waitForElementPresent("receipt_text");
673c7418 75 $this->multiselect2("role_id", array('Volunteer'));
57d32317 76 // Select $100 fee
a488ca1a 77 $this->click("xpath=//input[@data-amount='100']");
6a488035
TO
78 $this->check("record_contribution");
79 $this->waitForElementPresent("contribution_status_id");
80 $this->select("payment_instrument_id", "Check");
81 $this->type("check_number", "chqNo$firstName");
82 $this->type("trxn_id", "trid$firstName");
57d32317 83 $this->clickAjaxLink("_qf_Participant_upload-bottom", "link=Add Event Registration");
6c5f7368 84 $this->waitForText('crm-notification-container', "Event registration for $firstName adv$firstName has been added");
6a488035 85
57d32317 86 // Add pledge
a5d61f09 87 $this->clickPopupLink("link=Add Pledge");
6a488035
TO
88 $this->waitForElementPresent("contribution_page_id");
89 $this->type("amount", "200");
90 $this->type("installments", "5");
91 $this->type("frequency_interval", "1");
92 $this->select("frequency_unit", "month(s)");
57d32317 93 $this->clickAjaxLink("_qf_Pledge_upload-bottom", "link=Add Pledge");
6c5f7368 94 $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created.");
6a488035 95
57d32317 96 // Add membership
a5d61f09 97 $this->clickPopupLink("link=Add Membership", "_qf_Membership_cancel-bottom");
6a488035 98 //let the organisation be default (Default Organization)
0b96d6d4 99 $this->select("membership_type_id[0]", "value=1");
6a488035
TO
100 $this->click("membership_type_id[1]");
101 $this->select("membership_type_id[1]", "Student");
102 $this->type("source", "membership source$firstName");
57d32317 103 $this->clickAjaxLink("_qf_Membership_upload-bottom");
6c5f7368 104 $this->waitForText('crm-notification-container', "Student membership for $firstName adv$firstName has been added");
6a488035 105
57d32317 106 // Add relationship
a5d61f09 107 $this->clickPopupLink("link=Add Relationship", "_qf_Relationship_cancel");
673c7418 108 $this->select2("relationship_type_id", "Employee of");
109 $this->waitForElementPresent("xpath=//input[@id='related_contact_id'][@placeholder='- select organization -']");
110 $this->select2("related_contact_id", "Default", TRUE);
42e55bb5 111 $this->waitForAjaxContent();
6a488035
TO
112 $this->webtestFillDate("start_date", "-1 day");
113 $this->webtestFillDate("end_date", "+1 day");
57d32317 114 $this->clickAjaxLink('_qf_Relationship_upload-bottom', NULL);
673c7418 115 $this->waitForText('crm-notification-container', "Relationship created.");
6a488035
TO
116
117 //-------------- advance search --------------
118
79d6583c 119 $this->openCiviPage('contact/search/advanced', 'reset=1');
6a488035
TO
120
121 //also create a dummy name to test false
122 $dummyName = substr(sha1(rand()), 0, 7);
123
124 // search block array for adv search
125 $searchBlockValues = array(
126 'basic' => array('', 'addBasicSearchDetail'),
127 'location' => array('state_province', 'addAddressSearchDetail'),
128 'demographics' => array('civicrm_gender_Transgender_3', 'addDemographicSearchDetail'),
129 'notes' => array('note', ''),
1b1cbb04 130 'activity' => array('activity_type_id', 'addActivitySearchDetail'),
6a488035
TO
131 'CiviContribute' => array('contribution_currency_type', 'addContributionSearchDetail'),
132 'CiviEvent' => array('participant_fee_amount_high', 'addParticipantSearchDetail'),
133 'CiviMember' => array('member_end_date_high', 'addMemberSearchDetail'),
673c7418 134 'CiviPledge' => array('pledge_frequency_interval', 'addPledgeSearchDetail'),
92915c55
TO
135 'relationship' => array(
136 "xpath=//div[@id='relationship']/table/tbody/tr//td/label[text()='Relationship Status']/../label[text()='All']",
79d7553f 137 '',
92915c55 138 ),
6a488035
TO
139 );
140
141 foreach ($searchBlockValues as $block => $blockValues) {
142 switch ($block) {
143 case 'basic':
144 $this->$blockValues[1]($firstName, $groupName, $tagName);
145 break;
146
147 case 'notes':
148 $this->click("$block");
149 $this->waitForElementPresent("$blockValues[0]");
150 $this->type("note", "this is notes by $firstName");
151 break;
152
153 case 'relationship':
154 $this->click("$block");
155 $this->waitForElementPresent("$blockValues[0]");
156 $this->select("relation_type_id", "Employee of");
157 $this->type("relation_target_name", "Default");
158 break;
159
160 default:
161 $this->click("$block");
162 $this->waitForElementPresent("$blockValues[0]");
163 $this->$blockValues[1]($firstName);
164 break;
165 }
6a488035
TO
166 $this->submitSearch($firstName);
167 }
168
169 //-- search with non existing value ( sort name )
170 $this->type("sort_name", "$dummyName");
0b96d6d4 171 $this->clickLink("_qf_Advanced_refresh");
377afa39 172 $this->waitForText("xpath=//form[@id='Advanced']/div[3]/div/div", "No matches found for");
6a488035
TO
173 }
174
79d7553f 175 /**
6a488035
TO
176 * Check for CRM-9873
177 */
00be9182 178 public function testActivitySearchByTypeTest() {
6a488035 179 $this->webtestLogin();
79d6583c 180 $this->openCiviPage('contact/search/advanced', 'reset=1');
57d32317 181 $this->clickAjaxLink("activity", 'activity_subject');
1b1cbb04 182 $this->multiselect2("activity_type_id", array('Tell a Friend'));
57d32317 183 $this->clickLink("_qf_Advanced_refresh");
6a488035
TO
184 $count = explode(" ", trim($this->getText("xpath=//div[@id='search-status']/table/tbody/tr/td")));
185 $count = $count[0];
186 $this->assertTrue(is_numeric($count), "The total count of search results not found");
187
188 //pagination calculation
189 $perPageRow = 50;
190 if ($count > $perPageRow) {
191 $cal = $count / $perPageRow;
192 $mod = $count % $perPageRow;
193 $j = 1;
6c6e6187 194 for ($i = 1; $i <= $cal; $i++) {
6a488035
TO
195 $subTotal = $i * $perPageRow;
196 $lastPageSub = $subTotal + 1;
197
198 //pagination and row count assertion
199 $pagerCount = "Contact {$j} - {$subTotal} of {$count}";
200 $this->verifyText("xpath=//div[@class='crm-search-results']/div[@class='crm-pager']/span[@class='crm-pager-nav']", preg_quote($pagerCount));
201 $this->assertEquals($perPageRow, $this->getXpathCount("//div[@class='crm-search-results']/table/tbody/tr"));
202
203 //go to next page
204 $this->click("xpath=//div[@class='crm-search-results']/div[@class='crm-pager']/span[@class='crm-pager-nav']/a[@title='next page']");
06dfe3b5 205 $this->waitForElementPresent("xpath=//a[@title='first page']");
6a488035
TO
206 $j = $j + $subTotal;
207 }
208
209 //pagination and row count assertion for the remaining last page
210 if ($mod) {
211 $pagerCount = "Contact {$lastPageSub} - {$count} of {$count}";
212 $this->verifyText("xpath=//div[@class='crm-search-results']/div[@class='crm-pager']/span[@class='crm-pager-nav']", preg_quote($pagerCount));
213 $this->assertEquals($mod, $this->getXpathCount("//div[@class='crm-search-results']/table/tbody/tr"));
214 }
215 }
216 }
217
4cbe18b8 218 /**
eceb18cc 219 * function to check match for sumbit Advance Search.
100fef9d 220 * @param string $firstName
4cbe18b8 221 */
00be9182 222 public function submitSearch($firstName) {
0b96d6d4 223 $this->clickLink("_qf_Advanced_refresh");
6a488035 224 // verify unique name
42e55bb5 225 $this->waitForAjaxContent();
38653166 226 $this->waitForElementPresent("xpath=//div[@class='crm-search-results']/table/tbody/tr//td/a[text()='adv$firstName, $firstName']");
6a488035
TO
227 // should give 1 result only as we are searching with unique name
228 $this->waitForText("xpath=//div[@id='search-status']/table/tbody/tr/td", preg_quote("1 Contact"));
229 // click to edit search
230 $this->click("xpath=//form[@id='Advanced']//div[2]/div/div[1]");
231 }
232
79d7553f 233 /**
48ebbfbe 234 * Check for CRM-14952
235 */
00be9182 236 public function testStateSorting() {
a49e5dea 237 $this->markTestSkipped('Skipping for now as it works fine locally.');
48ebbfbe 238 $this->webtestLogin();
57d32317 239 $this->openCiviPage('contact/search/advanced', 'reset=1', 'group');
48ebbfbe 240 $this->select2("group", "Newsletter", TRUE);
234aef82 241 $this->select2("group", "Summer", TRUE);
48ebbfbe 242 $this->select2("group", "Advisory", TRUE);
57d32317 243 $this->clickAjaxLink("location", 'country');
86797006 244 $this->select2("country", "UNITED STATES", FALSE);
48ebbfbe 245 $this->waitForElementPresent('state_province');
92915c55
TO
246 $this->multiselect2("state_province", array(
247 "Ohio",
248 "New York",
249 "New Mexico",
250 "Connecticut",
251 "Georgia",
252 "New Jersey",
79d7553f 253 "Texas",
92915c55 254 ));
234aef82 255 $this->clickLink("_qf_Advanced_refresh", "xpath=//div[@class='crm-search-results']//table/tbody/tr[1]/td[6]");
57d32317 256
48ebbfbe 257 $stateBeforeSort = $this->getText("xpath=//div[@class='crm-search-results']//table/tbody/tr[1]/td[6]");
88a6f4b3 258 $this->clickAjaxLink("xpath=//div[@class='crm-search-results']//table/thead/tr//th/a[contains(text(),'State')]");
3e60ff7f 259 $this->waitForElementPresent("xpath=//div[@class='crm-search-results']//table/thead/tr//th/a[contains(text(),'State')]");
3746604b 260 $this->clickAjaxLink("xpath=//div[@class='crm-search-results']//table/thead/tr//th/a[contains(text(), 'State')]");
261 $this->waitForElementPresent("xpath=//div[@class='crm-search-results']//table/thead/tr//th/a[contains(text(), 'State')]");
48ebbfbe 262 $this->assertElementNotContainsText("xpath=//div[@class='crm-search-results']//table/tbody/tr[1]/td[6]", $stateBeforeSort);
263 }
264
4cbe18b8 265 /**
eceb18cc 266 * function to fill basic search detail.
100fef9d
CW
267 * @param string $firstName
268 * @param string $groupName
4cbe18b8
EM
269 * @param $tagName
270 */
00be9182 271 public function addBasicSearchDetail($firstName, $groupName, $tagName) {
6a488035
TO
272 // fill partial sort name
273 $this->type("sort_name", "$firstName");
274 // select subtype
673c7418 275 $this->select("contact_type", "value=Individual\ 1Student");
6a488035 276 // select group
673c7418 277 $this->select("group", "label=$groupName");
6a488035 278 // select tag
673c7418 279 $this->select("contact_tags", "label=$tagName");
e4f46be0 280 // select preferred language
6a488035
TO
281 $this->select("preferred_language", "value=en_US");
282 // select privacy
283 $this->select("privacy_options", "value=do_not_email");
284
285 // select preferred communication method
286 // phone
287 $this->check("preferred_communication_method[1]");
288 // email
289 $this->check("preferred_communication_method[2]");
290 }
291
4cbe18b8 292 /**
eceb18cc 293 * function to fill address search block values in advance search.
4cbe18b8
EM
294 * @param $firstName
295 */
00be9182 296 public function addAddressSearchDetail($firstName) {
6a488035 297 // select location type (home and main)
3e60ff7f 298 $this->multiselect2('location_type', array('Home', 'Main'));
6a488035
TO
299 // fill street address
300 $this->type("street_address", "street 1 $firstName");
301 // fill city
302 $this->type("city", "city$firstName");
303 // fill postal code range
304 $this->type("postal_code_low", "100010");
305 $this->type("postal_code_high", "101000");
306 // select country
86797006 307 $this->select("country", "UNITED STATES");
6a488035 308 // select state-province
3e60ff7f 309 $this->waitForElementPresent('state_province');
57d32317 310 $this->select2("state_province", "Alaska", TRUE);
6a488035
TO
311 }
312
4cbe18b8 313 /**
eceb18cc 314 * function to fill activity search block in advance search.
4cbe18b8
EM
315 * @param $firstName
316 */
00be9182 317 public function addActivitySearchDetail($firstName) {
1b1cbb04 318 // select activity types
319 $activityTypes = array("Contribution", "Event Registration", "Membership Signup");
320 $this->multiselect2('activity_type_id', $activityTypes);
6a488035 321 // fill date range
6c6e6187 322 $this->select("activity_date_relative", "value=0");
6a488035
TO
323 $this->webtestFillDate("activity_date_low", "-1 day");
324 $this->webtestFillDate("activity_date_high", "+1 day");
325 $this->type("activity_subject", "Student - membership source$firstName - Status: New");
326 // fill activity status
1b1cbb04 327 $this->multiselect2('status_id', array('Scheduled', 'Completed'));
6a488035
TO
328 }
329
546b78fa 330 /**
eceb18cc 331 * function to fill demographic search details.
546b78fa 332 */
00be9182 333 public function addDemographicSearchDetail() {
6a488035 334 // fill birth date range
6c6e6187 335 $this->select("birth_date_relative", "value=0");
6a488035
TO
336 $this->webtestFillDate("birth_date_low", "-3 year");
337 $this->webtestFillDate("birth_date_high", "now");
338 // fill deceased date range
339 $this->click("xpath=//div[@id='demographics']/table/tbody//tr/td/label[text()='Deceased']/../label[text()='Yes']");
6c6e6187 340 $this->select("deceased_date_relative", "value=0");
6a488035
TO
341 $this->webtestFillDate("deceased_date_low", "-1 month");
342 $this->webtestFillDate("deceased_date_high", "+1 month");
343 // fill gender (male)
344 $this->check("civicrm_gender_Male_2");
345 }
346
4cbe18b8 347 /**
eceb18cc 348 * function to fill contribution search details.
4cbe18b8
EM
349 * @param $firstName
350 */
00be9182 351 public function addContributionSearchDetail($firstName) {
6a488035 352 // fill contribution date range
6c6e6187 353 $this->select("contribution_date_relative", "value=0");
6a488035
TO
354 $this->webtestFillDate("contribution_date_low", "-1 day");
355 $this->webtestFillDate("contribution_date_high", "+1 day");
356 // fill amount range
357 $this->type("contribution_amount_low", "1");
358 $this->type("contribution_amount_high", "200");
359 // check for completed
1b1cbb04 360 $this->multiselect2("contribution_status_id", array('Completed'));
6a488035 361 // enter check number
bfc3faa2 362 $this->select("payment_instrument_id", "Check");
6a488035
TO
363 $this->type("contribution_check_number", "chqNo$firstName");
364 // fill transaction id
1b1cbb04 365 $this->type("contribution_trxn_id", "trid$firstName");
6c6e6187
TO
366 // fill financial type
367 $this->select("financial_type_id", "Event Fee");
6a488035 368 // fill currency type
1b1cbb04 369 $this->select2("contribution_currency_type", "USD");
6a488035
TO
370 }
371
546b78fa 372 /**
eceb18cc 373 * function to fill participant search details.
546b78fa 374 */
00be9182 375 public function addParticipantSearchDetail() {
6a488035 376 // fill event name
673c7418 377 $this->select2("event_id", "Fall Fundraiser Dinner");
6a488035 378 // fill event type
673c7418 379 $this->select2("event_type_id", "Fundraiser");
bfc3faa2 380 // select participant status (registered)
381 $this->multiselect2('participant_status_id', array('Registered'));
382 // select participant role (Volunteer)
383 $this->multiselect2('participant_role_id', array('Volunteer'));
6a488035 384 // fill participant fee level (couple)
673c7418 385 $this->select2("participant_fee_id", "Couple");
6a488035
TO
386 // fill amount range
387 $this->type("participant_fee_amount_low", "1");
388 $this->type("participant_fee_amount_high", "150");
389 }
390
4cbe18b8 391 /**
eceb18cc 392 * function to fill member search details.
4cbe18b8
EM
393 * @param $firstName
394 */
00be9182 395 public function addMemberSearchDetail($firstName) {
6a488035
TO
396 // check membership type (Student)
397 $this->click("xpath=//div[@id='memberForm']/table/tbody/tr[1]/td[1]/div[1]//div/label[text()='Student']");
398 // check membership status (completed)
399 $this->click("xpath=//div[@id='memberForm']/table/tbody/tr[1]/td[2]/div[1]//div/label[text()='New']");
400 // fill member source
401 $this->type("member_source", "membership source$firstName");
402 // check to search primary member
403 $this->click("xpath=//div[@id='memberForm']/table/tbody/tr[2]/td[2]/p/input");
404 // add join date range
6c6e6187 405 $this->select("member_join_date_relative", "value=0");
6a488035
TO
406 $this->webtestFillDate("member_join_date_low", "-1 day");
407 $this->webtestFillDate("member_join_date_high", "+1 day");
408 // add start date range
6c6e6187 409 $this->select("member_start_date_relative", "value=0");
6a488035
TO
410 $this->webtestFillDate("member_start_date_low", "-1 day");
411 $this->webtestFillDate("member_start_date_high", "+1 day");
412 // add end date range
6c6e6187 413 $this->select("member_end_date_relative", "value=0");
6a488035
TO
414 $this->webtestFillDate("member_end_date_low", "-1 year");
415 $this->webtestFillDate("member_end_date_high", "+2 year");
416 }
417
4cbe18b8 418 /**
eceb18cc 419 * function to fill member search details.
4cbe18b8
EM
420 * @param $firstName
421 */
00be9182 422 public function addPledgeSearchDetail($firstName) {
6a488035 423 // fill pledge schedule date range
6c6e6187 424 $this->select("pledge_payment_date_relative", "value=0");
6a488035
TO
425 $this->webtestFillDate("pledge_payment_date_low", "-1 day");
426 $this->webtestFillDate("pledge_payment_date_high", "+1 day");
427 // fill Pledge payment status
428 $this->click("xpath=//div[@id='pledgeForm']/table/tbody/tr[3]/td//label[text()='Completed']");
429 $this->click("xpath=//div[@id='pledgeForm']/table/tbody/tr[3]/td//label[text()='Pending']");
430 // fill pledge amount range
431 $this->type("pledge_amount_low", "100");
432 $this->type("pledge_amount_high", "300");
433 // fill plegde status
434 $this->click("xpath=//div[@id='pledgeForm']/table/tbody/tr[4]/td[2]//label[text()='Completed']");
435 $this->click("xpath=//div[@id='pledgeForm']/table/tbody/tr[4]/td[2]//label[text()='Pending']");
436 // fill pledge created date range
437 $this->webtestFillDate("pledge_create_date_low", "-5 day");
438 $this->webtestFillDate("pledge_create_date_high", "+5 day");
439 // fill plegde start date
440 $this->webtestFillDate("pledge_start_date_low", "-2 day");
441 $this->webtestFillDate("pledge_start_date_high", "+2 day");
442 // fill financial type
443 $this->select("pledge_financial_type_id", "Donation");
444 }
445
4cbe18b8 446 /**
4f1f1f2a 447 * function to create contact with details (contact details, address, Constituent information ...)
4cbe18b8
EM
448 * @param null $firstName
449 */
00be9182 450 public function createDetailContact($firstName = NULL) {
6a488035
TO
451 if (!$firstName) {
452 $firstName = substr(sha1(rand()), 0, 7);
453 }
454
455 // create contact type Individual with subtype
456 // with most of values to required to search
457 $Subtype = "Student";
79d6583c 458 $this->openCiviPage('contact/add', 'reset=1&ct=Individual', '_qf_Contact_cancel');
6a488035
TO
459
460 // --- fill few values in Contact Detail block
461 $this->type("first_name", "$firstName");
462 $this->type("middle_name", "mid$firstName");
463 $this->type("last_name", "adv$firstName");
673c7418 464 $this->select("contact_sub_type", "label=$Subtype");
6a488035
TO
465 $this->type("email_1_email", "$firstName@advsearch.co.in");
466 $this->type("phone_1_phone", "123456789");
467 $this->type("external_identifier", "extid$firstName");
468
469 // --- fill few value in Constituent information
470 $this->click("customData1");
471 $this->waitForElementPresent("custom_3_-1");
472
473 $this->click("CIVICRM_QFID_Edu_2");
474 $this->select("custom_2_-1", "label=Single");
475
476 // --- fill few values in address
477
478 $this->click("//form[@id='Contact']/div[2]/div[4]/div[1]");
479 $this->waitForElementPresent("address_1_geo_code_2");
480 $this->type("address_1_street_address", "street 1 $firstName");
481 $this->type("address_1_supplemental_address_1", "street supplement 1 $firstName");
482 $this->type("address_1_supplemental_address_2", "street supplement 2 $firstName");
483 $this->type("address_1_city", "city$firstName");
484 $this->type("address_1_postal_code", "100100");
86797006 485 $this->select("address_1_country_id", "UNITED STATES");
6a488035
TO
486 $this->select("address_1_state_province_id", "Alaska");
487
488 // --- fill few values in communication preferences
489 $this->click("//form[@id='Contact']/div[2]/div[5]/div[1]");
490 $this->waitForElementPresent("preferred_mail_format");
491 $this->check("privacy[do_not_phone]");
492 $this->check("privacy[do_not_mail]");
493 // phone
494 $this->check("preferred_communication_method[1]");
495 // email
496 $this->check("preferred_communication_method[2]");
497 $this->select("preferred_language", "value=en_US");
498
499 // --- fill few value in notes
500 $this->click("//form[@id='Contact']/div[2]/div[6]/div[1]");
501 $this->waitForElementPresent("note");
502 $this->type("subject", "this is subject by $firstName");
503 $this->type("note", "this is notes by $firstName");
504
505 // --- fill few values in demographics
506 $this->click("//form[@id='Contact']/div[2]/div[7]/div[1]");
507 $this->waitForElementPresent("is_deceased");
508 $this->click("civicrm_gender_Male_2");
509
510 $this->webtestFillDate("birth_date", "-1 year");
511 $this->click("is_deceased");
512 $this->waitForElementPresent("deceased_date");
513 $this->webtestFillDate("deceased_date", "now");
514
515 // save contact
57d32317 516 $this->clickLink("_qf_Contact_upload_view", 'css=.crm-summary-display_name');
79d6583c 517 $this->assertElementContainsText('css=.crm-summary-display_name', "$firstName adv$firstName");
6a488035 518 }
96025800 519
6a488035 520}