Merge pull request #4893 from colemanw/INFRA-132
[civicrm-core.git] / tests / phpunit / WebTest / Member / InheritedMembershipTest.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
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
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 // Log in using webtestLogin() method
39 $this->webtestLogin();
40
41 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
42
43 $title = substr(sha1(rand()), 0, 7);
44 $this->type('organization_name', "Organization $title");
45 $this->type('email_1_email', "$title@org.com");
46 $this->click('_qf_Contact_upload_view');
47 $this->waitForPageToLoad($this->getTimeoutMsec());
48 $this->waitForText('crm-notification-container', "Organization {$title} has been created.");
49
50 $this->openCiviPage('admin/member/membershipType', 'reset=1&action=browse');
51
52 $this->click('link=Add Membership Type');
53 $this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
54
55 $this->type('name', "Membership Type $title");
56
57 $this->select2('member_of_contact_id', $title);
58
59 $this->type('minimum_fee', '100');
60 $this->select('financial_type_id', 'value=2');
61 $this->type('duration_interval', 1);
62 $this->select('duration_unit', 'label=year');
63
64 $this->select('period_type', 'value=rolling');
65
66 $this->removeSelection('relationship_type_id', 'label=- select -');
67 $this->addSelection('relationship_type_id', 'label=Employer of');
68
69 $this->type('max_related', '5');
70
71 $this->click('_qf_MembershipType_upload-bottom');
72 $this->waitForElementPresent('link=Add Membership Type');
73 $this->waitForText('crm-notification-container', "Membership Type $title");
74
75 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
76
77 // creating another Orgnization
78 $title1 = substr(sha1(rand()), 0, 7);
79 $this->type('organization_name', "Organization $title1");
80 $this->type('email_1_email', "$title1@org.com");
81 $this->click('_qf_Contact_upload_view');
82 $this->waitForPageToLoad($this->getTimeoutMsec());
83
84 // click through to the membership view screen
85 $this->click('css=li#tab_member a');
86
87 $this->waitForElementPresent('link=Add Membership');
88 $this->click('link=Add Membership');
89
90 $this->waitForElementPresent('_qf_Membership_cancel-bottom');
91
92 // fill in Membership Organization and Type
93 $this->select('membership_type_id[0]', "label=Organization $title");
94 $this->select('membership_type_id[1]', "label=Membership Type $title");
95
96 $sourceText = 'Membership ContactAddTest with Fixed Membership Type';
97 // fill in Source
98 $this->type('source', $sourceText);
99
100 // Clicking save.
101 $this->click('_qf_Membership_upload');
102 $this->waitForElementPresent('link=Add Membership');
103
104 // page was loaded
105 $this->waitForTextPresent($sourceText);
106
107 // Is status message correct?
108 $this->waitForText('crm-notification-container', "Membership Type $title");
109
110 // click through to the membership view screen
111 $this->click("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
112 $this->waitForElementPresent('_qf_MembershipView_cancel-bottom');
113
114 $joinDate = date('Y-m-d');
115 $startDate = date('Y-m-d');
116 $endDate = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') - 1, date('Y') + 1));
117 $configVars = new CRM_Core_Config_Variables();
118 foreach (array(
119 'joinDate', 'startDate', 'endDate') as $date) {
120 $$date = CRM_Utils_Date::customFormat($$date, $configVars->dateformatFull);
121 }
122
123 $this->webtestVerifyTabularData(
124 array(
125 'Membership Type' => "Membership Type $title",
126 'Status' => 'New',
127 'Source' => $sourceText,
128 'Member Since' => $joinDate,
129 'Start date' => $startDate,
130 'End date' => $endDate,
131 'Max related' => "5",
132 )
133 );
134
135 // Adding contact
136 // We're using Quick Add block on the main page for this.
137 $firstName = substr(sha1(rand()), 0, 7);
138 $this->webtestAddContact($firstName, 'Anderson', "$firstName@anderson.name");
139
140 // visit relationship tab
141 $this->click('css=li#tab_rel a');
142 $this->waitForElementPresent('css=div.action-link');
143 $this->click("//div[@class='action-link']/a/span");
144 $this->waitForElementPresent('_qf_Relationship_cancel-bottom');
145 $this->click('relationship_type_id');
146 $this->select('relationship_type_id', 'label=Employee of');
147
148 $this->select2('related_contact_id', $title1, TRUE);
149
150 $description = 'Well here is some description !!!!';
151 $this->type('description', $description);
152
153 //save the relationship
154 $this->click('_qf_Relationship_upload-bottom');
155 $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']");
156 //check the status message
157 $this->waitForText('crm-notification-container', 'Relationship created.');
158
159 $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody//tr/td[9]/span/a[text()='View']");
160
161 // click through to the membership view screen
162 $this->click('css=li#tab_member a');
163 $this->waitForElementPresent('css=div#memberships');
164
165 // click through to the membership view screen
166 $this->click("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
167 $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
168
169 $this->webtestVerifyTabularData(
170 array(
171 'Membership Type' => "Membership Type $title",
172 'Status' => 'New',
173 'Source' => $sourceText,
174 'Member Since' => $joinDate,
175 'Start date' => $startDate,
176 'End date' => $endDate,
177 )
178 );
179 $this->click("_qf_MembershipView_cancel-bottom");
180 $this->waitForElementPresent('css=div#memberships');
181
182 //1. change relationship status on form
183 $this->click('css=li#tab_rel a');
184 $this->waitForElementPresent('css=div.action-link');
185
186 $this->click("//li[@id='tab_rel']/a");
187 $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody//tr/td[9]/span/a[text()='Edit']");
188 $id = explode('&id=', $this->getAttribute("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody//tr/td[9]/span/a@href"));
189 $id = explode('&', $id[0]);
190 $id = explode('=', $id[2]);
191 $id = $id[1];
192 $this->click("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody//tr/td[9]/span/a[text()='Edit']");
193
194 $this->waitForElementPresent('is_active');
195 //disable relationship
196 if ($this->isChecked('is_active')) {
197 $this->click('is_active');
198 }
199 $this->click('_qf_Relationship_upload');
200 $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']");
201 //check the status message
202 $this->waitForText('crm-notification-container', 'Relationship record has been updated');
203
204 // click through to the membership view screen
205 $this->click('css=li#tab_member a');
206
207 //verify inherited membership has been removed
208 $this->openCiviPage("contact/view", "reset=1&cid=$id&selectedChild=member", "xpath=//div[@class='view-content']/div[3]");
209 $this->assertElementContainsText("xpath=//div[@class='view-content']", 'No memberships have been recorded for this contact.');
210
211 // visit relationship tab and re-enable the relationship
212 $this->click('css=li#tab_rel a');
213 $this->waitForElementPresent('css=div.action-link');
214 $this->click("//li[@id='tab_rel']/a");
215
216 $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-past']/div/table/tbody//tr/td[9]/span/a[text()='Edit']");
217 $this->click("xpath=//div[@class='crm-contact-relationship-past']/div/table/tbody//tr/td[9]/span/a[text()='Edit']");
218 $this->waitForElementPresent('is_active');
219 if (!$this->isChecked('is_active')) {
220 $this->click('is_active');
221 }
222 $this->click('_qf_Relationship_upload');
223 $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']");
224 //check the status message
225 $this->waitForText('crm-notification-container', 'Relationship record has been updated.');
226
227 //check for memberships
228 $this->click('css=li#tab_member a');
229 $this->waitForElementPresent('css=div#memberships');
230
231 //2 . visit relationship tab and disable the relationship (by links)
232 //disable relationship
233 $this->click('css=li#tab_rel a');
234 $this->waitForElementPresent('css=div.action-link');
235 $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']");
236 $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']");
237 $this->waitForText("xpath=//div[@class='crm-confirm-dialog ui-dialog-content ui-widget-content modal-dialog']", 'Are you sure you want to disable this relationship?');
238 $this->click("xpath=//div[@class='ui-dialog-buttonset']//button//span[text()='Yes']");
239 // Because it tends to cause problems, all uses of sleep() must be justified in comments
240 // Sleep should never be used for wait for anything to load from the server
241 // Justification for this instance: FIXME
242 sleep(10);
243
244 //verify inherited membership has been removed
245 $this->openCiviPage("contact/view", "reset=1&cid={$id}&selectedChild=member", "xpath=//div[@class='view-content']/div[3]");
246 $this->assertElementContainsText("xpath=//div[@class='view-content']/div[3]", 'No memberships have been recorded for this contact.');
247
248 //enable relationship
249 $this->click('css=li#tab_rel a');
250 $this->waitForElementPresent('css=div.action-link');
251
252 $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody//tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Enable']");
253 $this->click("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody//tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Enable']");
254
255 //verify membership
256 $this->click('css=li#tab_member a');
257 $this->waitForElementPresent('css=div#memberships');
258 }
259
260 /*
261 * Webtest for CRM-10146
262 */
263 public function testInheritedMembershipActivity() {
264 // Log in using webtestLogin() method
265 $this->webtestLogin();
266
267 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
268
269 $title = substr(sha1(rand()), 0, 7);
270 $this->type('organization_name', "Organization $title");
271 $this->type('email_1_email', "$title@org.com");
272 $this->clickLink('_qf_Contact_upload_view');
273 $this->waitForText('crm-notification-container', "Organization {$title} has been created.");
274
275 $this->openCiviPage('admin/member/membershipType', 'reset=1&action=browse');
276
277 $this->click('link=Add Membership Type');
278 $this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
279
280 $this->type('name', "Membership Type $title");
281
282 $this->select2('member_of_contact_id', $title);
283
284 $this->type('minimum_fee', '100');
285 $this->select('financial_type_id', 'label=Member Dues');
286 $this->type('duration_interval', 1);
287 $this->select('duration_unit', 'label=year');
288
289 $this->select('period_type', 'value=rolling');
290
291 $this->removeSelection('relationship_type_id', 'label=- select -');
292 $this->addSelection('relationship_type_id', 'label=Employer of');
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 dataTable no-footer']/tbody//tr/td[8]/span/a[text()='View']");
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 dataTable no-footer']/tbody//tr/td[8]/span/a[text()='View']@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 dataTable no-footer']/tbody//tr/td[8]/span/a[text()='View']");
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 dataTable no-footer']/tbody//tr/td[8]/span/a[text()='View']@href"));
396 $actualMembershipActivityId1 = $url['queryString']['id'];
397
398 // verify membership id and membership activity id with previous one
399 $this->assertEquals($expectedMembershipId, $actualMembershipId1);
400 $this->assertEquals($expectedMembershipId, $actualMembershipActivityId1);
401
402 // click through to the relationship view screen after edit
403 $this->click('css=li#tab_rel a');
404 $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[2]/a");
405 $this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[2]/a[text()='Organization $org1']"));
406 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_rel']/a/em"));
407
408 // change the current employer of the contact
409 // creating another membership type
410 $this->openCiviPage('admin/member/membershipType', 'reset=1&action=browse');
411
412 $this->click('link=Add Membership Type');
413 $this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
414
415 $this->type('name', "Membership Type Another $title");
416
417 $this->select2('member_of_contact_id', $title);
418
419 $this->type('minimum_fee', '100');
420 $this->select('financial_type_id', 'label=Member Dues');
421 $this->type('duration_interval', 1);
422 $this->select('duration_unit', 'label=year');
423
424 $this->select('period_type', 'value=rolling');
425
426 $this->removeSelection('relationship_type_id', 'label=- select -');
427 $this->addSelection('relationship_type_id', 'label=Employer of');
428
429 $this->type('max_related', '5');
430
431 $this->click('_qf_MembershipType_upload-bottom');
432 $this->waitForElementPresent('link=Add Membership Type');
433 $this->waitForText('crm-notification-container', "Membership Type Another $title");
434
435 // creating another Orgnization
436 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
437 $org2 = substr(sha1(rand()), 0, 7);
438 $this->type('organization_name', "Organization $org2");
439 $this->type('email_1_email', "$org2@org.com");
440 $this->clickLink('_qf_Contact_upload_view');
441
442 // click through to the membership view screen
443 $this->click('css=li#tab_member a');
444 $this->waitForElementPresent('link=Add Membership');
445 $this->click('link=Add Membership');
446 $this->waitForElementPresent('_qf_Membership_cancel-bottom');
447
448 // fill in Membership Organization and Type
449 $this->select('membership_type_id[0]', "label=Organization $title");
450 $this->select('membership_type_id[1]', "label=Membership Type Another $title");
451
452 $sourceText = 'Membership ContactAddTest with Rolling Membership Type';
453 $this->type('source', $sourceText);
454 $this->clickLink('_qf_Membership_upload', 'link=Add Membership', FALSE);
455 $this->waitForTextPresent($sourceText);
456
457 // Is status message correct?
458 $this->waitForText('crm-notification-container', "Membership Type Another $title");
459
460 // edit contact
461 $this->openCiviPage("contact/add", "reset=1&action=update&cid=$cid", "_qf_Contact_cancel-bottom");
462
463 // change Current Employer
464 $this->select2('employer_id', $org2);
465 $this->clickLink("_qf_Contact_upload_view-bottom");
466
467 // click through to the membership view screen
468 $this->click('css=li#tab_member a');
469 $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
470 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_member']/a/em"));
471 $url = $this->parseURL($this->getAttribute("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']@href"));
472 $actualMembershipId2 = $url['queryString']['id'];
473
474 // click through to the activity view screen
475 $this->click('css=li#tab_activity a');
476 $this->waitForElementPresent("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody//tr/td[8]/span/a[text()='View']");
477 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_activity']/a/em"));
478 $url = $this->parseURL($this->getAttribute("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody//tr/td[8]/span/a[text()='View']@href"));
479 $actualMembershipActivityId2 = $url['queryString']['id'];
480
481 // verify membership id and membership activity id with previous one
482 $this->assertNotEquals($expectedMembershipId, $actualMembershipId2);
483 $this->assertNotEquals($expectedMembershipId, $actualMembershipActivityId2);
484
485 // click through to the relationship view screen
486 $this->click('css=li#tab_rel a');
487 $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[2]/a");
488 $this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[2]/a[text()='Organization $org2']"));
489 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_rel']/a/em"));
490
491 // creating another Orgnization with no membership
492 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
493 $org3 = substr(sha1(rand()), 0, 7);
494 $this->type('organization_name', "Organization $org3");
495 $this->type('email_1_email', "$org3@org.com");
496 $this->clickLink('_qf_Contact_upload_view');
497
498 // edit contact
499 $this->openCiviPage("contact/add", "reset=1&action=update&cid=$cid", "_qf_Contact_cancel-bottom");
500
501 // change Current Employer
502 $this->select2('employer_id', $org3);
503 $this->clickLink("_qf_Contact_upload_view-bottom");
504
505 // click through to the membership view screen
506 $this->click('css=li#tab_member a');
507
508 $this->waitForText("xpath=//div[@class='messages status no-popup']", "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 dataTable no-footer']/tbody/tr/td", "No matches 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 }