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