Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.3 | | |
5 | +--------------------------------------------------------------------+ | |
6 | | Copyright CiviCRM LLC (c) 2004-2013 | | |
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 | +--------------------------------------------------------------------+ | |
25 | */ | |
26 | ||
6a488035 TO |
27 | require_once 'CiviTest/CiviSeleniumTestCase.php'; |
28 | class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { | |
29 | ||
30 | protected function setUp() { | |
31 | parent::setUp(); | |
32 | } | |
33 | ||
34 | function testAdvanceSearch() { | |
6a488035 TO |
35 | $this->webtestLogin(); |
36 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
37 | ||
38 | //------- first create new group and tag ----- | |
39 | ||
40 | // take group name and create group | |
41 | $groupName = 'group_' . substr(sha1(rand()), 0, 7); | |
42 | $this->WebtestAddGroup($groupName); | |
43 | ||
44 | // take a tag name and create tag | |
45 | include_once 'WebTest/Contact/SearchTest.php'; | |
46 | $tagName = 'tag_' . substr(sha1(rand()), 0, 7); | |
47 | WebTest_Contact_SearchTest::addTag($tagName, $this); | |
48 | ||
49 | //---------- create detailed contact --------- | |
50 | ||
51 | $firstName = substr(sha1(rand()), 0, 7); | |
52 | $this->createDetailContact($firstName); | |
53 | ||
54 | // go to group tab and add to new group | |
55 | $this->click("css=li#tab_group a"); | |
56 | $this->waitForElementPresent("_qf_GroupContact_next"); | |
57 | $this->select("group_id", "$groupName"); | |
58 | $this->click("_qf_GroupContact_next"); | |
59 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
60 | ||
61 | // go to tag tab and add to new tag | |
62 | $this->click("css=li#tab_tag a"); | |
63 | $this->waitForElementPresent("css=div#tagtree"); | |
64 | $this->click("xpath=//ul/li/label[text()=\"$tagName\"]"); | |
65 | $this->waitForElementPresent("css=.success"); | |
79d6583c | 66 | |
6a488035 TO |
67 | // is status message correct? |
68 | $this->waitForTextPresent("Saved"); | |
79d6583c | 69 | $this->assertElementContainsText('crm-notification-container', "Saved"); |
6a488035 TO |
70 | |
71 | // go to event tab and register for event ( auto add activity and contribution ) | |
72 | $this->click("css=li#tab_participant a"); | |
73 | $this->waitForElementPresent("link=Add Event Registration"); | |
74 | $this->click("link=Add Event Registration"); | |
75 | $this->waitForElementPresent("note"); | |
76 | // fall fundraiser dinner event label is variable | |
77 | $this->select("event_id", "value=1"); | |
78 | $this->waitForElementPresent("receipt_text"); | |
79 | $this->click("role_id[2]"); | |
80 | $this->check("record_contribution"); | |
81 | $this->waitForElementPresent("contribution_status_id"); | |
82 | $this->select("payment_instrument_id", "Check"); | |
83 | $this->type("check_number", "chqNo$firstName"); | |
84 | $this->type("trxn_id", "trid$firstName"); | |
85 | $this->click("_qf_Participant_upload-bottom"); | |
86 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
79d6583c | 87 | $this->assertElementContainsText('crm-notification-container', "Event registration for $firstName adv$firstName has been added"); |
6a488035 TO |
88 | |
89 | // go to pledge tab and add pledge | |
90 | $this->click("css=li#tab_pledge a"); | |
91 | $this->waitForElementPresent("link=Add Pledge"); | |
92 | $this->click("link=Add Pledge"); | |
93 | $this->waitForElementPresent("contribution_page_id"); | |
94 | $this->type("amount", "200"); | |
95 | $this->type("installments", "5"); | |
96 | $this->type("frequency_interval", "1"); | |
97 | $this->select("frequency_unit", "month(s)"); | |
98 | $this->click("_qf_Pledge_upload-bottom"); | |
99 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
100 | ||
79d6583c | 101 | $this->assertElementContainsText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created."); |
6a488035 TO |
102 | |
103 | // go to Membership tab and add membership | |
104 | $this->click("css=li#tab_member a"); | |
105 | $this->waitForElementPresent("link=Add Membership"); | |
106 | $this->click("link=Add Membership"); | |
107 | $this->waitForElementPresent("send_receipt"); | |
108 | //let the organisation be default (Default Organization) | |
109 | $this->select("membership_type_id[0]", "label=Default Organization"); | |
110 | $this->click("membership_type_id[1]"); | |
111 | $this->select("membership_type_id[1]", "Student"); | |
112 | $this->type("source", "membership source$firstName"); | |
113 | $this->click("_qf_Membership_upload-bottom"); | |
114 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
115 | ||
79d6583c | 116 | $this->assertElementContainsText('crm-notification-container', "Student membership for $firstName adv$firstName has been added"); |
6a488035 TO |
117 | |
118 | // go to relationship tab and add relationship | |
119 | $this->click("css=li#tab_rel a"); | |
120 | $this->waitForElementPresent("link=Add Relationship"); | |
121 | $this->click("link=Add Relationship"); | |
122 | $this->waitForElementPresent("_qf_Relationship_cancel"); | |
123 | $this->select("relationship_type_id", "Employee of"); | |
124 | $this->webtestFillAutocomplete("Default"); //default organization is provided as employer contact | |
125 | $this->waitForElementPresent("details-save"); | |
126 | $this->webtestFillDate("start_date", "-1 day"); | |
127 | $this->webtestFillDate("end_date", "+1 day"); | |
128 | $this->click("details-save"); | |
129 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
79d6583c | 130 | $this->assertElementContainsText('crm-notification-container', "New relationship created."); |
6a488035 TO |
131 | |
132 | //-------------- advance search -------------- | |
133 | ||
79d6583c | 134 | $this->openCiviPage('contact/search/advanced', 'reset=1'); |
6a488035 TO |
135 | |
136 | //also create a dummy name to test false | |
137 | $dummyName = substr(sha1(rand()), 0, 7); | |
138 | ||
139 | // search block array for adv search | |
140 | $searchBlockValues = array( | |
141 | 'basic' => array('', 'addBasicSearchDetail'), | |
142 | 'location' => array('state_province', 'addAddressSearchDetail'), | |
143 | 'demographics' => array('civicrm_gender_Transgender_3', 'addDemographicSearchDetail'), | |
144 | 'notes' => array('note', ''), | |
145 | 'activity' => array('activity_status[5]', 'addActivitySearchDetail'), | |
146 | 'CiviContribute' => array('contribution_currency_type', 'addContributionSearchDetail'), | |
147 | 'CiviEvent' => array('participant_fee_amount_high', 'addParticipantSearchDetail'), | |
148 | 'CiviMember' => array('member_end_date_high', 'addMemberSearchDetail'), | |
149 | 'CiviPledge' => array('pledge_in_honor_of', 'addPledgeSearchDetail'), | |
150 | 'relationship' => array("xpath=//div[@id='relationship']/table/tbody/tr//td/label[text()='Relationship Status']/../label[text()='All']", ''), | |
151 | ); | |
152 | ||
153 | foreach ($searchBlockValues as $block => $blockValues) { | |
154 | switch ($block) { | |
155 | case 'basic': | |
156 | $this->$blockValues[1]($firstName, $groupName, $tagName); | |
157 | break; | |
158 | ||
159 | case 'notes': | |
160 | $this->click("$block"); | |
161 | $this->waitForElementPresent("$blockValues[0]"); | |
162 | $this->type("note", "this is notes by $firstName"); | |
163 | break; | |
164 | ||
165 | case 'relationship': | |
166 | $this->click("$block"); | |
167 | $this->waitForElementPresent("$blockValues[0]"); | |
168 | $this->select("relation_type_id", "Employee of"); | |
169 | $this->type("relation_target_name", "Default"); | |
170 | break; | |
171 | ||
172 | default: | |
173 | $this->click("$block"); | |
174 | $this->waitForElementPresent("$blockValues[0]"); | |
175 | $this->$blockValues[1]($firstName); | |
176 | break; | |
177 | } | |
178 | ||
179 | $this->submitSearch($firstName); | |
180 | } | |
181 | ||
182 | //-- search with non existing value ( sort name ) | |
183 | $this->type("sort_name", "$dummyName"); | |
184 | $this->click("_qf_Advanced_refresh"); | |
185 | $this->waitForElementPresent("css=div.messages"); | |
79d6583c | 186 | $this->assertElementContainsText('css=div.messages', "No matches found for"); |
6a488035 TO |
187 | } |
188 | ||
189 | /* | |
190 | * Check for CRM-9873 | |
191 | */ | |
192 | function testActivitySearchByTypeTest() { | |
6a488035 | 193 | $this->webtestLogin(); |
79d6583c | 194 | $this->openCiviPage('contact/search/advanced', 'reset=1'); |
6a488035 | 195 | $this->click("activity"); |
79d6583c | 196 | $this->waitForElementPresent('activity_subject'); |
6a488035 TO |
197 | $this->check("xpath=//div[@id='Activity']//div/label[text()='Tell a Friend']/../input"); |
198 | $this->click("_qf_Advanced_refresh"); | |
199 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
200 | $count = explode(" ", trim($this->getText("xpath=//div[@id='search-status']/table/tbody/tr/td"))); | |
201 | $count = $count[0]; | |
202 | $this->assertTrue(is_numeric($count), "The total count of search results not found"); | |
203 | ||
204 | //pagination calculation | |
205 | $perPageRow = 50; | |
206 | if ($count > $perPageRow) { | |
207 | $cal = $count / $perPageRow; | |
208 | $mod = $count % $perPageRow; | |
209 | $j = 1; | |
210 | for ($i=1; $i<=$cal; $i++) { | |
211 | $subTotal = $i * $perPageRow; | |
212 | $lastPageSub = $subTotal + 1; | |
213 | ||
214 | //pagination and row count assertion | |
215 | $pagerCount = "Contact {$j} - {$subTotal} of {$count}"; | |
216 | $this->verifyText("xpath=//div[@class='crm-search-results']/div[@class='crm-pager']/span[@class='crm-pager-nav']", preg_quote($pagerCount)); | |
217 | $this->assertEquals($perPageRow, $this->getXpathCount("//div[@class='crm-search-results']/table/tbody/tr")); | |
218 | ||
219 | //go to next page | |
220 | $this->click("xpath=//div[@class='crm-search-results']/div[@class='crm-pager']/span[@class='crm-pager-nav']/a[@title='next page']"); | |
221 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
222 | $j = $j + $subTotal; | |
223 | } | |
224 | ||
225 | //pagination and row count assertion for the remaining last page | |
226 | if ($mod) { | |
227 | $pagerCount = "Contact {$lastPageSub} - {$count} of {$count}"; | |
228 | $this->verifyText("xpath=//div[@class='crm-search-results']/div[@class='crm-pager']/span[@class='crm-pager-nav']", preg_quote($pagerCount)); | |
229 | $this->assertEquals($mod, $this->getXpathCount("//div[@class='crm-search-results']/table/tbody/tr")); | |
230 | } | |
231 | } | |
232 | } | |
233 | ||
234 | //function to check match for sumbit Advance Search | |
235 | function submitSearch($firstName) { | |
236 | ||
237 | $this->click("_qf_Advanced_refresh"); | |
238 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
239 | // verify unique name | |
240 | $this->verifyText("xpath=//div[@class='crm-search-results']/table/tbody/tr/td[3]/a", preg_quote("adv$firstName, $firstName")); | |
241 | // should give 1 result only as we are searching with unique name | |
242 | $this->waitForText("xpath=//div[@id='search-status']/table/tbody/tr/td", preg_quote("1 Contact")); | |
243 | // click to edit search | |
244 | $this->click("xpath=//form[@id='Advanced']//div[2]/div/div[1]"); | |
245 | } | |
246 | ||
247 | // function to fill auto complete | |
248 | function fillAutoComplete($text, $elementId) { | |
249 | $this->click("$elementId"); | |
250 | $this->type("$elementId", "$text"); | |
251 | $this->typeKeys("$elementId", "$text"); | |
252 | $this->waitForElementPresent("css=div.ac_results li"); | |
253 | $this->click("css=div.ac_results li"); | |
254 | $this->assertContains($text, $this->getValue("$elementId"), | |
255 | "autocomplete expected $text but didn’t find it in " . $this->getValue("$elementId") | |
256 | ); | |
257 | } | |
258 | ||
259 | // function to fill basic search detail | |
260 | function addBasicSearchDetail($firstName, $groupName, $tagName) { | |
261 | // fill partial sort name | |
262 | $this->type("sort_name", "$firstName"); | |
263 | // select subtype | |
264 | $this->select("crmasmSelect0", "value=Individual\ 1Student"); | |
265 | // select group | |
266 | $this->select("crmasmSelect1", "label=$groupName"); | |
267 | // select tag | |
268 | $this->select("crmasmSelect3", "label=$tagName"); | |
269 | // select prefered language | |
270 | $this->select("preferred_language", "value=en_US"); | |
271 | // select privacy | |
272 | $this->select("privacy_options", "value=do_not_email"); | |
273 | ||
274 | // select preferred communication method | |
275 | // phone | |
276 | $this->check("preferred_communication_method[1]"); | |
277 | ||
278 | $this->check("preferred_communication_method[2]"); | |
279 | } | |
280 | ||
281 | // function to fill address search block values in advance search | |
282 | function addAddressSearchDetail($firstName) { | |
283 | // select location type (home and main) | |
284 | $this->click("xpath=//div[@id='location']/table/tbody/tr[1]/td[1]//label[text()='Home']"); | |
285 | $this->click("xpath=//div[@id='location']/table/tbody/tr[1]/td[1]//label[text()='Main']"); | |
286 | // fill street address | |
287 | $this->type("street_address", "street 1 $firstName"); | |
288 | // fill city | |
289 | $this->type("city", "city$firstName"); | |
290 | // fill postal code range | |
291 | $this->type("postal_code_low", "100010"); | |
292 | $this->type("postal_code_high", "101000"); | |
293 | // select country | |
294 | $this->select("country", "United States"); | |
295 | // select state-province | |
296 | $this->select("state_province", "Alaska"); | |
297 | } | |
298 | ||
299 | // function to fill activity search block in advance search | |
300 | function addActivitySearchDetail($firstName) { | |
301 | // check activity types | |
302 | $checkActivityTypes = array("Contribution", "Event Registration", "Membership Signup"); | |
303 | foreach ($checkActivityTypes as $labels) { | |
304 | $this->click("xpath=//div[@id='activity']/table/tbody/tr[1]/td[1]/div[1]//div/label[text()=\"$labels\"]"); | |
305 | } | |
306 | // fill date range | |
307 | $this->select("activity_date_relative","value=0"); | |
308 | $this->webtestFillDate("activity_date_low", "-1 day"); | |
309 | $this->webtestFillDate("activity_date_high", "+1 day"); | |
310 | $this->type("activity_subject", "Student - membership source$firstName - Status: New"); | |
311 | // fill activity status | |
312 | ||
313 | $this->click("xpath=//div[@id='activity']/table/tbody//tr/td[2]/label[text()='Activity Status']/../label[text()='Scheduled']"); | |
314 | $this->click("xpath=//div[@id='activity']/table/tbody//tr/td[2]/label[text()='Activity Status']/../label[text()='Completed']"); | |
315 | } | |
316 | ||
317 | // function to fill demographic search details | |
318 | function addDemographicSearchDetail() { | |
319 | // fill birth date range | |
320 | $this->select("birth_date_relative","value=0"); | |
321 | $this->webtestFillDate("birth_date_low", "-3 year"); | |
322 | $this->webtestFillDate("birth_date_high", "now"); | |
323 | // fill deceased date range | |
324 | $this->click("xpath=//div[@id='demographics']/table/tbody//tr/td/label[text()='Deceased']/../label[text()='Yes']"); | |
325 | $this->select("deceased_date_relative","value=0"); | |
326 | $this->webtestFillDate("deceased_date_low", "-1 month"); | |
327 | $this->webtestFillDate("deceased_date_high", "+1 month"); | |
328 | // fill gender (male) | |
329 | $this->check("civicrm_gender_Male_2"); | |
330 | } | |
331 | ||
332 | //function to fill contribution search details | |
333 | function addContributionSearchDetail($firstName) { | |
334 | // fill contribution date range | |
335 | $this->select("contribution_date_relative","value=0"); | |
336 | $this->webtestFillDate("contribution_date_low", "-1 day"); | |
337 | $this->webtestFillDate("contribution_date_high", "+1 day"); | |
338 | // fill amount range | |
339 | $this->type("contribution_amount_low", "1"); | |
340 | $this->type("contribution_amount_high", "200"); | |
341 | // check for completed | |
342 | $this->check("contribution_status_id[1]"); | |
343 | // enter check number | |
344 | $this->select("contribution_payment_instrument_id", "Check"); | |
345 | $this->type("contribution_check_number", "chqNo$firstName"); | |
346 | // fill transaction id | |
347 | $this->type("contribution_transaction_id", "trid$firstName"); | |
348 | // fill financial type | |
349 | $this->select("financial_type_id", "Event Fee"); | |
350 | // fill currency type | |
351 | $this->select("contribution_currency_type", "USD"); | |
352 | } | |
353 | ||
354 | // function to fill participant search details | |
355 | function addParticipantSearchDetail() { | |
356 | // fill event name | |
357 | $this->fillAutoComplete("Fall Fundraiser Dinner", "event_name"); | |
358 | // fill event type | |
359 | $this->fillAutoComplete("Fundraiser", "event_type"); | |
360 | // check participant status (registered) | |
361 | $this->click("xpath=//div[@id='participantForm']/table/tbody//tr/td/label[text()='Participant Status']/../div//div/label[text()='Registered']"); | |
362 | // check participant role (Volunteer) | |
363 | $this->click("xpath=//div[@id='participantForm']/table/tbody//tr/td/label[text()='Participant Role']/../div//div/label[text()='Volunteer']"); | |
364 | // fill participant fee level (couple) | |
365 | $this->fillAutoComplete("Couple", "participant_fee_level"); | |
366 | // fill amount range | |
367 | $this->type("participant_fee_amount_low", "1"); | |
368 | $this->type("participant_fee_amount_high", "150"); | |
369 | } | |
370 | ||
371 | // function to fill member search details | |
372 | function addMemberSearchDetail($firstName) { | |
373 | // check membership type (Student) | |
374 | $this->click("xpath=//div[@id='memberForm']/table/tbody/tr[1]/td[1]/div[1]//div/label[text()='Student']"); | |
375 | // check membership status (completed) | |
376 | $this->click("xpath=//div[@id='memberForm']/table/tbody/tr[1]/td[2]/div[1]//div/label[text()='New']"); | |
377 | // fill member source | |
378 | $this->type("member_source", "membership source$firstName"); | |
379 | // check to search primary member | |
380 | $this->click("xpath=//div[@id='memberForm']/table/tbody/tr[2]/td[2]/p/input"); | |
381 | // add join date range | |
382 | $this->select("member_join_date_relative","value=0"); | |
383 | $this->webtestFillDate("member_join_date_low", "-1 day"); | |
384 | $this->webtestFillDate("member_join_date_high", "+1 day"); | |
385 | // add start date range | |
386 | $this->select("member_start_date_relative","value=0"); | |
387 | $this->webtestFillDate("member_start_date_low", "-1 day"); | |
388 | $this->webtestFillDate("member_start_date_high", "+1 day"); | |
389 | // add end date range | |
390 | $this->select("member_end_date_relative","value=0"); | |
391 | $this->webtestFillDate("member_end_date_low", "-1 year"); | |
392 | $this->webtestFillDate("member_end_date_high", "+2 year"); | |
393 | } | |
394 | ||
6a488035 TO |
395 | // function to fill member search details |
396 | function addPledgeSearchDetail($firstName) { | |
397 | // fill pledge schedule date range | |
398 | $this->select("pledge_payment_date_relative","value=0"); | |
399 | $this->webtestFillDate("pledge_payment_date_low", "-1 day"); | |
400 | $this->webtestFillDate("pledge_payment_date_high", "+1 day"); | |
401 | // fill Pledge payment status | |
402 | $this->click("xpath=//div[@id='pledgeForm']/table/tbody/tr[3]/td//label[text()='Completed']"); | |
403 | $this->click("xpath=//div[@id='pledgeForm']/table/tbody/tr[3]/td//label[text()='Pending']"); | |
404 | // fill pledge amount range | |
405 | $this->type("pledge_amount_low", "100"); | |
406 | $this->type("pledge_amount_high", "300"); | |
407 | // fill plegde status | |
408 | $this->click("xpath=//div[@id='pledgeForm']/table/tbody/tr[4]/td[2]//label[text()='Completed']"); | |
409 | $this->click("xpath=//div[@id='pledgeForm']/table/tbody/tr[4]/td[2]//label[text()='Pending']"); | |
410 | // fill pledge created date range | |
411 | $this->webtestFillDate("pledge_create_date_low", "-5 day"); | |
412 | $this->webtestFillDate("pledge_create_date_high", "+5 day"); | |
413 | // fill plegde start date | |
414 | $this->webtestFillDate("pledge_start_date_low", "-2 day"); | |
415 | $this->webtestFillDate("pledge_start_date_high", "+2 day"); | |
416 | // fill financial type | |
417 | $this->select("pledge_financial_type_id", "Donation"); | |
418 | } | |
419 | ||
420 | // function to create contact with details (contact details, address, Constituent information ...) | |
421 | function createDetailContact($firstName = NULL) { | |
422 | if (!$firstName) { | |
423 | $firstName = substr(sha1(rand()), 0, 7); | |
424 | } | |
425 | ||
426 | // create contact type Individual with subtype | |
427 | // with most of values to required to search | |
428 | $Subtype = "Student"; | |
79d6583c | 429 | $this->openCiviPage('contact/add', 'reset=1&ct=Individual', '_qf_Contact_cancel'); |
6a488035 TO |
430 | |
431 | // --- fill few values in Contact Detail block | |
432 | $this->type("first_name", "$firstName"); | |
433 | $this->type("middle_name", "mid$firstName"); | |
434 | $this->type("last_name", "adv$firstName"); | |
435 | $this->select("contact_sub_type", "label=- $Subtype"); | |
436 | $this->type("email_1_email", "$firstName@advsearch.co.in"); | |
437 | $this->type("phone_1_phone", "123456789"); | |
438 | $this->type("external_identifier", "extid$firstName"); | |
439 | ||
440 | // --- fill few value in Constituent information | |
441 | $this->click("customData1"); | |
442 | $this->waitForElementPresent("custom_3_-1"); | |
443 | ||
444 | $this->click("CIVICRM_QFID_Edu_2"); | |
445 | $this->select("custom_2_-1", "label=Single"); | |
446 | ||
447 | // --- fill few values in address | |
448 | ||
449 | $this->click("//form[@id='Contact']/div[2]/div[4]/div[1]"); | |
450 | $this->waitForElementPresent("address_1_geo_code_2"); | |
451 | $this->type("address_1_street_address", "street 1 $firstName"); | |
452 | $this->type("address_1_supplemental_address_1", "street supplement 1 $firstName"); | |
453 | $this->type("address_1_supplemental_address_2", "street supplement 2 $firstName"); | |
454 | $this->type("address_1_city", "city$firstName"); | |
455 | $this->type("address_1_postal_code", "100100"); | |
456 | $this->select("address_1_country_id", "United States"); | |
457 | $this->select("address_1_state_province_id", "Alaska"); | |
458 | ||
459 | // --- fill few values in communication preferences | |
460 | $this->click("//form[@id='Contact']/div[2]/div[5]/div[1]"); | |
461 | $this->waitForElementPresent("preferred_mail_format"); | |
462 | $this->check("privacy[do_not_phone]"); | |
463 | $this->check("privacy[do_not_mail]"); | |
464 | // phone | |
465 | $this->check("preferred_communication_method[1]"); | |
466 | ||
467 | $this->check("preferred_communication_method[2]"); | |
468 | $this->select("preferred_language", "value=en_US"); | |
469 | ||
470 | // --- fill few value in notes | |
471 | $this->click("//form[@id='Contact']/div[2]/div[6]/div[1]"); | |
472 | $this->waitForElementPresent("note"); | |
473 | $this->type("subject", "this is subject by $firstName"); | |
474 | $this->type("note", "this is notes by $firstName"); | |
475 | ||
476 | // --- fill few values in demographics | |
477 | $this->click("//form[@id='Contact']/div[2]/div[7]/div[1]"); | |
478 | $this->waitForElementPresent("is_deceased"); | |
479 | $this->click("civicrm_gender_Male_2"); | |
480 | ||
481 | $this->webtestFillDate("birth_date", "-1 year"); | |
482 | $this->click("is_deceased"); | |
483 | $this->waitForElementPresent("deceased_date"); | |
484 | $this->webtestFillDate("deceased_date", "now"); | |
485 | ||
486 | // save contact | |
487 | $this->click("_qf_Contact_upload_view"); | |
488 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
79d6583c | 489 | $this->assertElementContainsText('css=.crm-summary-display_name', "$firstName adv$firstName"); |
6a488035 TO |
490 | } |
491 | } | |
492 |