3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
27 require_once 'CiviTest/CiviSeleniumTestCase.php';
28 class WebTest_Member_InheritedMembershipTest
extends CiviSeleniumTestCase
{
29 protected function setUp() {
33 function testInheritedMembership() {
34 // Log in using webtestLogin() method
35 $this->webtestLogin();
37 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
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.");
46 $this->openCiviPage('admin/member/membershipType', 'reset=1&action=browse');
48 $this->click('link=Add Membership Type');
49 $this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
51 $this->type('name', "Membership Type $title");
53 $this->select2('member_of_contact_id', $title);
55 $this->type('minimum_fee', '100');
56 $this->select( 'financial_type_id', 'value=2' );
57 $this->type('duration_interval', 1);
58 $this->select('duration_unit', 'label=year');
60 $this->select('period_type', 'value=rolling');
62 $this->removeSelection('relationship_type_id', 'label=- select -');
63 $this->addSelection('relationship_type_id', 'label=Employer of');
65 $this->type('max_related', '5');
67 $this->click('_qf_MembershipType_upload-bottom');
68 $this->waitForElementPresent('link=Add Membership Type');
69 $this->waitForText('crm-notification-container', "Membership Type $title");
71 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
73 // creating another Orgnization
74 $title1 = substr(sha1(rand()), 0, 7);
75 $this->type('organization_name', "Organization $title1");
76 $this->type('email_1_email', "$title1@org.com");
77 $this->click('_qf_Contact_upload_view');
78 $this->waitForPageToLoad($this->getTimeoutMsec());
80 // click through to the membership view screen
81 $this->click('css=li#tab_member a');
83 $this->waitForElementPresent('link=Add Membership');
84 $this->click('link=Add Membership');
86 $this->waitForElementPresent('_qf_Membership_cancel-bottom');
88 // fill in Membership Organization and Type
89 $this->select('membership_type_id[0]', "label=Organization $title");
90 $this->select('membership_type_id[1]', "label=Membership Type $title");
92 $sourceText = 'Membership ContactAddTest with Fixed Membership Type';
94 $this->type('source', $sourceText);
97 $this->click('_qf_Membership_upload');
98 $this->waitForElementPresent('link=Add Membership');
101 $this->waitForTextPresent($sourceText);
103 // Is status message correct?
104 $this->waitForText('crm-notification-container', "Membership Type $title");
106 // click through to the membership view screen
107 $this->click("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
108 $this->waitForElementPresent('_qf_MembershipView_cancel-bottom');
110 $joinDate = date('Y-m-d');
111 $startDate = date('Y-m-d');
112 $endDate = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') - 1, date('Y') +
1));
113 $configVars = new CRM_Core_Config_Variables();
115 'joinDate', 'startDate', 'endDate') as $date) {
116 $
$date = CRM_Utils_Date
::customFormat($
$date, $configVars->dateformatFull
);
119 $this->webtestVerifyTabularData(
121 'Membership Type' => "Membership Type $title",
123 'Source' => $sourceText,
124 'Member Since' => $joinDate,
125 'Start date' => $startDate,
126 'End date' => $endDate,
132 // We're using Quick Add block on the main page for this.
133 $firstName = substr(sha1(rand()), 0, 7);
134 $this->webtestAddContact($firstName, 'Anderson', "$firstName@anderson.name");
136 // visit relationship tab
137 $this->click('css=li#tab_rel a');
138 $this->waitForElementPresent('css=div.action-link');
139 $this->click("//div[@class='action-link']/a/span");
140 $this->waitForElementPresent('_qf_Relationship_cancel-bottom');
141 $this->click('relationship_type_id');
142 $this->select('relationship_type_id', 'label=Employee of');
145 $this->select2('related_contact_id', $title1, TRUE);
147 $description = 'Well here is some description !!!!';
148 $this->type('description', $description);
150 //save the relationship
151 $this->click('_qf_Relationship_upload-bottom');
152 $this->waitForElementPresent('crm-contact-relationship-selector-current_wrapper');
153 //check the status message
154 $this->waitForText('crm-notification-container', 'Relationship created.');
156 $this->waitForElementPresent("xpath=//div[@id='crm-contact-relationship-selector-current_wrapper']//table/tbody//tr/td[9]/span/a[text()='View']");
158 // click through to the membership view screen
159 $this->click('css=li#tab_member a');
160 $this->waitForElementPresent('css=div#memberships');
162 // click through to the membership view screen
163 $this->click("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
164 $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
166 $this->webtestVerifyTabularData(
168 'Membership Type' => "Membership Type $title",
170 'Source' => $sourceText,
171 'Member Since' => $joinDate,
172 'Start date' => $startDate,
173 'End date' => $endDate,
176 $this->click("_qf_MembershipView_cancel-bottom");
177 $this->waitForElementPresent('css=div#memberships');
179 //1. change relationship status on form
180 $this->click('css=li#tab_rel a');
181 $this->waitForElementPresent('css=div.action-link');
183 $this->click("//li[@id='tab_rel']/a");
184 $this->waitForElementPresent("xpath=//div[@id='crm-contact-relationship-selector-current_wrapper']//table/tbody//tr/td[9]/span/a[text()='Edit']");
185 $id = explode('&id=', $this->getAttribute("xpath=//div[@id='crm-contact-relationship-selector-current_wrapper']//table/tbody//tr/td[9]/span/a@href"));
186 $id = explode('&', $id[0]);
187 $id = explode('=', $id[2]);
189 $this->click("xpath=//div[@id='crm-contact-relationship-selector-current_wrapper']//table/tbody//tr/td[9]/span/a[text()='Edit']");
191 $this->waitForElementPresent('is_active');
192 //disable relationship
193 if ($this->isChecked('is_active')) {
194 $this->click('is_active');
196 $this->click('_qf_Relationship_upload');
197 $this->waitForElementPresent('crm-contact-relationship-selector-past_wrapper');
198 //check the status message
199 $this->waitForText('crm-notification-container', 'Relationship record has been updated');
201 // click through to the membership view screen
202 $this->click('css=li#tab_member a');
204 //verify inherited membership has been removed
205 $this->openCiviPage("contact/view", "reset=1&cid=$id&selectedChild=member", "xpath=//div[@class='view-content']/div[3]");
206 $this->assertElementContainsText("xpath=//div[@class='view-content']", 'No memberships have been recorded for this contact.');
208 // visit relationship tab and re-enable the relationship
209 $this->click('css=li#tab_rel a');
210 $this->waitForElementPresent('css=div.action-link');
211 $this->click("//li[@id='tab_rel']/a");
213 $this->waitForElementPresent("xpath=//div[@id='crm-contact-relationship-selector-past_wrapper']//table/tbody//tr/td[9]/span/a[text()='Edit']");
214 $this->click("xpath=//div[@id='crm-contact-relationship-selector-past_wrapper']//table/tbody//tr/td[9]/span/a[text()='Edit']");
215 $this->waitForElementPresent('is_active');
216 if (!$this->isChecked('is_active')) {
217 $this->click('is_active');
219 $this->click('_qf_Relationship_upload');
220 $this->waitForElementPresent('crm-contact-relationship-selector-current_wrapper');
221 //check the status message
222 $this->waitForText('crm-notification-container', 'Relationship record has been updated.');
224 //check for memberships
225 $this->click('css=li#tab_member a');
226 $this->waitForElementPresent('css=div#memberships');
228 //2 . visit relationship tab and disable the relationship (by links)
229 //disable relationship
230 $this->click('css=li#tab_rel a');
231 $this->waitForElementPresent('css=div.action-link');
232 $this->waitForElementPresent("xpath=//div[@id='crm-contact-relationship-selector-current_wrapper']//table/tbody//tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Disable']");
233 $this->click("xpath=//div[@id='crm-contact-relationship-selector-current_wrapper']//table/tbody//tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Disable']");
234 $this->waitForText("xpath=//div[@class='crm-confirm-dialog ui-dialog-content ui-widget-content modal-dialog']", 'Are you sure you want to disable this record?');
235 $this->click("xpath=//div[@class='ui-dialog-buttonset']//button//span[text()='Disable']");
236 // Because it tends to cause problems, all uses of sleep() must be justified in comments
237 // Sleep should never be used for wait for anything to load from the server
238 // Justification for this instance: FIXME
241 //verify inherited membership has been removed
242 $this->openCiviPage("contact/view", "reset=1&cid={$id}&selectedChild=member", "xpath=//div[@class='view-content']/div[3]");
243 $this->assertElementContainsText("xpath=//div[@class='view-content']/div[3]", 'No memberships have been recorded for this contact.');
245 //enable relationship
246 $this->click('css=li#tab_rel a');
247 $this->waitForElementPresent('css=div.action-link');
249 $this->waitForElementPresent("xpath=//div[@id='crm-contact-relationship-selector-past_wrapper']//table/tbody//tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Enable']");
250 $this->click("xpath=//div[@id='crm-contact-relationship-selector-past_wrapper']//table/tbody//tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Enable']");
253 $this->click('css=li#tab_member a');
254 $this->waitForElementPresent('css=div#memberships');
258 * Webtest for CRM-10146
261 function testInheritedMembershipActivity() {
262 // Log in using webtestLogin() method
263 $this->webtestLogin();
265 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
267 $title = substr(sha1(rand()), 0, 7);
268 $this->type('organization_name', "Organization $title");
269 $this->type('email_1_email', "$title@org.com");
270 $this->clickLink('_qf_Contact_upload_view');
271 $this->waitForText('crm-notification-container', "Organization {$title} has been created.");
273 $this->openCiviPage('admin/member/membershipType', 'reset=1&action=browse');
275 $this->click('link=Add Membership Type');
276 $this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
278 $this->type('name', "Membership Type $title");
280 $this->select2('member_of_contact_id', $title);
282 $this->type('minimum_fee', '100');
283 $this->select('financial_type_id', 'label=Member Dues');
284 $this->type('duration_interval', 1);
285 $this->select('duration_unit', 'label=year');
287 $this->select('period_type', 'value=rolling');
289 $this->removeSelection('relationship_type_id', 'label=- select -');
290 $this->addSelection('relationship_type_id', 'label=Employer of');
292 $this->type('max_related', '5');
294 $this->click('_qf_MembershipType_upload-bottom');
295 $this->waitForElementPresent('link=Add Membership Type');
296 $this->waitForText('crm-notification-container', "Membership Type $title");
298 // creating another Orgnization
299 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
300 $org1 = substr(sha1(rand()), 0, 7);
301 $this->type('organization_name', "Organization $org1");
302 $this->type('email_1_email', "$org1@org.com");
303 $this->clickLink('_qf_Contact_upload_view');
305 // click through to the membership view screen
306 $this->click('css=li#tab_member a');
308 $this->waitForElementPresent('link=Add Membership');
309 $this->click('link=Add Membership');
311 $this->waitForElementPresent('_qf_Membership_cancel-bottom');
313 // fill in Membership Organization and Type
314 $this->select('membership_type_id[0]', "label=Organization $title");
315 $this->select('membership_type_id[1]', "label=Membership Type $title");
317 $sourceText = 'Membership ContactAddTest with Rolling Membership Type';
319 $this->type('source', $sourceText);
322 $this->click('_qf_Membership_upload');
325 $this->waitForTextPresent($sourceText);
327 // Is status message correct?
328 $this->waitForText('crm-notification-container', "Membership Type $title");
331 $this->openCiviPage('contact/add', 'reset=1&ct=Individual', '_qf_Contact_cancel-bottom');
332 $firstName = substr(sha1(rand()), 0, 7);
333 $lastName = 'Anderson';
334 $email = "$firstName@anderson.name";
335 $this->type("first_name", $firstName);
336 $this->type("last_name", $lastName);
338 // Set Current Employer
339 $this->select2('employer_id', $org1);
340 $this->waitForText('s2id_employer_id', $org1);
342 $this->type("email_1_email", $email);
343 $this->clickLink("_qf_Contact_upload_view-bottom");
344 $cid = $this->urlArg('cid');
346 // click through to the membership view screen
347 $this->click('css=li#tab_member a');
348 $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
350 // check number of membership for contact
351 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_member']/a/em"));
353 $this->clickLink("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
354 $expectedMembershipId = $this->urlArg('id');
355 $this->clickLink("_qf_MembershipView_cancel-bottom");
357 // click through to the activity view screen
358 $this->click('css=li#tab_activity a');
359 $this->waitForElementPresent("xpath=//table[@id='contact-activity-selector-activity']/tbody//tr/td[8]/span/a[text()='View']");
361 // check number of activity for contact
362 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_activity']/a/em"));
364 $this->clickLink("xpath=//table[@id='contact-activity-selector-activity']/tbody//tr/td[8]/span/a[text()='View']");
365 $expectedMembershipActivityId = $this->urlArg('id');
366 $this->clickLink("_qf_MembershipView_cancel-bottom");
368 // verify membership id with membership activity id
369 $this->assertEquals($expectedMembershipId, $expectedMembershipActivityId);
371 // click through to the relationship view screen
372 $this->click('css=li#tab_rel a');
373 $this->waitForElementPresent("xpath=//div[@id='option11_wrapper']/table/tbody/tr/td[2]/a");
374 $this->assertTrue($this->isElementPresent("xpath=//div[@id='option11_wrapper']/table/tbody/tr/td[2]/a[text()='Organization $org1']"));
375 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_rel']/a/em"));
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");
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 $this->clickLink("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
388 $actualMembershipId1 = $this->urlArg('id');
389 $this->clickLink("_qf_MembershipView_cancel-bottom");
391 // click through to the activity view screen after edit
392 $this->click('css=li#tab_activity a');
393 $this->waitForElementPresent("xpath=//table[@id='contact-activity-selector-activity']/tbody//tr/td[8]/span/a[text()='View']");
394 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_activity']/a/em"));
395 $this->clickLink("xpath=//table[@id='contact-activity-selector-activity']/tbody//tr/td[8]/span/a[text()='View']");
396 $actualMembershipActivityId1 = $this->urlArg('id');
397 $this->clickLink("_qf_MembershipView_cancel-bottom");
399 // verify membership id and membership activity id with previous one
400 $this->assertEquals($expectedMembershipId, $actualMembershipId1);
401 $this->assertEquals($expectedMembershipId, $actualMembershipActivityId1);
403 // click through to the relationship view screen after edit
404 $this->click('css=li#tab_rel a');
405 $this->waitForElementPresent("xpath=//div[@id='option11_wrapper']/table/tbody/tr/td[2]/a");
406 $this->assertTrue($this->isElementPresent("xpath=//div[@id='option11_wrapper']/table/tbody/tr/td[2]/a[text()='Organization $org1']"));
407 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_rel']/a/em"));
409 // change the current employer of the contact
410 // creating another membership type
411 $this->openCiviPage('admin/member/membershipType', 'reset=1&action=browse');
413 $this->click('link=Add Membership Type');
414 $this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
416 $this->type('name', "Membership Type Another $title");
418 $this->type('member_of_contact', $title);
419 $this->click('member_of_contact');
420 $this->waitForElementPresent("css=div.ac_results-inner li");
421 $this->click("css=div.ac_results-inner li");
423 $this->type('minimum_fee', '100');
424 $this->select('financial_type_id', 'label=Member Dues');
425 $this->type('duration_interval', 1);
426 $this->select('duration_unit', 'label=year');
428 $this->select('period_type', 'label=rolling');
430 $this->removeSelection('relationship_type_id', 'label=- select -');
431 $this->addSelection('relationship_type_id', 'label=Employer of');
433 $this->type('max_related', '5');
435 $this->click('_qf_MembershipType_upload-bottom');
436 $this->waitForElementPresent('link=Add Membership Type');
437 $this->waitForText('crm-notification-container', "Membership Type Another $title");
439 // creating another Orgnization
440 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
441 $org2 = substr(sha1(rand()), 0, 7);
442 $this->type('organization_name', "Organization $org2");
443 $this->type('email_1_email', "$org2@org.com");
444 $this->clickLink('_qf_Contact_upload_view');
446 // click through to the membership view screen
447 $this->click('css=li#tab_member a');
448 $this->waitForElementPresent('link=Add Membership');
449 $this->click('link=Add Membership');
450 $this->waitForElementPresent('_qf_Membership_cancel-bottom');
452 // fill in Membership Organization and Type
453 $this->select('membership_type_id[0]', "label=Organization $title");
454 $this->select('membership_type_id[1]', "label=Membership Type Another $title");
456 $sourceText = 'Membership ContactAddTest with Rolling Membership Type';
457 $this->type('source', $sourceText);
458 $this->clickLink('_qf_Membership_upload');
459 $this->waitForTextPresent($sourceText);
461 // Is status message correct?
462 $this->waitForText('crm-notification-container', "Membership Type Another $title");
465 $this->openCiviPage("contact/add", "reset=1&action=update&cid=$cid", "_qf_Contact_cancel-bottom");
467 // change Current Employer
468 $this->type('current_employer', '');
469 $this->click('current_employer');
470 $this->type('current_employer', $org2);
471 $this->click('current_employer');
472 $this->waitForElementPresent("css=div.ac_results-inner li");
473 $this->click("css=div.ac_results-inner li");
474 $this->clickLink("_qf_Contact_upload_view-bottom");
476 // click through to the membership view screen
477 $this->click('css=li#tab_member a');
478 $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
479 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_member']/a/em"));
480 $this->clickLink("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
481 $actualMembershipId2 = $this->urlArg('id');
482 $this->clickLink("_qf_MembershipView_cancel-bottom");
484 // click through to the activity view screen
485 $this->click('css=li#tab_activity a');
486 $this->waitForElementPresent("xpath=//table[@id='contact-activity-selector-activity']/tbody//tr/td[8]/span/a[text()='View']");
487 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_activity']/a/em"));
488 $this->clickLink("xpath=//table[@id='contact-activity-selector-activity']/tbody//tr/td[8]/span/a[text()='View']");
489 $actualMembershipActivityId2 = $this->urlArg('id');
490 $this->clickLink("_qf_MembershipView_cancel-bottom");
492 // verify membership id and membership activity id with previous one
493 $this->assertNotEquals($expectedMembershipId, $actualMembershipId2);
494 $this->assertNotEquals($expectedMembershipId, $actualMembershipActivityId2);
496 // click through to the relationship view screen
497 $this->click('css=li#tab_rel a');
498 $this->waitForElementPresent("xpath=//div[@id='option11_wrapper']/table/tbody/tr/td[2]/a");
499 $this->assertTrue($this->isElementPresent("xpath=//div[@id='option11_wrapper']/table/tbody/tr/td[2]/a[text()='Organization $org2']"));
500 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_rel']/a/em"));
502 // creating another Orgnization with no membership
503 $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
504 $org3 = substr(sha1(rand()), 0, 7);
505 $this->type('organization_name', "Organization $org3");
506 $this->type('email_1_email', "$org3@org.com");
507 $this->clickLink('_qf_Contact_upload_view');
510 $this->openCiviPage("contact/add", "reset=1&action=update&cid=$cid", "_qf_Contact_cancel-bottom");
512 // change Current Employer
513 $this->type('current_employer', '');
514 $this->click('current_employer');
515 $this->type('current_employer', $org3);
516 $this->click('current_employer');
517 $this->waitForElementPresent("css=div.ac_results-inner li");
518 $this->click("css=div.ac_results-inner li");
519 $this->clickLink("_qf_Contact_upload_view-bottom");
521 // click through to the membership view screen
522 $this->click('css=li#tab_member a');
523 $this->waitForText("xpath=//div[@id='Memberships']/div/div/div[3]", "No memberships have been recorded for this contact.");
524 $this->assertEquals(0, $this->getText("xpath=//li[@id='tab_member']/a/em"));
526 // click through to the activity view screen
527 $this->click('css=li#tab_activity a');
528 $this->waitForText("xpath=//table[@id='contact-activity-selector-activity']/tbody/tr/td", "No matches found.");
529 $this->assertEquals(0, $this->getText("xpath=//li[@id='tab_activity']/a/em"));
531 // click through to the relationship view screen
532 $this->click('css=li#tab_rel a');
533 $this->waitForElementPresent("xpath=//div[@id='option11_wrapper']/table/tbody/tr/td[2]/a");
534 $this->assertTrue($this->isElementPresent("xpath=//div[@id='option11_wrapper']/table/tbody/tr/td[2]/a[text()='Organization $org3']"));
535 $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_rel']/a/em"));