The cut-n-paste code avanger strikes again
[civicrm-core.git] / tests / phpunit / WebTest / Contribute / OnBehalfOfOrganization.php
CommitLineData
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
28require_once 'CiviTest/CiviSeleniumTestCase.php';
29class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase {
30 protected $pageno = '';
31 protected function setUp() {
32 parent::setUp();
33 }
34
35 function testOnBehalfOfOrganization() {
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
49 // create new individual
50 $firstName = 'John_' . substr(sha1(rand()), 0, 7);
51 $lastName = 'Anderson_' . substr(sha1(rand()), 0, 7);
52 $email = "{$firstName}.{$lastName}@example.com";
53 $contactParams = array(
54 'first_name' => $firstName,
55 'last_name' => $lastName,
56 'email-5' => $email,
57 );
58 $streetAddress = "100 Main Street";
59
60 //adding contact for membership sign up
61 $this->webtestAddContact($firstName, $lastName, $email);
62 $urlElements = $this->parseURL();
63 print_r($urlElements);
64 $cid = $urlElements['queryString']['cid'];
65 $this->assertType('numeric', $cid);
66
67 // We need a payment processor
68 $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7);
69 $processorType = 'Dummy';
70 $pageTitle = substr(sha1(rand()), 0, 7);
71 $rand = 100;
72 $hash = substr(sha1(rand()), 0, 7);
73 $amountSection = TRUE;
74 $payLater = TRUE;
75 $onBehalf = 'optional';
76 $pledges = FALSE;
77 $recurring = FALSE;
78 $memberships = FALSE;
79 $memPriceSetId = NULL;
80 $friend = TRUE;
81 $profilePreId = NULL;
82 $profilePostId = NULL;
83 $premiums = FALSE;
84 $widget = FALSE;
85 $pcp = FALSE;
86 $honoreeSection = FALSE;
87 $isAddPaymentProcessor = TRUE;
88 $isPcpApprovalNeeded = FALSE;
89 $isSeparatePayment = FALSE;
90
91 // create a new online contribution page
92 // create contribution page with randomized title and default params
93 $pageId = $this->webtestAddContributionPage($hash,
94 $rand,
95 $pageTitle,
96 array($processorName => $processorType),
97 $amountSection,
98 $payLater,
99 $onBehalf,
100 $pledges,
101 $recurring,
102 $memberships,
103 $memPriceSetId,
104 $friend,
105 $profilePreId,
106 $profilePostId,
107 $premiums,
108 $widget,
109 $pcp,
110 $isAddPaymentProcessor,
111 $isPcpApprovalNeeded,
112 $isSeparatePayment,
113 $honoreeSection
114 );
115
116 //logout
117 $this->open($this->sboxPath . "civicrm/logout?reset=1");
118 $this->waitForPageToLoad($this->getTimeoutMsec());
119 //$this->_testAnomoyousOganization($pageId, $cid, $pageTitle);
120 $this->open($this->sboxPath . "civicrm/logout?reset=1");
121 $this->waitForPageToLoad($this->getTimeoutMsec());
122 $this->_testUserWithOneRelationship($pageId, $cid, $pageTitle);
123 $this->open($this->sboxPath . "civicrm/logout?reset=1");
124 $this->waitForPageToLoad($this->getTimeoutMsec());
125 $this->_testUserWithMoreThanOneRelationship($pageId, $cid, $pageTitle);
126 }
127
128 function testOnBehalfOfOrganizationWithMembershipData() {
129 // This is the path where our testing install resides.
130 // The rest of URL is defined in CiviSeleniumTestCase base class, in
131 // class attributes.
132 $this->open($this->sboxPath);
133
134 // Logging in. Remember to wait for page to load. In most cases,
135 // you can rely on 30000 as the value that allows your test to pass, however,
136 // sometimes your test might fail because of this. In such cases, it's better to pick one element
137 // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole
138 // page contents loaded and you can continue your test execution.
139 $this->webtestLogin();
140
141 // create new individual
142 $this->open($this->sboxPath . "civicrm/profile/edit?reset=1&gid=4");
143 $firstName = 'John_x_' . substr(sha1(rand()), 0, 7);
144 $lastName = 'Anderson_c_' . substr(sha1(rand()), 0, 7);
145
146 $this->waitForPageToLoad($this->getTimeoutMsec());
147 $this->waitForElementPresent("_qf_Edit_next");
148 $this->type("first_name", $firstName);
149 $this->type("last_name", $lastName);
150 $this->click("_qf_Edit_next");
151 $this->waitForPageToLoad($this->getTimeoutMsec());
152 $this->waitForElementPresent("profilewrap4");
153
154 // Is status message correct?
155 $this->assertTextPresent("Thank you. Your information has been saved.", "Save successful status message didn't show up after saving profile to update testUserName!");
156
157 //custom data
158 // Go directly to the URL of the screen that you will be testing (New Custom Group).
159 $this->open($this->sboxPath . "civicrm/admin/custom/group?action=add&reset=1");
160 $this->waitForPageToLoad($this->getTimeoutMsec());
161
162 //fill custom group title
163 $customGroupTitle = 'custom_' . substr(sha1(rand()), 0, 7);
164 $this->click("title");
165 $this->type("title", $customGroupTitle);
166
167 //custom group extends
168 $this->click("extends[0]");
169 $this->select("extends[0]", "value=Membership");
170 //$this->click("//option[@value='Contact']");
171 $this->click("_qf_Group_next-bottom");
172 $this->waitForElementPresent("_qf_Field_cancel-bottom");
173
174 //Is custom group created?
175 $this->assertTrue($this->isTextPresent("Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now."));
176
177 //add custom field - alphanumeric checkbox
178 $checkboxFieldLabel = 'custom_field' . substr(sha1(rand()), 0, 4);
179 $this->click("label");
180 $this->type("label", $checkboxFieldLabel);
181 $this->click("data_type[1]");
182 $this->select("data_type[1]", "value=CheckBox");
183 $this->click("//option[@value='CheckBox']");
184 $checkboxOptionLabel1 = 'optionLabel_' . substr(sha1(rand()), 0, 5);
185 $this->type("option_label_1", $checkboxOptionLabel1);
186 $this->type("option_value_1", "1");
187 $checkboxOptionLabel2 = 'optionLabel_' . substr(sha1(rand()), 0, 5);
188 $this->type("option_label_2", $checkboxOptionLabel2);
189 $this->type("option_value_2", "2");
190 $this->click("link=another choice");
191 $checkboxOptionLabel3 = 'optionLabel_' . substr(sha1(rand()), 0, 5);
192 $this->type("option_label_3", $checkboxOptionLabel3);
193 $this->type("option_value_3", "3");
194
195 //enter options per line
196 $this->type("options_per_line", "2");
197
198 //enter pre help message
199 $this->type("help_pre", "this is field pre help");
200
201 //enter post help message
202 $this->type("help_post", "this field post help");
203
204 //Is searchable?
205 $this->click("is_searchable");
206
207 //clicking save
208 $this->click("_qf_Field_next");
209 $this->waitForPageToLoad($this->getTimeoutMsec());
210
211 //Is custom field created?
212 $this->assertTrue($this->isTextPresent("Your custom field '$checkboxFieldLabel' has been saved."));
213
214 //create another custom field - Integer Radio
215 $this->click("//a[@id='newCustomField']/span");
216 $this->waitForPageToLoad($this->getTimeoutMsec());
217 $this->click("data_type[0]");
218 $this->select("data_type[0]", "value=1");
219 $this->click("//option[@value='1']");
220 $this->click("data_type[1]");
221 $this->select("data_type[1]", "value=Radio");
222 $this->click("//option[@value='Radio']");
223
224 $radioFieldLabel = 'custom_field' . substr(sha1(rand()), 0, 4);
225 $this->type("label", $radioFieldLabel);
226 $radioOptionLabel1 = 'optionLabel_' . substr(sha1(rand()), 0, 5);
227 $this->type("option_label_1", $radioOptionLabel1);
228 $this->type("option_value_1", "1");
229 $radioOptionLabel2 = 'optionLabel_' . substr(sha1(rand()), 0, 5);
230 $this->type("option_label_2", $radioOptionLabel2);
231 $this->type("option_value_2", "2");
232 $this->click("link=another choice");
233 $radioOptionLabel3 = 'optionLabel_' . substr(sha1(rand()), 0, 5);
234 $this->type("option_label_3", $radioOptionLabel3);
235 $this->type("option_value_3", "3");
236
237 //select options per line
238 $this->type("options_per_line", "3");
239
240 //enter pre help msg
241 $this->type("help_pre", "this is field pre help");
242
243 //enter post help msg
244 $this->type("help_post", "this is field post help");
245
246 //Is searchable?
247 $this->click("is_searchable");
248
249 //clicking save
250 $this->click("_qf_Field_next");
251 $this->waitForPageToLoad($this->getTimeoutMsec());
252
253 //Is custom field created
254 $this->assertTrue($this->isTextPresent("Your custom field '$radioFieldLabel' has been saved."));
255
256 //add the above custom data to the On Behalf of Profile
257 $this->open($this->sboxPath . "civicrm/admin/uf/group?reset=1");
258 $this->waitForPageToLoad($this->getTimeoutMsec());
259 $this->click("link=Reserved Profiles");
260
261 $this->click("xpath=//div[@id='reserved-profiles']/div/div/table/tbody//tr/td[1][text()='On Behalf Of Organization']/../td[5]/span/a[text()='Fields']");
262 $this->waitForPageToLoad($this->getTimeoutMsec());
263
264 $this->click("link=Add Field");
265 $this->waitForElementPresent('_qf_Field_next-bottom');
266 $this->select('field_name[0]', 'value=Membership');
267 $label = $checkboxFieldLabel.' :: '. $customGroupTitle;
268 $this->select('field_name[1]', "label=$label");
269 $this->click('field_name[1]');
270 $this->click('_qf_Field_next_new-bottom');
271 $this->waitForPageToLoad($this->getTimeoutMsec());
272
273 $this->select('field_name[0]', 'value=Membership');
274 $label = $radioFieldLabel.' :: '. $customGroupTitle;
275 $this->select('field_name[1]', "label=$label");
276 $this->click('field_name[1]');
277 $this->click('_qf_Field_next-bottom');
278 $this->waitForPageToLoad($this->getTimeoutMsec());
279 $this->assertTrue($this->isTextPresent("Your CiviCRM Profile Field '{$radioFieldLabel}' has been saved to 'On Behalf Of Organization'."));
280
281 //create organisation
282 $orgName = "Org WebAccess ". substr(sha1(rand()), 0, 7);
283 $orgEmail = "org". substr(sha1(rand()), 0, 7) . "@web.com";
284 $this->webtestAddOrganization($orgName, $orgEmail);
285
286 $this->waitForPageToLoad($this->getTimeoutMsec());
287 $this->click("css=li#tab_member a");
288
289 $this->waitForElementPresent('link=Add Membership');
290 $this->click('link=Add Membership');
291
292 $this->waitForElementPresent('_qf_Membership_cancel-bottom');
293
294 // fill in Membership Organization and Type
295 $this->select('membership_type_id[0]', "value=1");
296 $this->select('membership_type_id[1]', "value=1");
297
298 // fill in Source
299 $sourceText = 'On behalf Membership Webtest';
300 $this->type('source', $sourceText);
301
302 $this->waitForElementPresent("css=div#{$customGroupTitle} div.crm-accordion-header");
303 $this->click("css=div#{$customGroupTitle} div.crm-accordion-header");
304 //$this->waitForElementPresent('_qf_Membership_cancel-bottom111');
305
306 // select newly created processor
307 $xpath = "xpath=//label[text() = '{$checkboxOptionLabel1}']/preceding-sibling::input[1]";
308 $this->assertTrue($this->isTextPresent($checkboxOptionLabel1));
309 $this->check($xpath);
310
311 $xpath = "xpath=//label[text() = '{$checkboxOptionLabel3}']/preceding-sibling::input[1]";
312 $this->assertTrue($this->isTextPresent($checkboxOptionLabel3));
313 $this->check($xpath);
314
315 $xpath = "xpath=//label[text() = '{$radioOptionLabel1}']/preceding-sibling::input[1]";
316 $this->assertTrue($this->isTextPresent($radioOptionLabel1));
317 $this->check($xpath);
318
319 $this->waitForElementPresent('_qf_Membership_cancel-bottom');
320 $this->click('_qf_Membership_upload-bottom');
321
322
323 $this->waitForPageToLoad($this->getTimeoutMsec());
324 $this->click("css=li#tab_rel a");
325
326 $this->waitForElementPresent('link=Add Relationship');
327 $this->click('link=Add Relationship');
328
329 $this->waitForElementPresent('relationship_type_id');
330 $this->click("relationship_type_id");
331 $this->select("relationship_type_id", "label=Employer of");
332 // search organization
333 $this->type('contact_1', $firstName);
334 $this->click("contact_1");
335 $this->waitForElementPresent("css=div.ac_results-inner li");
336 $this->click("css=div.ac_results-inner li");
337 $this->assertContains($firstName, $this->getValue('contact_1'), "autocomplete expected $firstName but didn’t find it in " . $this->getValue('contact_1'));
338
339 // give permission
340 $this->click("is_permission_a_b");
341 $this->click("is_permission_b_a");
342
343 // save relationship
344 $this->click("details-save");
345 $this->waitForPageToLoad($this->getTimeoutMsec());
346
347 // We need a payment processor
348 $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7);
349 $processorType = 'Dummy';
350 $pageTitle = substr(sha1(rand()), 0, 7);
351 $rand = 100;
352 $hash = substr(sha1(rand()), 0, 7);
353 $amountSection = TRUE;
354 $payLater = TRUE;
355 $onBehalf = TRUE;
356 $pledges = FALSE;
357 $recurring = FALSE;
358 $memberships = TRUE;
359 $memPriceSetId = NULL;
360 $friend = TRUE;
361 $profilePreId = NULL;
362 $profilePostId = NULL;
363 $premiums = FALSE;
364 $widget = FALSE;
365 $pcp = FALSE;
366 $honoreeSection = FALSE;
367 $isAddPaymentProcessor = TRUE;
368 $isPcpApprovalNeeded = FALSE;
369 $isSeparatePayment = FALSE;
370
371 // create a new online contribution page
372 // create contribution page with randomized title and default params
373 $pageId = $this->webtestAddContributionPage($hash,
374 $rand,
375 $pageTitle,
376 array($processorName => $processorType),
377 $amountSection,
378 $payLater,
379 $onBehalf,
380 $pledges,
381 $recurring,
382 $memberships,
383 $memPriceSetId,
384 $friend,
385 $profilePreId,
386 $profilePostId,
387 $premiums,
388 $widget,
389 $pcp,
390 $isAddPaymentProcessor,
391 $isPcpApprovalNeeded,
392 $isSeparatePayment,
393 $honoreeSection
394 );
395
396 //check for formRule
397 //scenario 1 : add membership data in pre / post profile and check for formRule
398 //add new profile
399 $this->open($this->sboxPath . "civicrm/admin/uf/group?reset=1");
400
401 $this->waitForPageToLoad($this->getTimeoutMsec());
402 $this->click('link=Add Profile');
403
404 $profileTitle = "test profile" . substr(sha1(rand()), 0, 7);
405 // Add membership custom data field to profile
406 $this->waitForElementPresent('_qf_Group_cancel-bottom');
407 $this->type('title', $profileTitle);
408 $this->click('_qf_Group_next-bottom');
409
410 $this->waitForElementPresent('_qf_Field_cancel-bottom');
411 $this->assertTrue($this->isTextPresent("Your CiviCRM Profile '{$profileTitle}' has been added. You can add fields to this profile now."));
412
413 $this->select('field_name[0]', "value=Membership");
414 $this->select('field_name[1]', "label={$checkboxFieldLabel} :: {$customGroupTitle}");
415 $this->click('field_name[1]');
416 $this->click('label');
417
418 // Clicking save and new
419 $this->click('_qf_Field_next_new-bottom');
420 $this->waitForPageToLoad($this->getTimeoutMsec());
421 $this->assertTrue($this->isTextPresent("Your CiviCRM Profile Field '{$checkboxFieldLabel}' has been saved to '{$profileTitle}'."));
422
423 $this->open($this->sboxPath . "civicrm/admin/contribute/custom?reset=1&action=update&id={$pageId}");
424 $this->waitForElementPresent('_qf_Custom_next-bottom');
425 $this->select('custom_pre_id', "label={$profileTitle}");
426 $this->click('_qf_Custom_next-bottom');
427 $this->waitForPageToLoad($this->getTimeoutMsec());
428 sleep(3);
429 $this->assertTrue($this->isTextPresent('You should move the membership related fields in the "On Behalf" profile for this Contribution Page'), "Form rule didn't showed up while incorrectly configuring membership fields profile for 'on behalf of' contribution page");
430
431 $this->select('custom_pre_id', "- select -");
432 $this->select('custom_post_id', "label={$profileTitle}");
433 $this->click('_qf_Custom_next-bottom');
434 $this->waitForPageToLoad($this->getTimeoutMsec());
435 sleep(3);
436 $this->assertTrue($this->isTextPresent('You should move the membership related fields in the "On Behalf" profile for this Contribution Page'), "Form rule didn't showed up while incorrectly configuring membership fields profile for 'on behalf of' contribution page");
437
438 //scenario 2 : disable 'on behalf of', add membership data in pre / post profile
439 //then try to add 'on behalf of' and check for formRule
440 //disable 'on behalf of'
441 $this->open($this->sboxPath . "civicrm/admin/contribute/settings?reset=1&action=update&id={$pageId}");
442 $this->waitForElementPresent('_qf_Settings_next-bottom');
443 $this->uncheck('is_organization');
444 $this->click('_qf_Settings_next-bottom');
445 $this->waitForPageToLoad($this->getTimeoutMsec());
446
447 //set a membership field profile for this contribution page
448 $this->click('css=li#tab_custom a');
449 $this->waitForElementPresent('_qf_Custom_next-bottom');
450 $this->select('custom_pre_id', "label={$profileTitle}");
451 $this->click('_qf_Custom_next-bottom');
452 $this->waitForPageToLoad($this->getTimeoutMsec());
453
454 //now visit the title settings page and configure the profile as on behalf of
455 $this->click('css=li#tab_settings a');
456 $this->waitForElementPresent('_qf_Settings_next-bottom');
457 $this->check('is_organization');
458 $this->click('_qf_Settings_next-bottom');
459 $this->waitForPageToLoad($this->getTimeoutMsec());
460 sleep(3);
461 $this->assertTrue($this->isTextPresent("You should move the membership related fields configured in 'Includes Profile (top of page)' to the 'On Behalf' profile for this Contribution Page"), "Form rule 'You should move the membership related fields configured in 'Includes Profile (top of page)' to the 'On Behalf' profile for this Contribution Page' didn't showed up");
462
463 //logout
464 $this->open($this->sboxPath . "civicrm/logout?reset=1");
465 $this->waitForPageToLoad($this->getTimeoutMsec());
466 }
467
468 function testOnBehalfOfOrganizationWithOrgData()
469 {
470
471 // This is the path where our testing install resides.
472 // The rest of URL is defined in CiviSeleniumTestCase base class, in
473 // class attributes.
474 $this->open($this->sboxPath);
475
476 // Logging in. Remember to wait for page to load. In most cases,
477 // you can rely on 30000 as the value that allows your test to pass, however,
478 // sometimes your test might fail because of this. In such cases, it's better to pick one element
479 // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole
480 // page contents loaded and you can continue your test execution.
481 $this->webtestLogin();
482
483 $this->open($this->sboxPath . "civicrm/profile/edit?reset=1&gid=4");
484 $firstName = 'John_x_' . substr(sha1(rand()), 0, 7);
485 $lastName = 'Anderson_c_' . substr(sha1(rand()), 0, 7);
486
487 $this->waitForPageToLoad($this->getTimeoutMsec());
488 $this->waitForElementPresent("_qf_Edit_next");
489 $this->type("first_name", $firstName);
490 $this->type("last_name", $lastName);
491 $this->click("_qf_Edit_next");
492 $this->waitForPageToLoad($this->getTimeoutMsec());
493 $this->waitForElementPresent("profilewrap4");
494
495 $urlElements = $this->parseURL();
496 print_r($urlElements);
497 $cid = $urlElements['queryString']['id'];
498 $this->assertType('numeric', $cid);
499 // Is status message correct?
500 $this->assertTextPresent("Thank you. Your information has been saved.", "Save successful status message didn't show up after saving profile to update testUserName!");
501
502
503 //add org fields to profile
504 $this->open($this->sboxPath . "civicrm/admin/uf/group?reset=1");
505 $this->waitForPageToLoad($this->getTimeoutMsec());
506 $this->click("link=Reserved Profiles");
507
508 $this->click("xpath=//div[@id='reserved-profiles']/div/div/table/tbody//tr/td[1][text()='On Behalf Of Organization']/../td[5]/span/a[text()='Fields']");
509 $this->waitForPageToLoad($this->getTimeoutMsec());
510
511 $this->click("link=Add Field");
512 $this->waitForElementPresent('_qf_Field_next-bottom');
513
514 $this->select('field_name[0]', 'value=Organization');
515 $this->select('field_name[1]', 'label=Legal Identifier');
516 $this->click('field_name[1]');
517 $this->click('_qf_Field_next_new-bottom');
518 $this->waitForPageToLoad($this->getTimeoutMsec());
519
520 $this->select('field_name[0]', 'value=Organization');
521 $this->select('field_name[1]', 'label=Legal Name');
522 $this->click('field_name[1]');
523 $this->click('_qf_Field_next-bottom');
524 $this->waitForPageToLoad($this->getTimeoutMsec());
525
526
527 //create organisation
528 $orgName = "Org WebAccess ". substr(sha1(rand()), 0, 7);
529 $orgEmail = "org". substr(sha1(rand()), 0, 7) . "@web.com";
530 $this->webtestAddOrganization($orgName, $orgEmail);
531
532 $this->waitForPageToLoad($this->getTimeoutMsec());
533 $this->click("css=li#tab_rel a");
534
535 $this->waitForElementPresent('link=Add Relationship');
536 $this->click('link=Add Relationship');
537
538 $this->waitForElementPresent('relationship_type_id');
539 $this->click("relationship_type_id");
540 $this->select("relationship_type_id", "label=Employer of");
541 // search organization
542 $this->type('contact_1', $firstName);
543 $this->click("contact_1");
544 $this->waitForElementPresent("css=div.ac_results-inner li");
545 $this->click("css=div.ac_results-inner li");
546 $this->assertContains($firstName, $this->getValue('contact_1'), "autocomplete expected $firstName but didn’t find it in " . $this->getValue('contact_1'));
547
548 // give permission
549 $this->click("is_permission_a_b");
550 $this->click("is_permission_b_a");
551
552 // save relationship
553 $this->waitForElementPresent("details-save");
554 $this->click("details-save");
555 $this->waitForElementPresent("Relationships");
556
557 $pageTitle = substr(sha1(rand()), 0, 7);
558 $rand = 100;
559 $hash = substr(sha1(rand()), 0, 7);
560 $amountSection = TRUE;
561 $payLater = TRUE;
562 $onBehalf = TRUE;
563 $pledges = FALSE;
564 $recurring = FALSE;
565 $memberships = TRUE;
566 $memPriceSetId = NULL;
567 $friend = TRUE;
568 $profilePreId = NULL;
569 $profilePostId = NULL;
570 $premiums = FALSE;
571 $widget = FALSE;
572 $pcp = FALSE;
573 $honoreeSection = FALSE;
574 $isAddPaymentProcessor = FALSE;
575 $isPcpApprovalNeeded = FALSE;
576 $isSeparatePayment = FALSE;
577
578 // create a new online contribution page
579 // create contribution page with randomized title and default params
580 $pageId = $this->webtestAddContributionPage($hash,
581 $rand,
582 $pageTitle,
583 null,
584 $amountSection,
585 $payLater,
586 $onBehalf,
587 $pledges,
588 $recurring,
589 $memberships,
590 $memPriceSetId,
591 $friend,
592 $profilePreId,
593 $profilePostId,
594 $premiums,
595 $widget,
596 $pcp,
597 $isAddPaymentProcessor,
598 $isPcpApprovalNeeded,
599 $isSeparatePayment,
600 $honoreeSection
601 );
602
603 $this->_testOrganization($pageId, $cid, $pageTitle);
604 }
605
606
607 function _testOrganization($pageId, $cid, $pageTitle) {
608 //Open Live Contribution Page
609 $this->open($this->sboxPath . "civicrm/contribute/transact?reset=1&id=" . $pageId);
610
611 $this->waitForElementPresent("_qf_Main_upload-bottom");
612
613 $this->waitForElementPresent("onbehalf_state_province-3");
614
615 $this->waitForElementPresent("onbehalf_phone-3-1");
616 $this->type("onbehalf_phone-3-1", 9999999999);
617 $this->waitForElementPresent("onbehalf_email-3");
618 $this->type("onbehalf_email-3", "org@example.com");
619 $this->type("onbehalf_street_address-3", "Test Street Address");
620 $this->type("onbehalf_city-3", "Test City");
621 $this->type("onbehalf_postal_code-3", substr(sha1(rand()), 0, 6));
622 $this->click("onbehalf_country-3");
623 $this->select("onbehalf_country-3", "label=United States");
624 $this->click("onbehalf_state_province-3");
625 $this->select("onbehalf_state_province-3", "label=Alabama");
626
627 $this->waitForElementPresent("_qf_Main_upload-bottom");
628 $this->click("_qf_Main_upload-bottom");
629
630 $this->waitForPageToLoad($this->getTimeoutMsec());
631
632 $this->waitForElementPresent("_qf_Confirm_next-bottom");
633
634 $this->click("_qf_Confirm_next-bottom");
635 $this->waitForPageToLoad($this->getTimeoutMsec());
636
637 }
638
639 function _testAnomoyousOganization($pageId, $cid, $pageTitle) {
640 //Open Live Contribution Page
641 $this->open($this->sboxPath . "civicrm/contribute/transact?reset=1&id=" . $pageId);
642
643 $this->waitForElementPresent("_qf_Main_upload-bottom");
644
645 $this->click('CIVICRM_QFID_0_8');
646 $this->type('css=div.other_amount-section input', 60);
647
648 $firstName = 'Ma' . substr(sha1(rand()), 0, 4);
649 $lastName = 'An' . substr(sha1(rand()), 0, 7);
650 $orgName = 'org_11_' . substr(sha1(rand()), 0, 7);
651 $this->type("email-5", $firstName . "@example.com");
652
653 // enable onbehalforganization block
654 $this->click("is_for_organization");
655 $this->waitForElementPresent("onbehalf_state_province-3");
656
657 // onbehalforganization info
658 $this->type("onbehalf_organization_name", $orgName);
659 $this->type("onbehalf_phone-3-1", 9999999999);
660 $this->type("onbehalf_email-3", "{$orgName}@example.com");
661 $this->type("onbehalf_street_address-3", "Test Street Address");
662 $this->type("onbehalf_city-3", "Test City");
663 $this->type("onbehalf_postal_code-3", substr(sha1(rand()), 0, 6));
664 $this->click("onbehalf_country-3");
665 $this->select("onbehalf_country-3", "label=United States");
666 $this->click("onbehalf_state_province-3");
667 $this->select("onbehalf_state_province-3", "label=Alabama");
668
669
670 // Credit Card Info
671 $this->select("credit_card_type", "value=Visa");
672 $this->type("credit_card_number", "4111111111111111");
673 $this->type("cvv2", "000");
674 $this->select("credit_card_exp_date[M]", "value=1");
675 $this->select("credit_card_exp_date[Y]", "value=2020");
676
677 //Billing Info
678 $this->type("billing_first_name", $firstName . 'billing');
679 $this->type("billing_last_name", $lastName . 'billing');
680 $this->type("billing_street_address-5", "0121 Mount Highschool.");
681 $this->type(" billing_city-5", "Shangai");
682 $this->select("billing_country_id-5", "value=1228");
683 $this->select("billing_state_province_id-5", "value=1004");
684 $this->type("billing_postal_code-5", "94129");
685 $this->click("_qf_Main_upload-bottom");
686
687 $this->waitForPageToLoad($this->getTimeoutMsec());
688 $this->waitForElementPresent("_qf_Confirm_next-bottom");
689
690 $this->click("_qf_Confirm_next-bottom");
691 $this->waitForPageToLoad($this->getTimeoutMsec());
692
693 //login to check contribution
694 $this->open($this->sboxPath);
695
696 // Log in using webtestLogin() method
697 $this->webtestLogin();
698
699 //Find Contribution
700 $this->open($this->sboxPath . "civicrm/contribute/search?reset=1");
701 $this->type("sort_name", $orgName);
702 $this->click("_qf_Search_refresh");
703
704 $this->waitForPageToLoad($this->getTimeoutMsec());
705
706 $this->waitForElementPresent("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']");
707 $this->click("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']");
708 $this->waitForPageToLoad($this->getTimeoutMsec());
709 $this->waitForElementPresent("_qf_ContributionView_cancel-bottom");
710
711 // verify contrb created
712 $expected = array(
713 1 => $orgName,
714 2 => 'Donation',
715 10 => $pageTitle,
716 );
717 foreach ($expected as $value => $label) {
718 $this->verifyText("xpath=id( 'ContributionView' )/div[2]/table[1]/tbody/tr[$value]/td[2]", preg_quote($label));
719 }
720 }
721
722 function _testUserWithOneRelationship($pageId, $cid, $pageTitle) {
723 // Logging in. Remember to wait for page to load. In most cases,
724 // you can rely on 30000 as the value that allows your test to pass, however,
725 // sometimes your test might fail because of this. In such cases, it's better to pick one element
726 // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole
727 // page contents loaded and you can continue your test execution.
728 $this->webtestLogin();
729 $this->waitForPageToLoad($this->getTimeoutMsec());
730
731 // Create new group
732 $groupName = $this->WebtestAddGroup();
733 $this->open($this->sboxPath . "civicrm/group?reset=1");
734 $this->waitForPageToLoad($this->getTimeoutMsec());
735 $this->waitForElementPresent("_qf_Search_refresh");
736 $groupId = $this->getText("xpath=//table[@id='crm-group-selector']/tbody//tr/td[text()='{$groupName}']/../td[2]");
737
738 $this->open($this->sboxPath . "civicrm/contact/view?reset=1&cid={$cid}");
739 $this->waitForPageToLoad($this->getTimeoutMsec());
740
741 $this->click('link=Edit');
742 $this->waitForElementPresent('_qf_Contact_cancel-bottom');
743 $this->click('addressBlock');
744 $this->waitForElementPresent('link=Another Address');
745
746 //Billing Info
747 $this->select('address_1_location_type_id', 'label=Billing');
748 $this->type('address_1_street_address', '0121 Mount Highschool.');
749 $this->type('address_1_city', "Shangai");
750 $this->type('address_1_postal_code', "94129");
751 $this->select('address_1_country_id', "value=1228");
752 $this->select('address_1_state_province_id', "value=1004");
753 $this->click('_qf_Contact_upload_view-bottom');
754 $this->waitForPageToLoad($this->getTimeoutMsec());
755
756 // add contact to group
757 // visit group tab
758 $this->click("css=li#tab_group a");
759 $this->waitForElementPresent("group_id");
760
761 // add to group
762 $this->select("group_id", "label={$groupName}");
763 $this->click("_qf_GroupContact_next");
764 $this->waitForPageToLoad($this->getTimeoutMsec());
765
766 $this->open($this->sboxPath . "civicrm/admin/custom/group?action=add&reset=1");
767 $this->waitForElementPresent("_qf_Group_next-bottom");
768
769 // fill in a unique title for the custom group
770 $groupTitle = "Custom Group" . substr(sha1(rand()), 0, 7);
771 $this->type("title", $groupTitle);
772
773 // select the group this custom data set extends
774 $this->select("extends[0]", "value=Contribution");
775 $this->waitForElementPresent("extends[1]");
776
777 // save the custom group
778 $this->click("_qf_Group_next-bottom");
779 $this->waitForElementPresent("_qf_Field_next_new-bottom");
780 $this->assertTrue($this->isTextPresent("Your custom field set '$groupTitle' has been added. You can add custom fields now."));
781
782 // add a custom field to the custom group
783 $fieldTitle = "Custom Field " . substr(sha1(rand()), 0, 7);
784 $this->type("label", $fieldTitle);
785
786 $this->select("data_type[1]", "value=Text");
787 $this->click('_qf_Field_next-bottom');
788
789 $this->waitForPageToLoad($this->getTimeoutMsec());
790 $this->assertTrue($this->isTextPresent("Your custom field '$fieldTitle' has been saved."));
791 $url = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']/div[2]/table/tbody//tr/td[1][text()='$fieldTitle']/../td[8]/span/a@href"));
792 $fieldId = $url[1];
793
794 // Enable CiviCampaign module if necessary
b9715b8a 795 $this->enableComponents("CiviCampaign");
6a488035
TO
796
797 // add the required Drupal permission
798 $permission = array('edit-2-administer-civicampaign');
799 $this->changePermissions($permission);
800
801 // Go directly to the URL of the screen that you will be add campaign
802 $this->open($this->sboxPath . "civicrm/campaign/add?reset=1");
803
804 // As mentioned before, waitForPageToLoad is not always reliable. Below, we're waiting for the submit
805 // button at the end of this page to show up, to make sure it's fully loaded.
806 $this->waitForElementPresent("_qf_Campaign_upload-bottom");
807
808 // Let's start filling the form with values.
809 $title = 'Campaign ' . substr(sha1(rand()), 0, 7);
810 $this->type("title", $title);
811
812 // select the campaign type
813 $this->select("campaign_type_id", "value=2");
814
815 // fill in the description
816 $this->type("description", "This is a test campaign");
817
818 // include groups for the campaign
819 $this->addSelection("includeGroups-f", "label={$groupName}");
820 $this->click("//option[@value={$groupId}]");
821 $this->click("add");
822
823 // fill the end date for campaign
824 $this->webtestFillDate("end_date", "+1 year");
825
826 // select campaign status
827 $this->select("status_id", "value=2");
828
829 // click save
830 $this->click("_qf_Campaign_upload-bottom");
831 $this->waitForElementPresent("xpath=//div[@id='campaigns_wrapper']//table[@id='campaigns']/tbody//tr/td[3][text()='{$title}']");
832 $this->assertTrue($this->isTextPresent("Campaign {$title} has been saved."), "Status message didn't show up after saving!");
833
834 $this->open($this->sboxPath . "civicrm/admin/uf/group?reset=1");
835 $this->waitForPageToLoad($this->getTimeoutMsec());
836 $this->click("link=Reserved Profiles");
837
838 $this->click("xpath=//div[@id='reserved-profiles']/div/div/table/tbody//tr/td[1][text()='On Behalf Of Organization']/../td[5]/span/a[text()='Fields']");
839 $this->waitForPageToLoad($this->getTimeoutMsec());
840
841 $this->click("link=Add Field");
842 $this->waitForElementPresent('_qf_Field_next-bottom');
843 $this->select('field_name[0]', 'value=Contribution');
844 $this->select('field_name[1]', 'label=Campaign');
845 $this->click('field_name[1]');
846 $this->click('_qf_Field_next_new-bottom');
847 $this->waitForPageToLoad($this->getTimeoutMsec());
848
849 $this->select('field_name[0]', 'value=Contribution');
850 $this->select('field_name[1]', "label=$fieldTitle :: $groupTitle");
851 $this->click('field_name[1]');
852 $this->click('_qf_Field_next-bottom');
853 $this->waitForPageToLoad($this->getTimeoutMsec());
854 $this->assertTrue($this->isTextPresent("Your CiviCRM Profile Field '{$fieldTitle}' has been saved to 'On Behalf Of Organization'."));
855
856 // Open Page to create Organization
857 $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Organization");
858 $this->waitForElementPresent("_qf_Contact_upload_view-bottom");
859 $orgName1 = 'org1_' . substr(sha1(rand()), 0, 7);
860
861 // Type Organization name
862 $this->type("organization_name", $orgName1);
863
864 // Type Organizatio email for main
865 $this->type("email_1_email", "{$orgName1}@example.com");
866 $this->select("email_1_location_type_id", "value=3");
867
868 // type phone no for main
869 $this->type("phone_1_phone", 9999999999);
870 $this->select("phone_1_location_type_id", "value=3");
871
872 //address section
873 $this->click("addressBlock");
874 $this->waitForElementPresent("address_1_street_address");
875
876 //fill in address 1 for main
877 $this->select("address_1_location_type_id", "value=3");
878 $this->type("address_1_street_address", "{$orgName1} street address");
879 $this->type("address_1_city", "{$orgName1} city");
880 $this->type("address_1_postal_code", substr(sha1(rand()), 0, 4));
881 $this->assertTrue($this->isTextPresent("- select - United States"));
882 $this->select("address_1_state_province_id", "value=1019");
883 $this->type("address_1_geo_code_1", "1234");
884 $this->type("address_1_geo_code_2", "5678");
885
886 // Save the Organization
887 $this->click("_qf_Contact_upload_view-bottom");
888 $this->waitForPageToLoad($this->getTimeoutMsec());
889
890 // open contact
891 $this->open($this->sboxPath . "civicrm/contact/view/rel?cid={$cid}&action=add&reset=1");
892 $this->waitForPageToLoad($this->getTimeoutMsec());
893
894 // select relationship type
895 $this->click("relationship_type_id");
896 $this->select("relationship_type_id", "value=4_a_b");
897
898 // search organization
899 $this->type('contact_1', $orgName1);
900 $this->click("contact_1");
901 $this->waitForElementPresent("css=div.ac_results-inner li");
902 $this->click("css=div.ac_results-inner li");
903 $this->assertContains($orgName1, $this->getValue('contact_1'), "autocomplete expected $orgName1 but didn’t find it in " . $this->getValue('contact_1'));
904
905 $this->waitForElementPresent("add_current_employer");
906 $this->click("add_current_employer");
907
908 // give permission
909 $this->click("is_permission_a_b");
910 $this->click("is_permission_b_a");
911
912 // save relationship
913 $this->waitForElementPresent("details-save");
914 $this->click("details-save");
915
916 //Open Live Contribution Page
917 $this->open($this->sboxPath . "civicrm/contribute/transact?reset=1&id=" . $pageId . "&cid=" . $cid);
918 $this->waitForElementPresent("onbehalf_state_province-3");
919 $this->click('CIVICRM_QFID_amount_other_radio_4');
920 $this->type('amount_other', 60);
921 $this->click('onbehalf_contribution_campaign_id');
922 $this->select('onbehalf_contribution_campaign_id', "label={$title}");
923 $this->type("onbehalf_custom_{$fieldId}", 'Test Subject');
924
925 // Credit Card Info
926 $this->select("credit_card_type", "value=Visa");
927 $this->type("credit_card_number", "4111111111111111");
928 $this->type("cvv2", "000");
929 $this->select("credit_card_exp_date[M]", "value=1");
930 $this->select("credit_card_exp_date[Y]", "value=2020");
931
932 //Billing Info
933 $this->type("billing_street_address-5", "0121 Mount Highschool.");
934 $this->type(" billing_city-5", "Shangai");
935 $this->select("billing_country_id-5", "value=1228");
936 $this->select("billing_state_province_id-5", "value=1004");
937 $this->type("billing_postal_code-5", "94129");
938
939 $this->click("_qf_Main_upload-bottom");
940 $this->waitForPageToLoad($this->getTimeoutMsec());
941 $this->waitForElementPresent("_qf_Confirm_next-bottom");
942 $this->click("_qf_Confirm_next-bottom");
943 $this->waitForPageToLoad($this->getTimeoutMsec());
944
945 //Find Contribution
946 $this->open($this->sboxPath . "civicrm/contribute/search?reset=1");
947 $this->type("sort_name", $orgName1);
948 $this->click("_qf_Search_refresh");
949 $this->waitForPageToLoad($this->getTimeoutMsec());
950 $this->waitForElementPresent("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']");
951 $this->click("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']");
952 $this->waitForPageToLoad($this->getTimeoutMsec());
953 $this->waitForElementPresent("_qf_ContributionView_cancel-bottom");
954
955 // verify contrb created
956 $expected = array(
957 1 => $orgName1,
958 2 => 'Donation',
959 10 => $title,
960 11 => $pageTitle,
961 );
962 foreach ($expected as $value => $label) {
963 $this->verifyText("xpath=id( 'ContributionView' )/div[2]/table[1]/tbody/tr[$value]/td[2]", preg_quote($label));
964 }
965
966
967 $this->open($this->sboxPath . "civicrm/admin/uf/group?reset=1");
968 $this->waitForPageToLoad($this->getTimeoutMsec());
969 $this->click("link=Reserved Profiles");
970
971 $this->click("xpath=//div[@id='reserved-profiles']/div/div/table/tbody//tr/td[1][text()='On Behalf Of Organization']/../td[5]/span/a[text()='Fields']");
972 $this->waitForPageToLoad($this->getTimeoutMsec());
973
974 $this->click("xpath=//div[@id='field_page']/div[3]/table/tbody//tr/td[1][text()='Campaign']/../td[9]/span[2][text()='more ']/ul/li[2]/a[text()='Delete']");
975 $this->waitForElementPresent('_qf_Field_next-bottom');
976
977 $this->click('_qf_Field_next-bottom');
978 $this->waitForPageToLoad($this->getTimeoutMsec());
979 $this->assertTrue($this->isTextPresent('Selected Profile Field has been deleted.'), "Status message didn't show up after saving!");
980
981 $this->click("xpath=//div[@id='field_page']/div[3]/table/tbody//tr/td[1][text()='{$fieldTitle}']/../td[9]/span[2][text()='more ']/ul/li[2]/a[text()='Delete']");
982 $this->waitForElementPresent('_qf_Field_next-bottom');
983
984 $this->click('_qf_Field_next-bottom');
985 $this->waitForPageToLoad($this->getTimeoutMsec());
986 $this->assertTrue($this->isTextPresent('Selected Profile Field has been deleted.'), "Status message didn't show up after saving!");
987 }
988
989 function _testUserWithMoreThanOneRelationship($pageId, $cid, $pageTitle) {
990 // Logging in. Remember to wait for page to load. In most cases,
991 // you can rely on 30000 as the value that allows your test to pass, however,
992 // sometimes your test might fail because of this. In such cases, it's better to pick one element
993 // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole
994 // page contents loaded and you can continue your test execution.
995 $this->webtestLogin();
996 $this->waitForPageToLoad($this->getTimeoutMsec());
997
998 // Create new group
999 $groupName = $this->WebtestAddGroup();
1000 $this->open($this->sboxPath . "civicrm/group?reset=1");
1001 $this->waitForElementPresent('_qf_Search_refresh');
1002 $this->click('_qf_Search_refresh');
1003 $this->waitForElementPresent("xpath=//div[@id='group']/div[3]/table/tbody//tr/td[text()='{$groupName}']/../td[2]");
1004 $groupId = $this->getText("xpath=//div[@id='group']/div[3]/table/tbody//tr/td[text()='{$groupName}']/../td[2]");
1005
1006 $this->open($this->sboxPath . "civicrm/contact/view?reset=1&cid={$cid}");
1007 $this->waitForPageToLoad($this->getTimeoutMsec());
1008
1009 $this->click('link=Edit');
1010 $this->waitForElementPresent('_qf_Contact_cancel-bottom');
1011 $this->click('addressBlock');
1012 $this->waitForElementPresent('link=Another Address');
1013
1014 //Billing Info
1015 $this->select('address_1_location_type_id', 'label=Billing');
1016 $this->type('address_1_street_address', '0121 Mount Highschool.');
1017 $this->type('address_1_city', "Shangai");
1018 $this->type('address_1_postal_code', "94129");
1019 $this->select('address_1_country_id', "value=1228");
1020 $this->select('address_1_state_province_id', "value=1004");
1021 $this->click('_qf_Contact_upload_view-bottom');
1022 $this->waitForPageToLoad($this->getTimeoutMsec());
1023
1024 // add contact to group
1025 // visit group tab
1026 $this->click("css=li#tab_group a");
1027 $this->waitForElementPresent("group_id");
1028
1029 // add to group
1030 $this->select("group_id", "label=$groupName");
1031 $this->click("_qf_GroupContact_next");
1032 $this->waitForPageToLoad($this->getTimeoutMsec());
1033
1034 $this->open($this->sboxPath . "civicrm/admin/custom/group?action=add&reset=1");
1035 $this->waitForElementPresent("_qf_Group_next-bottom");
1036
1037 // fill in a unique title for the c$groupIdustom group
1038 $groupTitle = "Members Custom Group" . substr(sha1(rand()), 0, 7);
1039 $this->type("title", $groupTitle);
1040
1041 // select the group this custom data set extends
1042 $this->select("extends[0]", "value=Membership");
1043 $this->waitForElementPresent("extends[1]");
1044
1045 // save the custom group
1046 $this->click("_qf_Group_next-bottom");
1047
1048 $this->waitForElementPresent("_qf_Field_next_new-bottom");
1049 $this->assertTrue($this->isTextPresent("Your custom field set '$groupTitle' has been added. You can add custom fields now."));
1050
1051 // add a custom field to the custom group
1052 $fieldTitle = "Member Custom Field " . substr(sha1(rand()), 0, 7);
1053 $this->type("label", $fieldTitle);
1054
1055 $this->select("data_type[1]", "value=Text");
1056 $this->click('_qf_Field_next-bottom');
1057
1058 $this->waitForPageToLoad($this->getTimeoutMsec());
1059 $this->assertTrue($this->isTextPresent("Your custom field '$fieldTitle' has been saved."));
1060 $url = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']/div[2]/table/tbody//tr/td[1]/span[text()='$fieldTitle']/../td[8]/span/a@href"));
1061 $fieldId = $url[1];
1062
1063 // Enable CiviCampaign module if necessary
b9715b8a 1064 $this->enableComponents("CiviCampaign");
6a488035
TO
1065
1066 // add the required Drupal permission
1067 $permission = array('edit-2-administer-civicampaign');
1068 $this->changePermissions($permission);
1069
1070 // Go directly to the URL of the screen that you will be add campaign
1071 $this->open($this->sboxPath . "civicrm/campaign/add?reset=1");
1072
1073 // As mentioned before, waitForPageToLoad is not always reliable. Below, we're waiting for the submit
1074 // button at the end of this page to show up, to make sure it's fully loaded.
1075 $this->waitForElementPresent("_qf_Campaign_upload-bottom");
1076
1077 // Let's start filling the form with values.
1078 $title = 'Campaign ' . substr(sha1(rand()), 0, 7);
1079 $this->type("title", $title);
1080
1081 // select the campaign type
1082 $this->select("campaign_type_id", "value=2");
1083
1084 // fill in the description
1085 $this->type("description", "This is a test campaign");
1086
1087 // include groups for the campaign
1088 $this->addSelection("includeGroups-f", "label={$groupName}");
1089 $this->click("//option[@value={$groupId}]");
1090 $this->click("add");
1091
1092 // fill the end date for campaign
1093 $this->webtestFillDate("end_date", "+1 year");
1094
1095 // select campaign status
1096 $this->select("status_id", "value=2");
1097
1098 // click save
1099 $this->click("_qf_Campaign_upload-bottom");
1100 $this->waitForPageToLoad($this->getTimeoutMsec());
1101
1102 $this->assertTrue($this->isTextPresent("Campaign {$title} has been saved."), "Status message didn't show up after saving!");
1103
1104 $this->open($this->sboxPath . "civicrm/admin/uf/group?reset=1");
1105 $this->waitForPageToLoad($this->getTimeoutMsec());
1106 $this->click("link=Reserved Profiles");
1107 $this->click("xpath=//div[@id='reserved-profiles']/div/div/table/tbody//tr/td[1][text()='On Behalf Of Organization']/../td[5]/span/a[text()='Fields']");
1108 $this->waitForPageToLoad($this->getTimeoutMsec());
1109
1110 $this->click("link=Add Field");
1111 $this->waitForElementPresent('_qf_Field_next-bottom');
1112 $this->select('field_name[0]', 'value=Membership');
1113 $this->select('field_name[1]', 'label=Campaign');
1114 $this->click('field_name[1]');
1115 $this->click('_qf_Field_next_new-bottom');
1116 $this->waitForPageToLoad($this->getTimeoutMsec());
1117 $this->waitForElementPresent('_qf_Field_cancel-bottom');
1118
1119 $this->select('field_name[0]', 'value=Membership');
1120 $this->select('field_name[1]', "label=$fieldTitle :: $groupTitle");
1121 $this->click('field_name[1]');
1122 $this->click('_qf_Field_next-bottom');
1123 $this->waitForPageToLoad($this->getTimeoutMsec());
1124 $this->assertTrue($this->isTextPresent("Your CiviCRM Profile Field '{$fieldTitle}' has been saved to 'On Behalf Of Organization'."),
1125 "Status message didn't show up after saving!"
1126 );
1127
1128 // Open Page to create Organization 1
1129 $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Organization");
1130 $this->waitForElementPresent("_qf_Contact_upload_view-bottom");
1131 $orgName1 = 'org1_' . substr(sha1(rand()), 0, 7);
1132
1133 // Type Organization name
1134 $this->type("organization_name", $orgName1);
1135
1136 // Type Organizatio email for main
1137 $this->type("email_1_email", "{$orgName1}@example.com");
1138 $this->select("email_1_location_type_id", "value=3");
1139
1140 // type phone no for main
1141 $this->type("phone_1_phone", substr(sha1(rand()), 0, 4));
1142 $this->select("phone_1_location_type_id", "value=3");
1143
1144 //address section
1145 $this->click("addressBlock");
1146 $this->waitForElementPresent("address_1_street_address");
1147
1148 //fill in address 1 for main
1149 $this->select("address_1_location_type_id", "value=3");
1150 $this->type("address_1_street_address", "{$orgName1} street address");
1151 $this->type("address_1_city", "{$orgName1} city");
1152 $this->type("address_1_postal_code", "9999999999");
1153 $this->assertTrue($this->isTextPresent("- select - United States"));
1154 $this->select("address_1_state_province_id", "value=1019");
1155 $this->type("address_1_geo_code_1", "1234");
1156 $this->type("address_1_geo_code_2", "5678");
1157
1158 // Save the Organization
1159 $this->click("_qf_Contact_upload_view-bottom");
1160 $this->waitForPageToLoad($this->getTimeoutMsec());
1161
1162 // create second orzanization
1163 $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Organization");
1164 $this->waitForElementPresent("_qf_Contact_upload_view-bottom");
1165 $orgName2 = 'org2_' . substr(sha1(rand()), 0, 7);
1166
1167 // Type Organization name
1168 $this->type("organization_name", $orgName2);
1169
1170 // Type Organizatio email for main
1171 $this->type("email_1_email", "{$orgName2}@example.com");
1172 $this->select("email_1_location_type_id", "value=3");
1173
1174 // type phone no for main
1175 $this->type("phone_1_phone", substr(sha1(rand()), 0, 4));
1176 $this->select("phone_1_location_type_id", "value=3");
1177
1178 //address section
1179 $this->click("addressBlock");
1180 $this->waitForElementPresent("address_1_street_address");
1181
1182 //fill in address 1 for main
1183 $this->select("address_1_location_type_id", "value=3");
1184 $this->type("address_1_street_address", "{$orgName2} street address");
1185 $this->type("address_1_city", "{$orgName2} city");
1186 $this->type("address_1_postal_code", "7777777777");
1187 $this->assertTrue($this->isTextPresent("- select - United States"));
1188 $this->select("address_1_state_province_id", "value=1019");
1189 $this->type("address_1_geo_code_1", "1224");
1190 $this->type("address_1_geo_code_2", "5628");
1191
1192 // Save the Organization
1193 $this->click("_qf_Contact_upload_view-bottom");
1194 $this->waitForPageToLoad($this->getTimeoutMsec());
1195
1196
1197 // create Membership type
1198 $title1 = "Membership Type" . substr(sha1(rand()), 0, 7);
1199 $this->open($this->sboxPath . "civicrm/admin/member/membershipType?reset=1&action=browse");
1200 $this->waitForPageToLoad($this->getTimeoutMsec());
1201
1202 $this->click("link=Add Membership Type");
1203 $this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
1204
1205 $this->type('name', $title1);
1206 $this->type('member_org', $orgName1);
1207 $this->click('_qf_MembershipType_refresh');
1208 $this->waitForElementPresent("xpath=//div[@id='membership_type_form']/fieldset/table[2]/tbody/tr[2]/td[2]");
1209
1210 $this->type('minimum_fee', '50');
1211
1212 $this->select( 'financial_type_id', 'value=2' );
1213
1214 $this->type('duration_interval', 1);
1215 $this->select('duration_unit', "label=year");
1216
1217 $this->select('period_type', "label=fixed");
1218 $this->waitForElementPresent('fixed_period_rollover_day[d]');
1219
1220 $this->select('fixed_period_start_day[M]', 'value=4');
1221 $this->select('fixed_period_rollover_day[M]', 'value=1');
1222
1223 $this->select('relationship_type_id', 'value=4_b_a');
1224
1225 $this->click('_qf_MembershipType_upload-bottom');
1226 $this->waitForElementPresent('link=Add Membership Type');
1227 $this->assertTrue($this->isTextPresent("The membership type '$title1' has been saved."));
1228 $typeUrl = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/div[2]/table/tbody//tr/td[1][text()='{$title1}']/../td[10]/span/a[3]@href"));
1229 $typeId = $typeUrl[1];
1230
1231 // open contact
1232 $this->open($this->sboxPath . "civicrm/contact/view/rel?cid={$cid}&action=add&reset=1");
1233 $this->waitForPageToLoad($this->getTimeoutMsec());
1234
1235 // select relationship type
1236 $this->click("relationship_type_id");
1237 $this->select("relationship_type_id", "value=4_a_b");
1238
1239 // search organization
1240 $this->type('contact_1', $orgName1);
1241 $this->click("contact_1");
1242 $this->waitForElementPresent("css=div.ac_results-inner li");
1243 $this->click("css=div.ac_results-inner li");
1244 $this->assertContains($orgName1, $this->getValue('contact_1'), "autocomplete expected $orgName1 but didn’t find it in " . $this->getValue('contact_1'));
1245
1246 // give permission
1247 $this->click("is_permission_a_b");
1248 $this->click("is_permission_b_a");
1249
1250 // save relationship
1251 $this->click("details-save");
1252
1253 // open contact
1254 $this->open($this->sboxPath . "civicrm/contact/view/rel?cid={$cid}&action=add&reset=1");
1255 $this->waitForPageToLoad($this->getTimeoutMsec());
1256
1257 // select relationship type
1258 $this->click("relationship_type_id");
1259 $this->select("relationship_type_id", "value=4_a_b");
1260
1261 // search organization
1262 $this->type('contact_1', $orgName2);
1263 $this->click("contact_1");
1264 $this->waitForElementPresent("css=div.ac_results-inner li");
1265 $this->click("css=div.ac_results-inner li");
1266 $this->assertContains($orgName2, $this->getValue('contact_1'), "autocomplete expected $orgName2 but didn’t find it in " . $this->getValue('contact_1'));
1267
1268 // give permission
1269 $this->click("is_permission_a_b");
1270 $this->click("is_permission_b_a");
1271
1272 // save relationship
1273 $this->click("details-save");
1274
1275 // set membership type
1276 $this->open($this->sboxPath . "civicrm/admin/contribute/membership?reset=1&action=update&id=" . $pageId);
1277 $this->waitForElementPresent("_qf_MembershipBlock_upload_done-bottom");
1278 $this->click("member_is_active");
1279 $this->click("membership_type[{$typeId}]");
1280 $this->click("xpath=//div[@id='memberFields']//table[@class='report']/tbody//tr/td[1]/label[text()='{$title1}']/../../td[2]/input");
1281 $this->click('_qf_MembershipBlock_upload_done-bottom');
1282 $this->waitForPageToLoad($this->getTimeoutMsec());
1283
1284 //Open Live Membership Page
1285 $this->open($this->sboxPath . "civicrm/contribute/transact?reset=1&id=" . $pageId . "&cid=" . $cid);
1286 $this->waitForElementPresent("_qf_Main_upload-bottom");
1287 $this->click('CIVICRM_QFID_amount_other_radio_4');
1288 $this->type('amount_other', 60);
1289 $this->click('onbehalf_organization_name');
1290 $this->type('onbehalf_organization_name', $orgName1);
1291 $this->typeKeys('onbehalf_organization_name', $orgName1);
1292 $this->click("onbehalf_organization_name");
1293 $this->waitForElementPresent("css=div.ac_results-inner li");
1294 $this->click("css=div.ac_results-inner li");
1295 sleep(5);
1296 $this->click('onbehalf_member_campaign_id');
1297 $this->select('onbehalf_member_campaign_id', "label={$title}");
1298 $this->type("onbehalf_custom_{$fieldId}", 'Test Subject');
1299
1300 $this->assertContains($orgName1, $this->getValue('onbehalf_organization_name'), "autocomplete expected $orgName1 but didn’t find it in " . $this->getValue('onbehalf_organization_name'));
1301
1302 // Credit Card Info
1303 $this->select("credit_card_type", "value=Visa");
1304 $this->type("credit_card_number", "4111111111111111");
1305 $this->type("cvv2", "000");
1306 $this->select("credit_card_exp_date[M]", "value=1");
1307 $this->select("credit_card_exp_date[Y]", "value=2020");
1308
1309 $this->click("_qf_Main_upload-bottom");
1310 $this->waitForPageToLoad($this->getTimeoutMsec());
1311 $this->waitForElementPresent("_qf_Confirm_next-bottom");
1312 $this->click("_qf_Confirm_next-bottom");
1313 $this->waitForPageToLoad($this->getTimeoutMsec());
1314
1315 //Find Membership for organization
1316 $this->open($this->sboxPath . "civicrm/member/search?reset=1");
1317 $this->type("sort_name", $orgName1);
1318 $this->click("_qf_Search_refresh");
1319 $this->waitForPageToLoad($this->getTimeoutMsec());
1320 $this->waitForElementPresent("xpath=//div[@id='memberSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']");
1321 $this->click("xpath=//div[@id='memberSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']");
1322 $this->waitForPageToLoad($this->getTimeoutMsec());
1323 $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
1324
1325 //verify contrb created
1326 $expected = array(
1327 1 => $orgName1,
1328 2 => $title1,
1329 3 => 'New',
1330 );
1331 foreach ($expected as $value => $label) {
1332 $this->verifyText("xpath=//form[@id='MembershipView']/div[2]/div/table/tbody/tr[$value]/td[2]", preg_quote($label));
1333 }
1334
1335 // find membership for contact in relationship
1336 $this->open($this->sboxPath . "civicrm/contact/view?reset=1&force=1&cid={$cid}");
1337 $this->waitForPageToLoad($this->getTimeoutMsec());
1338 $this->click("css=li#tab_member a");
1339 $this->waitForElementPresent("xpath=//div[@id='memberships']/div/table//tbody//tr/td[1][text()='{$title1}']");
1340 $this->click("xpath=//div[@id='memberships']/div/table//tbody//tr/td[1][text()='{$title1}']/../td[7]/span/a[text()='View']");
1341 $this->waitForPageToLoad($this->getTimeoutMsec());
1342
1343 //verify contrb created
1344 $expected = array(
1345 3 => $title1,
1346 4 => 'New',
1347 );
1348 foreach ($expected as $value => $label) {
1349 $this->verifyText("xpath=//form[@id='MembershipView']/div[2]/div/table/tbody/tr[$value]/td[2]", preg_quote($label));
1350 }
1351
1352 $this->open($this->sboxPath . "civicrm/admin/uf/group?reset=1");
1353 $this->waitForPageToLoad($this->getTimeoutMsec());
1354 $this->click("link=Reserved Profiles");
1355 $this->click("xpath=//div[@id='reserved-profiles']/div/div/table/tbody//tr/td[1][text()='On Behalf Of Organization']/../td[5]/span/a[text()='Fields']");
1356 $this->waitForPageToLoad($this->getTimeoutMsec());
1357
1358 $this->click("xpath=//div[@id='field_page']/div[3]/table/tbody//tr/td[1][text()='Campaign']/../td[9]/span[2][text()='more ']/ul/li[2]/a[text()='Delete']");
1359 $this->waitForElementPresent('_qf_Field_next-bottom');
1360
1361 $this->click('_qf_Field_next-bottom');
1362 $this->waitForPageToLoad($this->getTimeoutMsec());
1363 $this->assertTrue($this->isTextPresent('Selected Profile Field has been deleted.'),
1364 "Status message didn't show up after saving!"
1365 );
1366
1367 $this->click("xpath=//div[@id='field_page']/div[3]/table/tbody//tr/td[1][text()='{$fieldTitle}']/../td[9]/span[2][text()='more ']/ul/li[2]/a[text()='Delete']");
1368 $this->waitForElementPresent('_qf_Field_next-bottom');
1369
1370 $this->click('_qf_Field_next-bottom');
1371 $this->waitForPageToLoad($this->getTimeoutMsec());
1372 $this->assertTrue($this->isTextPresent('Selected Profile Field has been deleted.'),
1373 "Status message didn't show up after saving!"
1374 );
1375
1376 $this->open($this->sboxPath . "civicrm/contact/view?reset=1&cid={$cid}");
1377 $this->waitForPageToLoad($this->getTimeoutMsec());
1378 $this->click("css=li#tab_rel a");
1379
1380 $this->waitForElementPresent("xpath=//div[@id='current-relationships']/div/table/tbody//tr/td[2]/a[text()='{$orgName1}']");
1381 $this->click("xpath=//div[@id='current-relationships']/div/table/tbody//tr/td[2]/a[text()='{$orgName1}']/../../td[9]/span[2][text()='more ']/ul/li[2]/a[text()='Delete']");
1382
1383 // Check confirmation alert.
1384 $this->assertTrue((bool)preg_match("/^Are you sure you want to delete this relationship?/",
1385 $this->getConfirmation()
1386 ));
1387 $this->chooseOkOnNextConfirmation();
1388 $this->waitForPageToLoad($this->getTimeoutMsec());
1389 $this->assertTrue($this->isTextPresent('Selected relationship has been deleted successfully.'),
1390 "Status message didn't show up after saving!"
1391 );
1392 }
1393
1394
1395 function testOnBehalfOfOrganizationWithImage() {
1396 // This is the path where our testing install resides.
1397 // The rest of URL is defined in CiviSeleniumTestCase base class, in
1398 // class attributes.
1399 $this->open($this->sboxPath);
1400
1401 // Logging in. Remember to wait for page to load. In most cases,
1402 // you can rely on 30000 as the value that allows your test to pass, however,
1403 // sometimes your test might fail because of this. In such cases, it's better to pick one element
1404 // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole
1405 // page contents loaded and you can continue your test execution.
1406 $this->webtestLogin();
1407
1408 $this->open($this->sboxPath . "civicrm/profile/edit?reset=1&gid=4");
1409 $firstName = 'John_x_' . substr(sha1(rand()), 0, 7);
1410 $lastName = 'Anderson_c_' . substr(sha1(rand()), 0, 7);
1411
1412 $this->waitForPageToLoad($this->getTimeoutMsec());
1413 $this->waitForElementPresent("_qf_Edit_next");
1414 $this->type("first_name", $firstName);
1415 $this->type("last_name", $lastName);
1416 $this->click("_qf_Edit_next");
1417 $this->waitForPageToLoad($this->getTimeoutMsec());
1418 $this->waitForElementPresent("profilewrap4");
1419
1420 $urlElements = $this->parseURL();
1421 $cid = $urlElements['queryString']['id'];
1422 $this->assertType('numeric', $cid);
1423 // Is status message correct?
1424 $this->assertTextPresent("Thank you. Your information has been saved.", "Save successful status message didn't show up after saving profile to update testUserName!");
1425
1426 $this->open($this->sboxPath . "civicrm/admin/uf/group?reset=1");
1427 $this->waitForPageToLoad($this->getTimeoutMsec());
1428 $this->click("link=Reserved Profiles");
1429
1430 $this->click("xpath=//div[@id='reserved-profiles']/div/div/table/tbody//tr/td[1][text()='On Behalf Of Organization']/../td[5]/span/a[text()='Fields']");
1431 $this->waitForPageToLoad($this->getTimeoutMsec());
1432
1433 $this->click("link=Add Field");
1434 $this->waitForElementPresent('_qf_Field_next-bottom');
1435
1436 $this->select('field_name[0]', 'value=Contact');
1437 $this->select('field_name[1]', 'label=Image Url');
1438 $this->click('field_name[1]');
1439 $this->click('_qf_Field_next-bottom');
1440 $this->waitForPageToLoad($this->getTimeoutMsec());
1441
1442 // We need a payment processor
1443 $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7);
1444 $processorType = 'Dummy';
1445 $pageTitle = substr(sha1(rand()), 0, 7);
1446 $rand = 100;
1447 $hash = substr(sha1(rand()), 0, 7);
1448 $amountSection = TRUE;
1449 $payLater = TRUE;
1450 $onBehalf = TRUE;
1451 $pledges = FALSE;
1452 $recurring = FALSE;
1453 $memberships = FALSE;
1454 $memPriceSetId = NULL;
1455 $friend = TRUE;
1456 $profilePreId = NULL;
1457 $profilePostId = NULL;
1458 $premiums = FALSE;
1459 $widget = FALSE;
1460 $pcp = FALSE;
1461 $honoreeSection = FALSE;
1462 $isAddPaymentProcessor = TRUE;
1463 $isPcpApprovalNeeded = FALSE;
1464 $isSeparatePayment = FALSE;
1465
1466 // create a new online contribution page
1467 // create contribution page with randomized title and default params
1468 $pageId = $this->webtestAddContributionPage($hash,
1469 $rand,
1470 $pageTitle,
1471 array($processorName => $processorType),
1472 $amountSection,
1473 $payLater,
1474 $onBehalf,
1475 $pledges,
1476 $recurring,
1477 $memberships,
1478 $memPriceSetId,
1479 $friend,
1480 $profilePreId,
1481 $profilePostId,
1482 $premiums,
1483 $widget,
1484 $pcp,
1485 $isAddPaymentProcessor,
1486 $isPcpApprovalNeeded,
1487 $isSeparatePayment,
1488 $honoreeSection
1489 );
1490
1491 $this->_testOrganizationWithImageUpload($pageId, $cid, $pageTitle);
1492
1493 $this->open($this->sboxPath . "civicrm/admin/uf/group?reset=1");
1494 $this->waitForPageToLoad($this->getTimeoutMsec());
1495 $this->click("link=Reserved Profiles");
1496
1497 $this->click("xpath=//div[@id='reserved-profiles']/div/div/table/tbody//tr/td[1][text()='On Behalf Of Organization']/../td[5]/span/a[text()='Fields']");
1498 $this->waitForPageToLoad($this->getTimeoutMsec());
1499 $this->click("xpath=//table[@id='option11']/tbody//tr/td/span[text()='Image Url']/../following-sibling::td[8]/span[2]/ul/li[2]/a");
1500 $this->waitForPageToLoad($this->getTimeoutMsec());
1501 $this->click('_qf_Field_next-bottom');
1502 $this->waitForPageToLoad($this->getTimeoutMsec());
1503 $this->assertElementContainsText('crm-notification-container', "Selected Profile Field has been deleted.");
1504 }
1505
1506 function _testOrganizationWithImageUpload($pageId, $cid, $pageTitle) {
1507 //Open Live Contribution Page
1508 $this->open($this->sboxPath . "civicrm/contribute/transact?reset=1&id=" . $pageId);
1509
1510 $firstName = 'Ma' . substr(sha1(rand()), 0, 4);
1511 $lastName = 'An' . substr(sha1(rand()), 0, 7);
1512 $orgName = 'org_11_' . substr(sha1(rand()), 0, 7);
1513 $this->type("email-5", $firstName . "@example.com");
1514
1515 // onbehalforganization info
1516 $this->type("onbehalf_organization_name", $orgName);
1517 $this->type("onbehalf_phone-3-1", 9999999999);
1518 $this->type("onbehalf_email-3", "{$orgName}@example.com");
1519 $this->type("onbehalf_street_address-3", "Test Street Address");
1520 $this->type("onbehalf_city-3", "Test City");
1521 $this->type("onbehalf_postal_code-3", substr(sha1(rand()), 0, 6));
1522 $this->click("onbehalf_country-3");
1523 $this->select("onbehalf_country-3", "label=United States");
1524 $this->click("onbehalf_state_province-3");
1525 $this->select("onbehalf_state_province-3", "label=Alabama");
1526
1527 // check for upload field.
1528 $this->waitForElementPresent("onbehalf_image_URL");
1529
1530 //header("Content-Type: image/png");
1531 $im = imagecreate(110, 20)
1532 or die("Cannot Initialize new GD image stream");
1533 $background_color = imagecolorallocate($im, 0, 0, 0);
1534 $text_color = imagecolorallocate($im, 233, 14, 91);
1535 imagestring($im, 1, 5, 5, "On Behalf-Org Logo", $text_color);
1536 imagepng($im,"/tmp/file.png");
1537
1538 $imagePath = "/tmp/file.png";
1539 $this->webtestAttachFile('onbehalf_image_URL', $imagePath);
1540 unlink($imagePath);
1541
1542 // Credit Card Info
1543 $this->select("credit_card_type", "value=Visa");
1544 $this->type("credit_card_number", "4111111111111111");
1545 $this->type("cvv2", "000");
1546 $this->select("credit_card_exp_date[M]", "value=1");
1547 $this->select("credit_card_exp_date[Y]", "value=2020");
1548
1549 //Billing Info
1550 $this->type("billing_first_name", $firstName . 'billing');
1551 $this->type("billing_last_name", $lastName . 'billing');
1552 $this->type("billing_street_address-5", "0121 Mount Highschool.");
1553 $this->type(" billing_city-5", "Shangai");
1554 $this->select("billing_country_id-5", "value=1228");
1555 $this->select("billing_state_province_id-5", "value=1004");
1556 $this->type("billing_postal_code-5", "94129");
1557 $this->click("_qf_Main_upload-bottom");
1558
1559 $this->waitForPageToLoad($this->getTimeoutMsec());
1560 $this->waitForElementPresent("_qf_Confirm_next-bottom");
1561
1562 $this->click("_qf_Confirm_next-bottom");
1563 $this->waitForPageToLoad($this->getTimeoutMsec());
1564
1565 // Type search name in autocomplete.
1566 $this->click('sort_name_navigation');
1567 $this->type('css=input#sort_name_navigation', $orgName);
1568 $this->typeKeys('css=input#sort_name_navigation', $orgName);
1569
1570 // Wait for result list.
1571 $this->waitForElementPresent("css=div.ac_results-inner li");
1572
1573 // Visit organization page.
1574 $this->click("css=div.ac_results-inner li");
1575 $this->waitForPageToLoad($this->getTimeoutMsec());
1576
1577 //check whether the image is present
1578 $this->assertTrue($this->isElementPresent("xpath=//div[@id='crm-contact-thumbnail']/div/a/img"));
1579 }
1580}
1581