Merge pull request #10602 from agileware/CIVICRM-167
[civicrm-core.git] / tests / phpunit / WebTest / Member / InheritedMembershipTest.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2018 |
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
29 /**
30 * Class WebTest_Member_InheritedMembershipTest
31 */
32 class WebTest_Member_InheritedMembershipTest extends CiviSeleniumTestCase {
33 protected function setUp() {
34 parent::setUp();
35 }
36
37 public function testInheritedMembership() {
38 //$this->markTestSkipped('Skipping for now as it works fine locally.');
39 // Log in using webtestLogin() method
40 $this->webtestLogin();
41
42 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
43
44 $title = substr(sha1(rand()), 0, 7);
45 $this->type('organization_name', "Organization $title");
46 $this->type('email_1_email', "$title@org.com");
47 $this->click('_qf_Contact_upload_view');
48 $this->waitForPageToLoad($this->getTimeoutMsec());
49 $this->waitForText('crm-notification-container', "Organization {$title} has been created.");
50
51 $this->openCiviPage('admin/member/membershipType', 'reset=1&action=browse');
52
53 $this->click('link=Add Membership Type');
54 $this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
55
56 $this->type('name', "Membership Type $title");
57
58 $this->select2('member_of_contact_id', $title);
59
60 $this->type('minimum_fee', '100');
61 $this->select('financial_type_id', 'value=2');
62 $this->type('duration_interval', 1);
63 $this->select('duration_unit', 'label=year');
64
65 $this->select('period_type', 'value=rolling');
66
67 $this->select2('relationship_type_id', 'Employer of', TRUE);
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->waitForElementPresent('link=Add Membership');
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 foreach (array(
117 'joinDate',
118 'startDate',
119 'endDate',
120 ) as $date) {
121 $$date = CRM_Utils_Date::customFormat($$date, $this->webtestGetSetting('dateformatFull'));
122 }
123
124 $this->webtestVerifyTabularData(
125 array(
126 'Membership Type' => "Membership Type $title",
127 'Status' => 'New',
128 'Source' => $sourceText,
129 'Member Since' => $joinDate,
130 'Start date' => $startDate,
131 'End date' => $endDate,
132 'Max related' => "5",
133 )
134 );
135
136 // Adding contact
137 // We're using Quick Add block on the main page for this.
138 $firstName = substr(sha1(rand()), 0, 7);
139 $this->webtestAddContact($firstName, 'Anderson', "$firstName@anderson.name");
140
141 // visit relationship tab
142 $this->click('css=li#tab_rel a');
143 $this->waitForElementPresent('css=div.action-link');
144 $this->click("//div[@class='action-link']/a/span");
145 $this->waitForElementPresent('_qf_Relationship_cancel-bottom');
146 $this->click('relationship_type_id');
147 $this->select('relationship_type_id', 'label=Employee of');
148
149 $this->select2('related_contact_id', $title1, TRUE);
150
151 $description = 'Well here is some description !!!!';
152 $this->type('description', $description);
153
154 //save the relationship
155 $this->click('_qf_Relationship_upload-bottom');
156 $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']");
157 //check the status message
158 $this->waitForText('crm-notification-container', 'Relationship created.');
159
160 $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']/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[@class='crm-contact-relationship-current']/div/table/tbody//tr/td[9]/span/a[text()='Edit']");
189 $id = explode('&id=', $this->getAttribute("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody//tr/td[9]/span/a@href"));
190 $id = explode('&', $id[0]);
191 $id = explode('=', $id[2]);
192 $id = $id[1];
193 $this->click("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody//tr/td[9]/span/a[text()='Edit']");
194
195 $this->waitForElementPresent('is_active');
196 //disable relationship
197 if ($this->isChecked('is_active')) {
198 $this->click('is_active');
199 }
200 $this->click('_qf_Relationship_upload');
201 $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']");
202 //check the status message
203 $this->waitForText('crm-notification-container', 'Relationship record has been updated');
204
205 // click through to the membership view screen
206 $this->click('css=li#tab_member a');
207
208 //verify inherited membership has been removed
209 $this->openCiviPage("contact/view", "reset=1&cid=$id&selectedChild=member", "xpath=//div[@class='view-content']/div[3]");
210 $this->waitForTextPresent("No memberships have been recorded for this contact.");
211
212 // visit relationship tab and re-enable the relationship
213 $this->click('css=li#tab_rel a');
214 $this->waitForElementPresent('css=div.action-link');
215 $this->click("//li[@id='tab_rel']/a");
216
217 $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-past']/div/table/tbody//tr/td[9]/span/a[text()='Edit']");
218 $this->click("xpath=//div[@class='crm-contact-relationship-past']/div/table/tbody//tr/td[9]/span/a[text()='Edit']");
219 $this->waitForElementPresent('is_active');
220 if (!$this->isChecked('is_active')) {
221 $this->click('is_active');
222 }
223 $this->click('_qf_Relationship_upload');
224 $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']");
225 //check the status message
226 $this->waitForText('crm-notification-container', 'Relationship record has been updated.');
227
228 //check for memberships
229 $this->click('css=li#tab_member a');
230 $this->waitForElementPresent('css=div#memberships');
231
232 //2 . visit relationship tab and disable the relationship (by links)
233 //disable relationship
234 $this->click('css=li#tab_rel a');
235 $this->waitForElementPresent('css=div.action-link');
236 $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody//tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Disable']");
237 $this->click("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody//tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Disable']");
238 $this->waitForTextPresent('Are you sure you want to disable this relationship?');
239 $this->click("xpath=//div[@class='ui-dialog-buttonset']//button//span[text()='Yes']");
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='view-content']/div[3]");
247 $this->waitForTextPresent("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[@class='crm-contact-relationship-past']/div/table/tbody/tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Enable']");
254 $this->click("xpath=//div[@class='crm-contact-relationship-past']/div/table/tbody/tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Enable']");
255
256 //verify membership
257 $this->click('css=li#tab_member a');
258 $this->waitForTextPresent("No memberships have been recorded for this contact.");
259 }
260
261 /**
262 * Webtest for CRM-10146
263 */
264 public function testInheritedMembershipActivity() {
265 // Log in using webtestLogin() method
266 $this->webtestLogin();
267
268 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
269
270 $title = substr(sha1(rand()), 0, 7);
271 $this->type('organization_name', "Organization $title");
272 $this->type('email_1_email', "$title@org.com");
273 $this->clickLink('_qf_Contact_upload_view');
274 $this->waitForText('crm-notification-container', "Organization {$title} has been created.");
275
276 $this->openCiviPage('admin/member/membershipType', 'reset=1&action=browse');
277
278 $this->click('link=Add Membership Type');
279 $this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
280
281 $this->type('name', "Membership Type $title");
282
283 $this->select2('member_of_contact_id', $title);
284
285 $this->type('minimum_fee', '100');
286 $this->select('financial_type_id', 'label=Member Dues');
287 $this->type('duration_interval', 1);
288 $this->select('duration_unit', 'label=year');
289
290 $this->select('period_type', 'value=rolling');
291
292 $this->select2('relationship_type_id', 'Employer of', TRUE);
293
294 $this->type('max_related', '5');
295
296 $this->click('_qf_MembershipType_upload-bottom');
297 $this->waitForElementPresent('link=Add Membership Type');
298 $this->waitForText('crm-notification-container', "Membership Type $title");
299
300 // creating another Organization
301 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
302 $org1 = substr(sha1(rand()), 0, 7);
303 $this->type('organization_name', "Organization $org1");
304 $this->type('email_1_email', "$org1@org.com");
305 $this->clickLink('_qf_Contact_upload_view');
306
307 // click through to the membership view screen
308 $this->click('css=li#tab_member a');
309
310 $this->waitForElementPresent('link=Add Membership');
311 $this->click('link=Add Membership');
312
313 $this->waitForElementPresent('_qf_Membership_cancel-bottom');
314
315 // fill in Membership Organization and Type
316 $this->select('membership_type_id[0]', "label=Organization $title");
317 $this->select('membership_type_id[1]', "label=Membership Type $title");
318
319 $sourceText = 'Membership ContactAddTest with Rolling Membership Type';
320 // fill in Source
321 $this->type('source', $sourceText);
322
323 // Clicking save.
324 $this->click('_qf_Membership_upload');
325
326 // page was loaded
327 $this->waitForTextPresent($sourceText);
328
329 // Is status message correct?
330 $this->waitForText('crm-notification-container', "Membership Type $title");
331
332 // Adding contact
333 $this->openCiviPage('contact/add', 'reset=1&ct=Individual', '_qf_Contact_cancel-bottom');
334 $firstName = substr(sha1(rand()), 0, 7);
335 $lastName = 'Anderson';
336 $email = "$firstName@anderson.name";
337 $this->type("first_name", $firstName);
338 $this->type("last_name", $lastName);
339
340 // Set Current Employer
341 $this->select2('employer_id', $org1);
342 $this->waitForText('s2id_employer_id', $org1);
343
344 $this->type("email_1_email", $email);
345 $this->clickLink("_qf_Contact_upload_view-bottom");
346 $cid = $this->urlArg('cid');
347
348 // click through to the membership view screen
349 $this->click('css=li#tab_member a');
350 $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
351
352 // check number of membership for contact
353 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_member']/a/em"));
354
355 $url = $this->parseURL($this->getAttribute("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']@href"));
356 $expectedMembershipId = $url['queryString']['id'];
357
358 // click through to the activity view screen
359 $this->click('css=li#tab_activity a');
360 $this->waitForElementPresent("xpath=//table[@class='contact-activity-selector-activity crm-ajax-table dataTable no-footer']/tbody/tr/td[8]/span/a");
361
362 // check number of activity for contact
363 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_activity']/a/em"));
364
365 $url = $this->parseURL($this->getAttribute("xpath=//table[@class='contact-activity-selector-activity crm-ajax-table dataTable no-footer']/tbody/tr/td[8]/span/a@href"));
366 $expectedMembershipActivityId = $url['queryString']['id'];
367
368 // verify membership id with membership activity id
369 $this->assertEquals($expectedMembershipId, $expectedMembershipActivityId);
370
371 // click through to the relationship view screen
372 $this->click('css=li#tab_rel a');
373 $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[2]/a");
374 $this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[2]/a[text()='Organization $org1']"));
375 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_rel']/a/em"));
376
377 // Edit Contact but do not change any field
378 $this->waitForElementPresent("xpath=//ul[@id='actions']/li[2]/a/span");
379 $this->clickLink("xpath=//ul[@id='actions']/li[2]/a/span");
380 $this->waitForElementPresent('_qf_Contact_cancel-bottom');
381 $this->clickLink("_qf_Contact_upload_view-top");
382
383 // click through to the membership view screen after edit
384 $this->click('css=li#tab_member a');
385 $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
386 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_member']/a/em"));
387
388 $url = $this->parseURL($this->getAttribute("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']@href"));
389 $actualMembershipId1 = $url['queryString']['id'];
390
391 // click through to the activity view screen after edit
392 $this->click('css=li#tab_activity a');
393 $this->waitForElementPresent("xpath=//table[@class='contact-activity-selector-activity crm-ajax-table dataTable no-footer']/tbody/tr/td[8]/span/a");
394 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_activity']/a/em"));
395 $url = $this->parseURL($this->getAttribute("xpath=//table[@class='contact-activity-selector-activity crm-ajax-table dataTable no-footer']/tbody/tr/td[8]/span/a@href"));
396 $actualMembershipActivityId1 = $url['queryString']['id'];
397
398 // verify membership id and membership activity id with previous one
399 // FIXME: These 2 lines are currently failing because the inherited membership and signup activity or being recreated when contact is edited/saved. dgg
400 $this->assertEquals($expectedMembershipId, $actualMembershipId1);
401 $this->assertEquals($expectedMembershipActivityId, $actualMembershipActivityId1);
402
403 // click through to the relationship view screen after edit
404 $this->click('css=li#tab_rel a');
405 $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[2]/a");
406 $this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[2]/a[text()='Organization $org1']"));
407 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_rel']/a/em"));
408
409 // change the current employer of the contact
410 // creating another membership type
411 $this->openCiviPage('admin/member/membershipType', 'reset=1&action=browse');
412
413 $this->click('link=Add Membership Type');
414 $this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
415
416 $this->type('name', "Membership Type Another $title");
417
418 $this->select2('member_of_contact_id', $title);
419
420 $this->type('minimum_fee', '100');
421 $this->select('financial_type_id', 'label=Member Dues');
422 $this->type('duration_interval', 1);
423 $this->select('duration_unit', 'label=year');
424
425 $this->select('period_type', 'value=rolling');
426
427 $this->select2('relationship_type_id', 'Employer of', TRUE);
428 $this->type('max_related', '5');
429
430 $this->click('_qf_MembershipType_upload-bottom');
431 $this->waitForElementPresent('link=Add Membership Type');
432 $this->waitForText('crm-notification-container', "Membership Type Another $title");
433
434 // creating another Orgnization
435 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
436 $org2 = substr(sha1(rand()), 0, 7);
437 $this->type('organization_name', "Organization $org2");
438 $this->type('email_1_email', "$org2@org.com");
439 $this->clickLink('_qf_Contact_upload_view');
440
441 // click through to the membership view screen
442 $this->click('css=li#tab_member a');
443 $this->waitForElementPresent('link=Add Membership');
444 $this->click('link=Add Membership');
445 $this->waitForElementPresent('_qf_Membership_cancel-bottom');
446
447 // fill in Membership Organization and Type
448 $this->select('membership_type_id[0]', "label=Organization $title");
449 $this->select('membership_type_id[1]', "label=Membership Type Another $title");
450
451 $sourceText = 'Membership ContactAddTest with Rolling Membership Type';
452 $this->type('source', $sourceText);
453 $this->clickLink('_qf_Membership_upload', 'link=Add Membership', FALSE);
454 $this->waitForTextPresent($sourceText);
455
456 // Is status message correct?
457 $this->waitForText('crm-notification-container', "Membership Type Another $title");
458
459 // edit contact
460 $this->openCiviPage("contact/add", "reset=1&action=update&cid=$cid", "_qf_Contact_cancel-bottom");
461
462 // change Current Employer
463 $this->select2('employer_id', $org2);
464 $this->clickLink("_qf_Contact_upload_view-bottom");
465
466 // click through to the membership view screen
467 $this->click('css=li#tab_member a');
468 $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
469 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_member']/a/em"));
470 $url = $this->parseURL($this->getAttribute("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']@href"));
471 $actualMembershipId2 = $url['queryString']['id'];
472
473 // click through to the activity view screen
474 $this->click('css=li#tab_activity a');
475 $this->waitForElementPresent("xpath=//table[@class='contact-activity-selector-activity crm-ajax-table dataTable no-footer']/tbody//tr/td[8]/span/a[text()='View']");
476 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_activity']/a/em"));
477 $url = $this->parseURL($this->getAttribute("xpath=//table[@class='contact-activity-selector-activity crm-ajax-table dataTable no-footer']/tbody//tr/td[8]/span/a[text()='View']@href"));
478 $actualMembershipActivityId2 = $url['queryString']['id'];
479
480 // verify membership id and membership activity id with previous one
481 $this->assertNotEquals($expectedMembershipId, $actualMembershipId2);
482 $this->assertNotEquals($expectedMembershipId, $actualMembershipActivityId2);
483
484 // click through to the relationship view screen
485 $this->click('css=li#tab_rel a');
486 $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[2]/a");
487 $this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[2]/a[text()='Organization $org2']"));
488 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_rel']/a/em"));
489
490 // creating another Orgnization with no membership
491 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
492 $org3 = substr(sha1(rand()), 0, 7);
493 $this->type('organization_name', "Organization $org3");
494 $this->type('email_1_email', "$org3@org.com");
495 $this->clickLink('_qf_Contact_upload_view');
496
497 // edit contact
498 $this->openCiviPage("contact/add", "reset=1&action=update&cid=$cid", "_qf_Contact_cancel-bottom");
499
500 // change Current Employer
501 $this->select2('employer_id', $org3);
502 $this->clickLink("_qf_Contact_upload_view-bottom");
503
504 // click through to the membership view screen
505 $this->click('css=li#tab_member a');
506
507 $this->waitForAjaxContent();
508 $this->waitForTextPresent("No memberships have been recorded for this contact.");
509 $this->assertEquals(0, $this->getText("xpath=//li[@id='tab_member']/a/em"));
510
511 // click through to the activity view screen
512 $this->click('css=li#tab_activity a');
513 $this->waitForText("xpath=//table[@class='contact-activity-selector-activity crm-ajax-table dataTable no-footer']/tbody/tr/td", "None found.");
514 $this->assertEquals(0, $this->getText("xpath=//li[@id='tab_activity']/a/em"));
515
516 // click through to the relationship view screen
517 $this->click('css=li#tab_rel a');
518 $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[2]/a");
519 $this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[2]/a[text()='Organization $org3']"));
520 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_rel']/a/em"));
521 }
522
523 }