Merge branch 'phpunit-ob-fix' of https://github.com/giant-rabbit/civicrm-core into...
[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
29 /**
30 * Class WebTest_Member_InheritedMembershipTest
31 */
32 class WebTest_Member_InheritedMembershipTest extends CiviSeleniumTestCase {
33 protected function setUp() {
34 parent::setUp();
35 }
36
37 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
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->assertElementContainsText("xpath=//div[@class='view-content']", '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->waitForText("xpath=//div[@class='crm-confirm-dialog ui-dialog-content ui-widget-content modal-dialog']", '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->assertElementContainsText("xpath=//div[@class='view-content']/div[3]", '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-current']/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-current']/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->waitForElementPresent('css=div#memberships');
259 }
260
261 /*
262 * Webtest for CRM-10146
263 *
264 */
265 function testInheritedMembershipActivity() {
266 // Log in using webtestLogin() method
267 $this->webtestLogin();
268
269 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
270
271 $title = substr(sha1(rand()), 0, 7);
272 $this->type('organization_name', "Organization $title");
273 $this->type('email_1_email', "$title@org.com");
274 $this->clickLink('_qf_Contact_upload_view');
275 $this->waitForText('crm-notification-container', "Organization {$title} has been created.");
276
277 $this->openCiviPage('admin/member/membershipType', 'reset=1&action=browse');
278
279 $this->click('link=Add Membership Type');
280 $this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
281
282 $this->type('name', "Membership Type $title");
283
284 $this->select2('member_of_contact_id', $title);
285
286 $this->type('minimum_fee', '100');
287 $this->select('financial_type_id', 'label=Member Dues');
288 $this->type('duration_interval', 1);
289 $this->select('duration_unit', 'label=year');
290
291 $this->select('period_type', 'value=rolling');
292
293 $this->removeSelection('relationship_type_id', 'label=- select -');
294 $this->addSelection('relationship_type_id', 'label=Employer of');
295
296 $this->type('max_related', '5');
297
298 $this->click('_qf_MembershipType_upload-bottom');
299 $this->waitForElementPresent('link=Add Membership Type');
300 $this->waitForText('crm-notification-container', "Membership Type $title");
301
302 // creating another Organization
303 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
304 $org1 = substr(sha1(rand()), 0, 7);
305 $this->type('organization_name', "Organization $org1");
306 $this->type('email_1_email', "$org1@org.com");
307 $this->clickLink('_qf_Contact_upload_view');
308
309 // click through to the membership view screen
310 $this->click('css=li#tab_member a');
311
312 $this->waitForElementPresent('link=Add Membership');
313 $this->click('link=Add Membership');
314
315 $this->waitForElementPresent('_qf_Membership_cancel-bottom');
316
317 // fill in Membership Organization and Type
318 $this->select('membership_type_id[0]', "label=Organization $title");
319 $this->select('membership_type_id[1]', "label=Membership Type $title");
320
321 $sourceText = 'Membership ContactAddTest with Rolling Membership Type';
322 // fill in Source
323 $this->type('source', $sourceText);
324
325 // Clicking save.
326 $this->click('_qf_Membership_upload');
327
328 // page was loaded
329 $this->waitForTextPresent($sourceText);
330
331 // Is status message correct?
332 $this->waitForText('crm-notification-container', "Membership Type $title");
333
334 // Adding contact
335 $this->openCiviPage('contact/add', 'reset=1&ct=Individual', '_qf_Contact_cancel-bottom');
336 $firstName = substr(sha1(rand()), 0, 7);
337 $lastName = 'Anderson';
338 $email = "$firstName@anderson.name";
339 $this->type("first_name", $firstName);
340 $this->type("last_name", $lastName);
341
342 // Set Current Employer
343 $this->select2('employer_id', $org1);
344 $this->waitForText('s2id_employer_id', $org1);
345
346 $this->type("email_1_email", $email);
347 $this->clickLink("_qf_Contact_upload_view-bottom");
348 $cid = $this->urlArg('cid');
349
350 // click through to the membership view screen
351 $this->click('css=li#tab_member a');
352 $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
353
354 // check number of membership for contact
355 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_member']/a/em"));
356
357 $url = $this->parseURL($this->getAttribute("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']@href"));
358 $expectedMembershipId = $url['queryString']['id'];
359
360 // click through to the activity view screen
361 $this->click('css=li#tab_activity a');
362 $this->waitForElementPresent("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody//tr/td[8]/span/a[text()='View']");
363
364 // check number of activity for contact
365 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_activity']/a/em"));
366
367 $url = $this->parseURL($this->getAttribute("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody//tr/td[8]/span/a[text()='View']@href"));
368 $expectedMembershipActivityId = $url['queryString']['id'];
369
370 // verify membership id with membership activity id
371 $this->assertEquals($expectedMembershipId, $expectedMembershipActivityId);
372
373 // click through to the relationship view screen
374 $this->click('css=li#tab_rel a');
375 $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[2]/a");
376 $this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[2]/a[text()='Organization $org1']"));
377 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_rel']/a/em"));
378
379 // Edit Contact but do not change any field
380 $this->waitForElementPresent("xpath=//ul[@id='actions']/li[2]/a/span");
381 $this->clickLink("xpath=//ul[@id='actions']/li[2]/a/span");
382 $this->waitForElementPresent('_qf_Contact_cancel-bottom');
383 $this->clickLink("_qf_Contact_upload_view-top");
384
385 // click through to the membership view screen after edit
386 $this->click('css=li#tab_member a');
387 $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
388 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_member']/a/em"));
389
390 $url = $this->parseURL($this->getAttribute("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']@href"));
391 $actualMembershipId1 = $url['queryString']['id'];
392
393 // click through to the activity view screen after edit
394 $this->click('css=li#tab_activity a');
395 $this->waitForElementPresent("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody//tr/td[8]/span/a[text()='View']");
396 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_activity']/a/em"));
397 $url = $this->parseURL($this->getAttribute("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody//tr/td[8]/span/a[text()='View']@href"));
398 $actualMembershipActivityId1 = $url['queryString']['id'];
399
400 // verify membership id and membership activity id with previous one
401 $this->assertEquals($expectedMembershipId, $actualMembershipId1);
402 $this->assertEquals($expectedMembershipId, $actualMembershipActivityId1);
403
404 // click through to the relationship view screen after edit
405 $this->click('css=li#tab_rel a');
406 $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[2]/a");
407 $this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[2]/a[text()='Organization $org1']"));
408 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_rel']/a/em"));
409
410 // change the current employer of the contact
411 // creating another membership type
412 $this->openCiviPage('admin/member/membershipType', 'reset=1&action=browse');
413
414 $this->click('link=Add Membership Type');
415 $this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
416
417 $this->type('name', "Membership Type Another $title");
418
419 $this->select2('member_of_contact_id', $title);
420
421 $this->type('minimum_fee', '100');
422 $this->select('financial_type_id', 'label=Member Dues');
423 $this->type('duration_interval', 1);
424 $this->select('duration_unit', 'label=year');
425
426 $this->select('period_type', 'value=rolling');
427
428 $this->removeSelection('relationship_type_id', 'label=- select -');
429 $this->addSelection('relationship_type_id', 'label=Employer of');
430
431 $this->type('max_related', '5');
432
433 $this->click('_qf_MembershipType_upload-bottom');
434 $this->waitForElementPresent('link=Add Membership Type');
435 $this->waitForText('crm-notification-container', "Membership Type Another $title");
436
437 // creating another Orgnization
438 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
439 $org2 = substr(sha1(rand()), 0, 7);
440 $this->type('organization_name', "Organization $org2");
441 $this->type('email_1_email', "$org2@org.com");
442 $this->clickLink('_qf_Contact_upload_view');
443
444 // click through to the membership view screen
445 $this->click('css=li#tab_member a');
446 $this->waitForElementPresent('link=Add Membership');
447 $this->click('link=Add Membership');
448 $this->waitForElementPresent('_qf_Membership_cancel-bottom');
449
450 // fill in Membership Organization and Type
451 $this->select('membership_type_id[0]', "label=Organization $title");
452 $this->select('membership_type_id[1]', "label=Membership Type Another $title");
453
454 $sourceText = 'Membership ContactAddTest with Rolling Membership Type';
455 $this->type('source', $sourceText);
456 $this->clickLink('_qf_Membership_upload', 'link=Add Membership', FALSE);
457 $this->waitForTextPresent($sourceText);
458
459 // Is status message correct?
460 $this->waitForText('crm-notification-container', "Membership Type Another $title");
461
462 // edit contact
463 $this->openCiviPage("contact/add", "reset=1&action=update&cid=$cid", "_qf_Contact_cancel-bottom");
464
465 // change Current Employer
466 $this->select2('employer_id', $org2);
467 $this->clickLink("_qf_Contact_upload_view-bottom");
468
469 // click through to the membership view screen
470 $this->click('css=li#tab_member a');
471 $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
472 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_member']/a/em"));
473 $url = $this->parseURL($this->getAttribute("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']@href"));
474 $actualMembershipId2 = $url['queryString']['id'];
475
476 // click through to the activity view screen
477 $this->click('css=li#tab_activity a');
478 $this->waitForElementPresent("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody//tr/td[8]/span/a[text()='View']");
479 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_activity']/a/em"));
480 $url = $this->parseURL($this->getAttribute("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody//tr/td[8]/span/a[text()='View']@href"));
481 $actualMembershipActivityId2 = $url['queryString']['id'];
482
483 // verify membership id and membership activity id with previous one
484 $this->assertNotEquals($expectedMembershipId, $actualMembershipId2);
485 $this->assertNotEquals($expectedMembershipId, $actualMembershipActivityId2);
486
487 // click through to the relationship view screen
488 $this->click('css=li#tab_rel a');
489 $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[2]/a");
490 $this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[2]/a[text()='Organization $org2']"));
491 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_rel']/a/em"));
492
493 // creating another Orgnization with no membership
494 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
495 $org3 = substr(sha1(rand()), 0, 7);
496 $this->type('organization_name', "Organization $org3");
497 $this->type('email_1_email', "$org3@org.com");
498 $this->clickLink('_qf_Contact_upload_view');
499
500 // edit contact
501 $this->openCiviPage("contact/add", "reset=1&action=update&cid=$cid", "_qf_Contact_cancel-bottom");
502
503 // change Current Employer
504 $this->select2('employer_id', $org3);
505 $this->clickLink("_qf_Contact_upload_view-bottom");
506
507 // click through to the membership view screen
508 $this->click('css=li#tab_member a');
509
510 $this->waitForText("xpath=//div[@class='messages status no-popup']", "No memberships have been recorded for this contact.");
511 $this->assertEquals(0, $this->getText("xpath=//li[@id='tab_member']/a/em"));
512
513 // click through to the activity view screen
514 $this->click('css=li#tab_activity a');
515 $this->waitForText("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody/tr/td", "No matches found.");
516 $this->assertEquals(0, $this->getText("xpath=//li[@id='tab_activity']/a/em"));
517
518 // click through to the relationship view screen
519 $this->click('css=li#tab_rel a');
520 $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[2]/a");
521 $this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[2]/a[text()='Organization $org3']"));
522 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_rel']/a/em"));
523 }
524 }
525