Merge pull request #2744 from pratik-joshi/CRM-13992_temp_fix
[civicrm-core.git] / tests / phpunit / WebTest / Member / InheritedMembershipTest.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
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 require_once 'CiviTest/CiviSeleniumTestCase.php';
28 class WebTest_Member_InheritedMembershipTest extends CiviSeleniumTestCase {
29 protected function setUp() {
30 parent::setUp();
31 }
32
33 function testInheritedMembership() {
34 // Log in using webtestLogin() method
35 $this->webtestLogin();
36
37 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
38
39 $title = substr(sha1(rand()), 0, 7);
40 $this->type('organization_name', "Organization $title");
41 $this->type('email_1_email', "$title@org.com");
42 $this->click('_qf_Contact_upload_view');
43 $this->waitForPageToLoad($this->getTimeoutMsec());
44 $this->waitForText('crm-notification-container', "Organization {$title} has been created.");
45
46 $this->openCiviPage('admin/member/membershipType', 'reset=1&action=browse');
47
48 $this->click('link=Add Membership Type');
49 $this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
50
51 $this->type('name', "Membership Type $title");
52
53 $this->type('member_of_contact', $title);
54 $this->click('member_of_contact');
55 $this->waitForElementPresent("css=div.ac_results-inner li");
56 $this->click("css=div.ac_results-inner li");
57
58 $this->type('minimum_fee', '100');
59 $this->select( 'financial_type_id', 'value=2' );
60 $this->type('duration_interval', 1);
61 $this->select('duration_unit', 'label=year');
62
63 $this->select('period_type', 'label=rolling');
64
65 $this->removeSelection('relationship_type_id', 'label=- select -');
66 $this->addSelection('relationship_type_id', 'label=Employer of');
67
68 $this->type('max_related', '5');
69
70 $this->click('_qf_MembershipType_upload-bottom');
71 $this->waitForElementPresent('link=Add Membership Type');
72 $this->waitForText('crm-notification-container', "Membership Type $title");
73
74 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
75
76 // creating another Orgnization
77 $title1 = substr(sha1(rand()), 0, 7);
78 $this->type('organization_name', "Organization $title1");
79 $this->type('email_1_email', "$title1@org.com");
80 $this->click('_qf_Contact_upload_view');
81 $this->waitForPageToLoad($this->getTimeoutMsec());
82
83 // click through to the membership view screen
84 $this->click('css=li#tab_member a');
85
86 $this->waitForElementPresent('link=Add Membership');
87 $this->click('link=Add Membership');
88
89 $this->waitForElementPresent('_qf_Membership_cancel-bottom');
90
91 // fill in Membership Organization and Type
92 $this->select('membership_type_id[0]', "label=Organization $title");
93 $this->select('membership_type_id[1]', "label=Membership Type $title");
94
95 $sourceText = 'Membership ContactAddTest with Fixed Membership Type';
96 // fill in Source
97 $this->type('source', $sourceText);
98
99 // Clicking save.
100 $this->click('_qf_Membership_upload');
101 $this->waitForPageToLoad($this->getTimeoutMsec());
102
103 // page was loaded
104 $this->waitForTextPresent($sourceText);
105
106 // Is status message correct?
107 $this->waitForText('crm-notification-container', "Membership Type $title");
108
109 // click through to the membership view screen
110 $this->click("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
111 $this->waitForElementPresent('_qf_MembershipView_cancel-bottom');
112
113 $joinDate = date('Y-m-d');
114 $startDate = date('Y-m-d');
115 $endDate = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') - 1, date('Y') + 1));
116 $configVars = new CRM_Core_Config_Variables();
117 foreach (array(
118 'joinDate', 'startDate', 'endDate') as $date) {
119 $$date = CRM_Utils_Date::customFormat($$date, $configVars->dateformatFull);
120 }
121
122 $this->webtestVerifyTabularData(
123 array(
124 'Membership Type' => "Membership Type $title",
125 'Status' => 'New',
126 'Source' => $sourceText,
127 'Member Since' => $joinDate,
128 'Start date' => $startDate,
129 'End date' => $endDate,
130 'Max related' => "5"
131 )
132 );
133
134 // Adding contact
135 // We're using Quick Add block on the main page for this.
136 $firstName = substr(sha1(rand()), 0, 7);
137 $this->webtestAddContact($firstName, 'Anderson', "$firstName@anderson.name");
138
139 // visit relationship tab
140 $this->click('css=li#tab_rel a');
141 $this->waitForElementPresent('css=div.action-link');
142 $this->click("//div[@class='crm-container-snippet']/div/div[1]/div[1]/a/span");
143 $this->waitForPageToLoad($this->getTimeoutMsec());
144 $this->click('relationship_type_id');
145 $this->select('relationship_type_id', 'label=Employee of');
146
147 $this->webtestFillAutocomplete($title1);
148
149 $this->waitForElementPresent('quick-save');
150
151 $description = 'Well here is some description !!!!';
152 $this->type('description', $description);
153
154 //save the relationship
155 $this->click('quick-save');
156 $this->waitForElementPresent('current-relationships');
157 //check the status message
158 $this->waitForText('crm-notification-container', 'New relationship created');
159
160 $this->waitForElementPresent("xpath=//div[@id='current-relationships']//div//table/tbody//tr/td[9]/span/a[text()='View']");
161
162 // click through to the membership view screen
163 $this->click('css=li#tab_member a');
164 $this->waitForElementPresent('css=div#memberships');
165
166 // click through to the membership view screen
167 $this->click("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
168 $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
169
170 $this->webtestVerifyTabularData(
171 array(
172 'Membership Type' => "Membership Type $title",
173 'Status' => 'New',
174 'Source' => $sourceText,
175 'Member Since' => $joinDate,
176 'Start date' => $startDate,
177 'End date' => $endDate,
178 )
179 );
180 $this->click("_qf_MembershipView_cancel-bottom");
181 $this->waitForElementPresent('css=div#memberships');
182
183 //1. change relationship status on form
184 $this->click('css=li#tab_rel a');
185 $this->waitForElementPresent('css=div.action-link');
186
187 $this->click("//li[@id='tab_rel']/a");
188 $this->waitForElementPresent("xpath=//div[@id='current-relationships']//div//table/tbody//tr/td[9]/span/a[text()='Edit']");
189 $this->click("xpath=//div[@id='current-relationships']//div//table/tbody//tr/td[9]/span/a[text()='Edit']");
190 $id = $this->urlArg('cid');
191
192 $this->waitForElementPresent('is_active');
193 //disable relationship
194 if ($this->isChecked('is_active')) {
195 $this->click('is_active');
196 }
197 $this->click('_qf_Relationship_upload');
198 $this->waitForElementPresent('inactive-relationships');
199 //check the status message
200 $this->waitForText('crm-notification-container', 'Relationship record has been updated');
201
202 // click through to the membership view screen
203 $this->click('css=li#tab_member a');
204
205 //verify inherited membership has been removed
206 $this->openCiviPage("contact/view", "reset=1&cid=$id&selectedChild=member", "xpath=//div[@class='crm-container-snippet']/div/div[3]");
207 $this->assertElementContainsText('Memberships', 'No memberships have been recorded for this contact.');
208
209 // visit relationship tab and re-enable the relationship
210 $this->click('css=li#tab_rel a');
211 $this->waitForElementPresent('css=div.action-link');
212 $this->click("//li[@id='tab_rel']/a");
213
214 $this->waitForElementPresent("xpath=//div[@id='inactive-relationships']//div//table/tbody//tr/td[9]/span/a[text()='Edit']");
215 $this->click("xpath=//div[@id='inactive-relationships']//div//table/tbody//tr/td[9]/span/a[text()='Edit']");
216 $this->waitForElementPresent('is_active');
217 if (!$this->isChecked('is_active')) {
218 $this->click('is_active');
219 }
220 $this->click('_qf_Relationship_upload');
221 $this->waitForElementPresent('current-relationships');
222 //check the status message
223 $this->waitForText('crm-notification-container', 'Relationship record has been updated.');
224
225 //check for memberships
226 $this->click('css=li#tab_member a');
227 $this->waitForElementPresent('css=div#memberships');
228
229 //2 . visit relationship tab and disable the relationship (by links)
230 //disable relationship
231 $this->click('css=li#tab_rel a');
232 $this->waitForElementPresent('css=div.action-link');
233 $this->waitForElementPresent("xpath=//div[@id='current-relationships']//div//table/tbody//tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Disable']");
234 $this->click("xpath=//div[@id='current-relationships']//div//table/tbody//tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Disable']");
235
236 $this->assertTrue((bool)preg_match("/^Are you sure you want to disable this relationship?[\s\S]$/",
237 $this->getConfirmation()
238 ));
239 $this->chooseOkOnNextConfirmation();
240 // Because it tends to cause problems, all uses of sleep() must be justified in comments
241 // Sleep should never be used for wait for anything to load from the server
242 // Justification for this instance: FIXME
243 sleep(10);
244
245 //verify inherited membership has been removed
246 $this->openCiviPage("contact/view", "reset=1&cid={$id}&selectedChild=member", "xpath=//div[@class='crm-container-snippet']/div/div[3]");
247 $this->assertElementContainsText('Memberships', 'No memberships have been recorded for this contact.');
248
249 //enable relationship
250 $this->click('css=li#tab_rel a');
251 $this->waitForElementPresent('css=div.action-link');
252
253 $this->waitForElementPresent("xpath=//div[@id='inactive-relationships']//div//table/tbody//tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Enable']");
254 $this->click("xpath=//div[@id='inactive-relationships']//div//table/tbody//tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Enable']");
255
256 $this->assertTrue((bool)preg_match("/^Are you sure you want to re-enable this relationship?[\s\S]$/",
257 $this->getConfirmation()
258 ));
259 $this->chooseOkOnNextConfirmation();
260 $this->waitForPageToLoad($this->getTimeoutMsec());
261
262 //verify membership
263 $this->click('css=li#tab_member a');
264 $this->waitForElementPresent('css=div#memberships');
265 }
266
267 /*
268 * Webtest for CRM-10146
269 *
270 */
271 function testInheritedMembershipActivity() {
272 // Log in using webtestLogin() method
273 $this->webtestLogin();
274
275 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
276
277 $title = substr(sha1(rand()), 0, 7);
278 $this->type('organization_name', "Organization $title");
279 $this->type('email_1_email', "$title@org.com");
280 $this->clickLink('_qf_Contact_upload_view');
281 $this->waitForText('crm-notification-container', "Organization {$title} has been created.");
282
283 $this->openCiviPage('admin/member/membershipType', 'reset=1&action=browse');
284
285 $this->click('link=Add Membership Type');
286 $this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
287
288 $this->type('name', "Membership Type $title");
289
290 $this->type('member_of_contact', $title);
291 $this->click('member_of_contact');
292 $this->waitForElementPresent("css=div.ac_results-inner li");
293 $this->click("css=div.ac_results-inner li");
294
295 $this->type('minimum_fee', '100');
296 $this->select('financial_type_id', 'label=Member Dues');
297 $this->type('duration_interval', 1);
298 $this->select('duration_unit', 'label=year');
299
300 $this->select('period_type', 'label=rolling');
301
302 $this->removeSelection('relationship_type_id', 'label=- select -');
303 $this->addSelection('relationship_type_id', 'label=Employer of');
304
305 $this->type('max_related', '5');
306
307 $this->click('_qf_MembershipType_upload-bottom');
308 $this->waitForElementPresent('link=Add Membership Type');
309 $this->waitForText('crm-notification-container', "Membership Type $title");
310
311 // creating another Orgnization
312 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
313 $org1 = substr(sha1(rand()), 0, 7);
314 $this->type('organization_name', "Organization $org1");
315 $this->type('email_1_email', "$org1@org.com");
316 $this->clickLink('_qf_Contact_upload_view');
317
318 // click through to the membership view screen
319 $this->click('css=li#tab_member a');
320
321 $this->waitForElementPresent('link=Add Membership');
322 $this->click('link=Add Membership');
323
324 $this->waitForElementPresent('_qf_Membership_cancel-bottom');
325
326 // fill in Membership Organization and Type
327 $this->select('membership_type_id[0]', "label=Organization $title");
328 $this->select('membership_type_id[1]', "label=Membership Type $title");
329
330 $sourceText = 'Membership ContactAddTest with Rolling Membership Type';
331 // fill in Source
332 $this->type('source', $sourceText);
333
334 // Clicking save.
335 $this->clickLink('_qf_Membership_upload');
336
337 // page was loaded
338 $this->waitForTextPresent($sourceText);
339
340 // Is status message correct?
341 $this->waitForText('crm-notification-container', "Membership Type $title");
342
343 // Adding contact
344 $this->openCiviPage('contact/add', 'reset=1&ct=Individual', '_qf_Contact_cancel-bottom');
345 $firstName = substr(sha1(rand()), 0, 7);
346 $lastName = 'Anderson';
347 $email = "$firstName@anderson.name";
348 $this->type("first_name", $firstName);
349 $this->type("last_name", $lastName);
350
351 // Set Current Employer
352 $this->type('current_employer', $org1);
353 $this->click('current_employer');
354 $this->waitForElementPresent("css=div.ac_results-inner li");
355 $this->click("css=div.ac_results-inner li");
356 $this->assertContains($org1, $this->getValue('current_employer'), "autocomplete expected $org1 but didn’t find it in " . $this->getValue('current_employer'));
357
358 $this->type("email_1_email", $email);
359 $this->clickLink("_qf_Contact_upload_view-bottom");
360 $cid = $this->urlArg('cid');
361
362 // click through to the membership view screen
363 $this->click('css=li#tab_member a');
364 $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
365
366 // check number of membership for contact
367 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_member']/a/em"));
368
369 $this->clickLink("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
370 $expectedMembershipId = $this->urlArg('id');
371 $this->clickLink("_qf_MembershipView_cancel-bottom");
372
373 // click through to the activity view screen
374 $this->click('css=li#tab_activity a');
375 $this->waitForElementPresent("xpath=//table[@id='contact-activity-selector-activity']/tbody//tr/td[8]/span/a[text()='View']");
376
377 // check number of activity for contact
378 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_activity']/a/em"));
379
380 $this->clickLink("xpath=//table[@id='contact-activity-selector-activity']/tbody//tr/td[8]/span/a[text()='View']");
381 $expectedMembershipActivityId = $this->urlArg('id');
382 $this->clickLink("_qf_MembershipView_cancel-bottom");
383
384 // verify membership id with membership activity id
385 $this->assertEquals($expectedMembershipId, $expectedMembershipActivityId);
386
387 // click through to the relationship view screen
388 $this->click('css=li#tab_rel a');
389 $this->waitForElementPresent("xpath=//div[@id='option11_wrapper']/table/tbody/tr/td[2]/a");
390 $this->assertTrue($this->isElementPresent("xpath=//div[@id='option11_wrapper']/table/tbody/tr/td[2]/a[text()='Organization $org1']"));
391 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_rel']/a/em"));
392
393 // Edit Contact but do not change any field
394 $this->waitForElementPresent("xpath=//ul[@id='actions']/li[2]/a/span");
395 $this->clickLink("xpath=//ul[@id='actions']/li[2]/a/span");
396 $this->waitForElementPresent('_qf_Contact_cancel-bottom');
397 $this->clickLink("_qf_Contact_upload_view-top");
398
399 // click through to the membership view screen after edit
400 $this->click('css=li#tab_member a');
401 $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
402 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_member']/a/em"));
403 $this->clickLink("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
404 $actualMembershipId1 = $this->urlArg('id');
405 $this->clickLink("_qf_MembershipView_cancel-bottom");
406
407 // click through to the activity view screen after edit
408 $this->click('css=li#tab_activity a');
409 $this->waitForElementPresent("xpath=//table[@id='contact-activity-selector-activity']/tbody//tr/td[8]/span/a[text()='View']");
410 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_activity']/a/em"));
411 $this->clickLink("xpath=//table[@id='contact-activity-selector-activity']/tbody//tr/td[8]/span/a[text()='View']");
412 $actualMembershipActivityId1 = $this->urlArg('id');
413 $this->clickLink("_qf_MembershipView_cancel-bottom");
414
415 // verify membership id and membership activity id with previous one
416 $this->assertEquals($expectedMembershipId, $actualMembershipId1);
417 $this->assertEquals($expectedMembershipId, $actualMembershipActivityId1);
418
419 // click through to the relationship view screen after edit
420 $this->click('css=li#tab_rel a');
421 $this->waitForElementPresent("xpath=//div[@id='option11_wrapper']/table/tbody/tr/td[2]/a");
422 $this->assertTrue($this->isElementPresent("xpath=//div[@id='option11_wrapper']/table/tbody/tr/td[2]/a[text()='Organization $org1']"));
423 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_rel']/a/em"));
424
425 // change the current employer of the contact
426 // creating another membership type
427 $this->openCiviPage('admin/member/membershipType', 'reset=1&action=browse');
428
429 $this->click('link=Add Membership Type');
430 $this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
431
432 $this->type('name', "Membership Type Another $title");
433
434 $this->type('member_of_contact', $title);
435 $this->click('member_of_contact');
436 $this->waitForElementPresent("css=div.ac_results-inner li");
437 $this->click("css=div.ac_results-inner li");
438
439 $this->type('minimum_fee', '100');
440 $this->select('financial_type_id', 'label=Member Dues');
441 $this->type('duration_interval', 1);
442 $this->select('duration_unit', 'label=year');
443
444 $this->select('period_type', 'label=rolling');
445
446 $this->removeSelection('relationship_type_id', 'label=- select -');
447 $this->addSelection('relationship_type_id', 'label=Employer of');
448
449 $this->type('max_related', '5');
450
451 $this->click('_qf_MembershipType_upload-bottom');
452 $this->waitForElementPresent('link=Add Membership Type');
453 $this->waitForText('crm-notification-container', "Membership Type Another $title");
454
455 // creating another Orgnization
456 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
457 $org2 = substr(sha1(rand()), 0, 7);
458 $this->type('organization_name', "Organization $org2");
459 $this->type('email_1_email', "$org2@org.com");
460 $this->clickLink('_qf_Contact_upload_view');
461
462 // click through to the membership view screen
463 $this->click('css=li#tab_member a');
464 $this->waitForElementPresent('link=Add Membership');
465 $this->click('link=Add Membership');
466 $this->waitForElementPresent('_qf_Membership_cancel-bottom');
467
468 // fill in Membership Organization and Type
469 $this->select('membership_type_id[0]', "label=Organization $title");
470 $this->select('membership_type_id[1]', "label=Membership Type Another $title");
471
472 $sourceText = 'Membership ContactAddTest with Rolling Membership Type';
473 $this->type('source', $sourceText);
474 $this->clickLink('_qf_Membership_upload');
475 $this->waitForTextPresent($sourceText);
476
477 // Is status message correct?
478 $this->waitForText('crm-notification-container', "Membership Type Another $title");
479
480 // edit contact
481 $this->openCiviPage("contact/add", "reset=1&action=update&cid=$cid", "_qf_Contact_cancel-bottom");
482
483 // change Current Employer
484 $this->type('current_employer', '');
485 $this->click('current_employer');
486 $this->type('current_employer', $org2);
487 $this->click('current_employer');
488 $this->waitForElementPresent("css=div.ac_results-inner li");
489 $this->click("css=div.ac_results-inner li");
490 $this->clickLink("_qf_Contact_upload_view-bottom");
491
492 // click through to the membership view screen
493 $this->click('css=li#tab_member a');
494 $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
495 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_member']/a/em"));
496 $this->clickLink("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
497 $actualMembershipId2 = $this->urlArg('id');
498 $this->clickLink("_qf_MembershipView_cancel-bottom");
499
500 // click through to the activity view screen
501 $this->click('css=li#tab_activity a');
502 $this->waitForElementPresent("xpath=//table[@id='contact-activity-selector-activity']/tbody//tr/td[8]/span/a[text()='View']");
503 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_activity']/a/em"));
504 $this->clickLink("xpath=//table[@id='contact-activity-selector-activity']/tbody//tr/td[8]/span/a[text()='View']");
505 $actualMembershipActivityId2 = $this->urlArg('id');
506 $this->clickLink("_qf_MembershipView_cancel-bottom");
507
508 // verify membership id and membership activity id with previous one
509 $this->assertNotEquals($expectedMembershipId, $actualMembershipId2);
510 $this->assertNotEquals($expectedMembershipId, $actualMembershipActivityId2);
511
512 // click through to the relationship view screen
513 $this->click('css=li#tab_rel a');
514 $this->waitForElementPresent("xpath=//div[@id='option11_wrapper']/table/tbody/tr/td[2]/a");
515 $this->assertTrue($this->isElementPresent("xpath=//div[@id='option11_wrapper']/table/tbody/tr/td[2]/a[text()='Organization $org2']"));
516 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_rel']/a/em"));
517
518 // creating another Orgnization with no membership
519 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
520 $org3 = substr(sha1(rand()), 0, 7);
521 $this->type('organization_name', "Organization $org3");
522 $this->type('email_1_email', "$org3@org.com");
523 $this->clickLink('_qf_Contact_upload_view');
524
525 // edit contact
526 $this->openCiviPage("contact/add", "reset=1&action=update&cid=$cid", "_qf_Contact_cancel-bottom");
527
528 // change Current Employer
529 $this->type('current_employer', '');
530 $this->click('current_employer');
531 $this->type('current_employer', $org3);
532 $this->click('current_employer');
533 $this->waitForElementPresent("css=div.ac_results-inner li");
534 $this->click("css=div.ac_results-inner li");
535 $this->clickLink("_qf_Contact_upload_view-bottom");
536
537 // click through to the membership view screen
538 $this->click('css=li#tab_member a');
539 $this->waitForText("xpath=//div[@id='Memberships']/div/div/div[3]", "No memberships have been recorded for this contact.");
540 $this->assertEquals(0, $this->getText("xpath=//li[@id='tab_member']/a/em"));
541
542 // click through to the activity view screen
543 $this->click('css=li#tab_activity a');
544 $this->waitForText("xpath=//table[@id='contact-activity-selector-activity']/tbody/tr/td", "No matches found.");
545 $this->assertEquals(0, $this->getText("xpath=//li[@id='tab_activity']/a/em"));
546
547 // click through to the relationship view screen
548 $this->click('css=li#tab_rel a');
549 $this->waitForElementPresent("xpath=//div[@id='option11_wrapper']/table/tbody/tr/td[2]/a");
550 $this->assertTrue($this->isElementPresent("xpath=//div[@id='option11_wrapper']/table/tbody/tr/td[2]/a[text()='Organization $org3']"));
551 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_rel']/a/em"));
552 }
553 }
554