Merge remote-tracking branch 'upstream/4.3' into 4.3-4.4-2013-10-23-19-26-23
[civicrm-core.git] / tests / phpunit / WebTest / Campaign / SurveyUsageScenarioTest.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.4 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License along with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
25 */
26
27 require_once 'CiviTest/CiviSeleniumTestCase.php';
28 class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase {
29
30 protected function setUp() {
31 parent::setUp();
32 }
33
34 function testSurveyUsageScenario() {
35 $this->webtestLogin('admin');
36
37 // Create new group
38 $title = substr(sha1(rand()), 0, 7);
39 $groupName = $this->WebtestAddGroup();
40
41 // Adding contact
42 $firstName1 = substr(sha1(rand()), 0, 7);
43 $this->webtestAddContact($firstName1, "Smith", "$firstName1.smith@example.org");
44
45 // add contact to group
46 // visit group tab
47 $this->click("css=li#tab_group a");
48 $this->waitForElementPresent("css=#group_id option");
49
50 // add to group
51 $this->select("group_id", "label=$groupName");
52 $this->click("_qf_GroupContact_next");
53 $this->waitForPageToLoad($this->getTimeoutMsec());
54
55 $firstName2 = substr(sha1(rand()), 0, 7);
56 $this->webtestAddContact($firstName2, "John", "$firstName2.john@example.org");
57
58 // add contact to group
59 // visit group tab
60 $this->click("css=li#tab_group a");
61 $this->waitForElementPresent("css=#group_id option");
62
63 // add to group
64 $this->select("group_id", "label=$groupName");
65 $this->click("_qf_GroupContact_next");
66 $this->waitForPageToLoad($this->getTimeoutMsec());
67
68 // Enable CiviCampaign module if necessary
69 $this->enableComponents(array('CiviCampaign'));
70
71 // add the required permission
72 $this->changePermissions(array('edit-2-administer-civicampaign'));
73
74 // Log in as normal user
75 $this->webtestLogin();
76
77 $this->openCiviPage("campaign/add", "reset=1", "_qf_Campaign_upload-bottom");
78
79 $this->type("title", "Campaign $title");
80
81 // select the campaign type
82 $this->select("campaign_type_id", "value=2");
83
84 // fill in the description
85 $this->type("description", "This is a test campaign");
86
87 // include groups for the campaign
88 $this->addSelection("includeGroups-f", "label=$groupName");
89 $this->click("//option[@value=4]");
90 $this->click("add");
91
92 // fill the end date for campaign
93 $this->webtestFillDate("end_date", "+1 year");
94
95 // select campaign status
96 $this->select("status_id", "value=2");
97
98 // click save
99 $this->click("_qf_Campaign_upload-bottom");
100 $this->waitForPageToLoad($this->getTimeoutMsec());
101
102 $this->waitForText('crm-notification-container', "$title");
103
104 // create a custom data set for activities -> survey
105 $this->openCiviPage('admin/custom/group', "action=add&reset=1", "_qf_Group_next-bottom");
106 // fill in a unique title for the custom group
107 $this->type("title", "Group $title");
108
109 // select the group this custom data set extends
110 $this->select("extends[0]", "value=Activity");
111 $this->waitForElementPresent("//select[@id='extends_1']");
112 $this->select("//select[@id='extends_1']", "label=Survey");
113
114 // save the custom group
115 $this->click("_qf_Group_next-bottom");
116 $this->waitForPageToLoad($this->getTimeoutMsec());
117
118 // add a custom field to the custom group
119 $this->type("label", "Field $title");
120
121 $this->select("data_type[1]", "value=Radio");
122
123 $this->waitForElementPresent("option_label_1");
124
125 // create a set of options
126 $this->type("option_label_1", "Option $title 1");
127 $this->type("option_value_1", "1");
128
129 $this->type("option_label_2", "Option $title 2");
130 $this->type("option_value_2", "2");
131
132 // save the custom field
133 $this->click("_qf_Field_next-bottom");
134
135 $this->waitForElementPresent("newCustomField");
136 $this->waitForText('crm-notification-container', "$title");
137
138 // create a profile for campaign
139 $this->openCiviPage("admin/uf/group/add", "action=add&reset=1", "_qf_Group_next-bottom");
140
141 // fill in a unique title for the profile
142 $this->type("title", "Profile $title");
143
144 // save the profile
145 $this->click("_qf_Group_next-bottom");
146
147 $this->waitForElementPresent("_qf_Field_next-bottom");
148 $this->waitForText('crm-notification-container', "$title");
149
150 // add a profile field for activity
151 $this->select("field_name[0]", "value=Activity");
152 $this->waitForElementPresent("field_name[1]");
153 $this->select("field_name[1]", "label=Field $title :: Group $title");
154
155 $this->click("_qf_Field_next-bottom");
156 $this->waitForPageToLoad($this->getTimeoutMsec());
157 $this->waitForText('crm-notification-container', "$title");
158
159 // create a survey
160 $this->openCiviPage("survey/add", "reset=1", "_qf_Main_upload-bottom");
161
162 // fill in a unique title for the survey
163 $this->type("title", "Survey $title");
164
165 // select the created campaign
166 $this->select("campaign_id", "label=Campaign $title");
167
168 // select the activity type
169 $this->select("activity_type_id", "label=Survey");
170
171 // fill in reserve survey respondents
172 $this->type("default_number_of_contacts", 50);
173
174 // fill in interview survey respondents
175 $this->type("max_number_of_contacts", 100);
176
177 // release frequency
178 $this->type("release_frequency", 2);
179
180 $this->click("_qf_Main_upload-bottom");
181 $this->waitForElementPresent("_qf_Questions_upload_next-bottom");
182
183 // Select the profile for the survey
184 $this->select("//form[@id='Questions']/div[2]/table/tbody/tr[1]/td[2]/div/div/span/select", "label=New Individual");
185
186 // select the question created for the survey
187
188 $this->select("//form[@id='Questions']/div[2]/table/tbody/tr[2]/td[2]/div/div/span/select", "label=Profile $title");
189 $this->click("_qf_Questions_upload_next-bottom");
190
191 // create a set of options for Survey Responses _qf_Results_upload_done-bottom
192 $this->waitForElementPresent('_qf_Results_upload_done-bottom');
193 $this->type("//input[@id='option_label_1']", "Label $title 1");
194 $this->type("//input[@id='option_value_1']", "1");
195
196 $this->type("//input[@id='option_label_2']", "Label $title 2");
197 $this->type("//input[@id='option_value_2']", "2");
198 $this->click('_qf_Results_upload_done-bottom');
199 $this->waitForElementPresent("//div[@id='search_form_survey']");
200 $this->waitForText('crm-notification-container', "Results");
201
202 // Reserve Respondents
203 $this->openCiviPage("survey/search", "reset=1&op=reserve", "_qf_Search_refresh");
204
205 // search for the respondents
206 $this->select("campaign_survey_id", "label=Survey $title");
207
208 $this->click("_qf_Search_refresh");
209
210 $this->waitForElementPresent("Go");
211 $this->click("CIVICRM_QFID_ts_all_4");
212 $this->click("Go");
213
214 $this->waitForElementPresent("_qf_Reserve_done_reserve-bottom");
215 $this->click("_qf_Reserve_done_reserve-bottom");
216 $this->waitForPageToLoad($this->getTimeoutMsec());
217 $this->waitForText('crm-notification-container', "2 Contact\(s\) have been reserved");
218
219 // Interview Respondents
220 $this->openCiviPage("survey/search", "reset=1&op=interview", "_qf_Search_refresh");
221
222 // search for the respondents
223 $this->select("campaign_survey_id", "label=Survey $title");
224
225 $this->click("_qf_Search_refresh");
226
227 $this->waitForElementPresent("Go");
228 $this->click("CIVICRM_QFID_ts_all_4");
229 $this->click("Go");
230
231 $this->waitForElementPresent("_qf_Interview_cancel_interview");
232
233 $this->click("CIVICRM_QFID_1_2");
234 $this->select("css=#voterRecords .odd .result select", "value=Label $title 1");
235 $this->click("css=#voterRecords .odd td a");
236
237 $this->click("CIVICRM_QFID_2_8");
238 $this->select("css=#voterRecords .even .result select", "value=Label $title 2");
239 $this->click("css=#voterRecords .even td a");
240
241 $this->click("_qf_Interview_cancel_interview");
242 $this->waitForPageToLoad($this->getTimeoutMsec());
243
244 // add a contact to the group to test release respondents
245 $firstName3 = substr(sha1(rand()), 0, 7);
246 $this->webtestAddContact($firstName3, "James", "$firstName3.james@example.org");
247 $id = $this->urlArg('cid');
248 $sortName3 = "James, $firstName3";
249
250 // add contact to group
251 // visit group tab
252 $this->click("css=li#tab_group a");
253 $this->waitForElementPresent("css=#group_id option");
254
255 // add to group
256 $this->select("group_id", "label=$groupName");
257 $this->click("_qf_GroupContact_next");
258 $this->waitForPageToLoad($this->getTimeoutMsec());
259
260 // Reserve Respondents
261 $this->openCiviPage("survey/search", "reset=1&op=reserve", "_qf_Search_refresh");
262
263 // search for the respondents
264 $this->select("campaign_survey_id", "label=Survey $title");
265
266 $this->click("_qf_Search_refresh");
267
268 $this->waitForElementPresent("Go");
269 $this->click("CIVICRM_QFID_ts_all_4");
270 $this->click("Go");
271
272 $this->waitForElementPresent("_qf_Reserve_done_reserve-bottom");
273 $this->click("_qf_Reserve_done_reserve-bottom");
274 $this->waitForPageToLoad($this->getTimeoutMsec());
275 $this->waitForText('crm-notification-container', "1 Contact\(s\) have been reserved");
276
277 // Release Respondents
278 $this->openCiviPage("survey/search", "reset=1&op=release", "_qf_Search_refresh");
279
280 // search for the respondents
281 $this->select("campaign_survey_id", "label=Survey $title");
282
283 $this->click("_qf_Search_refresh");
284
285 $this->waitForElementPresent("Go");
286 $this->click("xpath=id('mark_x_$id')");
287
288 $this->waitForElementPresent("Go");
289 $this->clickLink("Go", "_qf_Release_done-bottom");
290 $this->clickLink("_qf_Release_done-bottom", 'access');
291 $this->waitForText('crm-notification-container', "released");
292
293 // check whether contact is available for reserving again
294 $this->openCiviPage("survey/search", "reset=1&op=reserve", "_qf_Search_refresh");
295
296 // search for the respondents
297 $this->select("campaign_survey_id", "label=Survey $title");
298
299 $this->click("_qf_Search_refresh");
300 $this->waitForPageToLoad($this->getTimeoutMsec());
301 $this->assertTrue($this->isTextPresent("1 Result"), "Result didn't show up after saving!");
302 }
303
304 function testSurveyReportTest() {
305 $this->webtestLogin('admin');
306
307 // Enable CiviCampaign module if necessary
308 $this->enableComponents(array('CiviCampaign'));
309
310 // add the required permission
311 $this->changePermissions('edit-2-administer-civicampaign');
312
313 $this->webtestLogin();
314
315 // Create new group
316 $title = substr(sha1(rand()), 0, 7);
317 $groupName = $this->WebtestAddGroup();
318
319 // Adding contact
320 $firstName1 = substr(sha1(rand()), 0, 7);
321 $this->webtestAddContact($firstName1, "Smith", "$firstName1.smith@example.org");
322 $id1 = $this->urlArg('cid');
323
324 // add contact to group
325 // visit group tab
326 $this->click("css=li#tab_group a");
327 $this->waitForElementPresent('css=#group_id option');
328
329 // add to group
330 $this->select("group_id", "label=$groupName");
331 $this->click("_qf_GroupContact_next");
332 $this->waitForPageToLoad($this->getTimeoutMsec());
333
334 $firstName2 = substr(sha1(rand()), 0, 7);
335 $this->webtestAddContact($firstName2, "John", "$firstName2.john@example.org");
336 $id2 = $this->urlArg('cid');
337
338 // add contact to group
339 // visit group tab
340 $this->click("css=li#tab_group a");
341 $this->waitForElementPresent('css=#group_id option');
342
343 // add to group
344 $this->select("group_id", "label=$groupName");
345 $this->click("_qf_GroupContact_next");
346 $this->waitForPageToLoad($this->getTimeoutMsec());
347
348 // Create custom group and add custom data fields
349 $this->openCiviPage("admin/custom/group", "reset=1");
350
351 $this->click("link=Add Set of Custom Fields");
352 $this->waitForElementPresent('_qf_Group_cancel-bottom');
353
354 $customGroup = "Custom Group $title";
355 $this->type('title', "$customGroup");
356 $this->select('extends[0]', "value=Contact");
357 $this->click('_qf_Group_next-bottom');
358 $this->waitForElementPresent('_qf_Field_cancel-bottom');
359 $this->waitForText('crm-notification-container', $customGroup);
360
361 // Add custom fields
362 $field1 = "Checkbox $title";
363 $this->type('label', $field1);
364 $this->select('data_type[1]', "value=CheckBox");
365 $this->waitForElementPresent('option_label_2');
366
367 // add multiple choice options
368 $label1 = "Check $title One";
369 $value1 = 1;
370 $this->type('option_label_1', $label1);
371 $this->type('option_value_1', $value1);
372
373 $label2 = "Check $title Two";
374 $value2 = 2;
375 $this->type('option_label_2', $label2);
376 $this->type('option_value_2', $value2);
377
378 $this->click("link=another choice");
379
380 $label3 = "Check $title Three";
381 $value3 = 3;
382 $this->type('option_label_3', $label3);
383 $this->type('option_value_3', $value3);
384
385 $this->click('_qf_Field_next-bottom');
386 $this->waitForPageToLoad($this->getTimeoutMsec());
387 $this->waitForText('crm-notification-container', $field1);
388
389 // Create a profile for survey
390 $this->openCiviPage("admin/uf/group", "reset=1");
391
392 $this->click("link=Add Profile");
393 $this->waitForElementPresent('_qf_Group_cancel-bottom');
394
395 $surveyProfile = "Survey Profile $title";
396 $this->type('title', $surveyProfile);
397 $this->click('_qf_Group_next-bottom');
398 $this->waitForElementPresent('_qf_Field_cancel-bottom');
399 $this->waitForText('crm-notification-container', $surveyProfile);
400
401 // Add fields to the profile
402 // Phone ( Primary )
403 $this->select('field_name[0]', "value=Contact");
404 $this->select('field_name[1]', "value=phone");
405 $this->click('field_name[1]');
406 $this->select('visibility', "value=Public Pages and Listings");
407 $this->check('is_searchable');
408 $this->check('in_selector');
409 $this->clickLink('_qf_Field_next_new-bottom', '_qf_Field_cancel-bottom');
410
411 // Custom Data Fields
412 $this->select('field_name[0]', "value=Contact");
413 $this->select('field_name[1]', "label=$field1 :: $customGroup");
414 $this->click('field_name[1]');
415 $this->select('visibility', "value=Public Pages and Listings");
416 $this->check('is_searchable');
417 $this->check('in_selector');
418 $this->click('_qf_Field_next-bottom');
419 $this->waitForPageToLoad($this->getTimeoutMsec());
420
421 // Create a survey
422 $this->openCiviPage("survey/add", "reset=1", "_qf_Main_upload-bottom");
423
424 // fill in a unique title for the survey
425 $surveyTitle = "Survey $title";
426 $this->type('title', $surveyTitle);
427
428 // select the created campaign
429 //$this->select("campaign_id", "label=Campaign $title");
430
431 // select the activity type
432 $this->select("activity_type_id", "label=Survey");
433
434 // fill in reserve survey respondents
435 $this->type("default_number_of_contacts", 50);
436
437 // fill in interview survey respondents
438 $this->type("max_number_of_contacts", 100);
439
440 // release frequency
441 $this->type("release_frequency", 2);
442
443 $this->click("_qf_Main_upload-bottom");
444 $this->waitForElementPresent("_qf_Questions_upload_next-bottom");
445
446 //Select the profile for the survey
447 $this->select("//form[@id='Questions']/div[2]/table/tbody/tr[1]/td[2]/div/div/span/select", "label=New Individual");
448
449 // select the question created for the survey
450
451 $this->select("//form[@id='Questions']/div[2]/table/tbody/tr[2]/td[2]/div/div/span/select", "label=$surveyProfile");
452 $this->click("_qf_Questions_upload_next-bottom");
453
454 // create a set of options for Survey Responses _qf_Results_upload_done-bottom
455 $this->waitForElementPresent('_qf_Results_upload_done-bottom');
456 $optionLabel1 = "Label $title 1";
457 $this->type("//input[@id='option_label_1']", "$optionLabel1");
458 $this->type("//input[@id='option_value_1']", "1");
459
460 $optionLabel2 = "Label $title 2";
461 $this->type("//input[@id='option_label_2']", "$optionLabel2");
462 $this->type("//input[@id='option_value_2']", "2");
463 $this->type("//input[@id='report_title']", "Survey $title");
464 $this->click('_qf_Results_upload_done-bottom');
465 $this->waitForElementPresent("//div[@id='search_form_survey']");
466 $this->assertTrue($this->isTextPresent("'Results' have been saved."),
467 "Status message didn't show up after saving survey!"
468 );
469
470 // Reserve Respondents
471 $this->openCiviPage("survey/search", "reset=1&op=reserve", '_qf_Search_refresh');
472
473 // search for the respondents
474 // select survey
475 $this->select('campaign_survey_id', "label=$surveyTitle");
476
477 // need to wait for Groups field to reload dynamically
478 $this->waitForElementPresent("//select[@class='campaignGroupsSelect']/option[text()='$groupName']");
479
480 // select group
481 $this->click('campaignGroupsSelect1');
482 $this->select('campaignGroupsSelect1', "label=$groupName");
483 $this->click('_qf_Search_refresh');
484
485 $this->waitForElementPresent('_qf_Search_next_print');
486 $this->click("CIVICRM_QFID_ts_all_4");
487 $this->click("Go");
488 $this->waitForElementPresent('_qf_Reserve_done_reserve-bottom');
489
490 $this->clickLink('_qf_Reserve_done_reserve-bottom', 'access');
491 $this->waitForText('crm-notification-container', "2 Contact\(s\) have been reserved");
492
493 $this->openCiviPage("report/survey/detail", "reset=1", '_qf_SurveyDetails_submit');
494
495 // Select columns to be displayed
496 $this->check('fields[survey_id]');
497 $this->check('fields[survey_response]');
498 $this->select('survey_id_value', "label=$surveyTitle");
499 $this->select('status_id_value', "label=Reserved");
500 $this->click('_qf_SurveyDetails_submit');
501 $this->waitForElementPresent('_qf_SurveyDetails_submit_print');
502 $this->assertTrue($this->isTextPresent("Is equal to Reserved"));
503
504 // commenting out the print assertion as print dialog which appears breaks the webtest
505 // as it is OS-related and cannot be handled through webtest
506
507 // $this->click('_qf_SurveyDetails_submit_print');
508 // $this->waitForPageToLoad($this->getTimeoutMsec());
509
510 // $this->assertTrue($this->isTextPresent("Survey Title = $surveyTitle"));
511 // $this->assertTrue($this->isTextPresent("Q1 = $field1"));
512 // $this->assertTrue($this->isTextPresent("$value1 | $value2 | $value3"));
513
514 // Interview Respondents
515 $this->openCiviPage("survey/search", "reset=1&op=interview", '_qf_Search_refresh');
516
517 // search for the respondents
518 // select survey
519 $this->select('campaign_survey_id', "label=$surveyTitle");
520
521 // need to wait for Groups field to reload dynamically
522 $this->waitForElementPresent("//select[@class='campaignGroupsSelect']/option[text()='$groupName']");
523
524 // select group
525 $this->click('campaignGroupsSelect1');
526 $this->select('campaignGroupsSelect1', "label=$groupName");
527 $this->waitForElementPresent("xpath=//ul[@id='crmasmList1']/li");
528 $this->click('_qf_Search_refresh');
529
530 $this->waitForElementPresent('_qf_Search_next_print');
531 $this->click("xpath=//table[@class='selector']/tbody//tr[@id='rowid{$id1}']/td[1]");
532 $this->click("mark_x_{$id1}");
533 $this->click("Go");
534 $this->waitForElementPresent('_qf_Interview_cancel_interview');
535
536 $this->type("field_{$id1}_phone-Primary-1", 9876543210);
537 $this->click("//table[@id='voterRecords']/tbody//tr[@id='row_{$id1}']/td[7]/input[2]/../label[text()='$label1']");
538 $this->click("//table[@id='voterRecords']/tbody//tr[@id='row_{$id1}']/td[7]/input[6]/../label[text()='$label2']");
539 $this->select("field_{$id1}_result", $optionLabel1);
540 $this->click("interview_voter_button_{$id1}");
541 // Because it tends to cause problems, all uses of sleep() must be justified in comments
542 // Sleep should never be used for wait for anything to load from the server
543 // Justification for this instance: FIXME
544 sleep(3);
545 // Survey Report
546 $this->openCiviPage("report/survey/detail", "reset=1", '_qf_SurveyDetails_submit');
547
548 // Select columns to be displayed
549 $this->check('fields[survey_id]');
550 $this->check('fields[survey_response]');
551 $this->select('survey_id_value', "label=$surveyTitle");
552 $this->select('status_id_value', "label=Interviewed");
553 $this->click('_qf_SurveyDetails_submit');
554 $this->waitForElementPresent('_qf_SurveyDetails_submit_print');
555 $this->assertTrue($this->isTextPresent("Is equal to Interviewed"));
556
557 // commenting out the print assertion as print dialog which appears breaks the webtest
558 // as it is OS-related and cannot be handled through webtest
559
560 // $this->click('_qf_SurveyDetails_submit_print');
561 // $this->waitForPageToLoad($this->getTimeoutMsec());
562
563 // $this->assertTrue($this->isTextPresent("Survey Title = $surveyTitle"));
564 // $this->assertTrue($this->isTextPresent("Q1 = $field1"));
565 // $this->assertTrue($this->isTextPresent("$value1"));
566
567 // use GOTV (campaign/gotv) to mark the respondents as voted
568 $this->openCiviPage("campaign/gotv", "reset=1");
569
570 // search for the respondents
571 // select survey
572 $this->select('campaign_survey_id', "label=$surveyTitle");
573 // need to wait for Groups field to reload dynamically
574 $this->waitForElementPresent("//select[@class='campaignGroupsSelect']/option[text()='$groupName']");
575
576 // select group
577 $this->click('campaignGroupsSelect1');
578 $this->select('campaignGroupsSelect1', "label=$groupName");
579 $this->waitForElementPresent("xpath=//ul[@id='crmasmList1']/li");
580 $this->click("xpath=//div[@id='search_form_gotv']/div[2]/table/tbody/tr[6]/td/a[text()='Search']");
581
582 $this->waitForElementPresent("xpath=//table[@id='gotvVoterRecords']/tbody/tr/td[7]");
583 $this->check("xpath=//table[@id='gotvVoterRecords']/tbody/tr/td[7]/input");
584
585 // Check title of the activities created
586 $this->openCiviPage("activity/search", "reset=1", '_qf_Search_refresh');
587 $this->select('activity_survey_id', "label=$surveyTitle");
588 $this->click('_qf_Search_refresh');
589 $this->waitForPageToLoad($this->getTimeoutMsec());
590
591 $this->verifyText("xpath=//table[@class='selector']/tbody//tr/td[5]/a[text()='Smith, $firstName1']/../../td[3]",
592 preg_quote("$surveyTitle - Respondent Interview")
593 );
594 $this->verifyText("xpath=//table[@class='selector']/tbody//tr/td[5]/a[text()='John, $firstName2']/../../td[3]",
595 preg_quote("$surveyTitle - Respondent Reservation")
596 );
597 }
598 }
599