Merge pull request #85 from dlobo/CRM-12052
[civicrm-core.git] / tests / phpunit / WebTest / Mailing / MailingTest.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.3 |
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
28 require_once 'CiviTest/CiviSeleniumTestCase.php';
29 class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase {
30
31 protected function setUp() {
32 parent::setUp();
33 }
34
35 function testAddMailing() {
36 $this->open($this->sboxPath);
37 $this->webtestLogin();
38
39 //----do create test mailing group
40
41 // Go directly to the URL of the screen that you will be testing (New Group).
42 $this->openCiviPage("group/add", "reset=1", "_qf_Edit_upload");
43
44 // make group name
45 $groupName = 'group_' . substr(sha1(rand()), 0, 7);
46
47 // fill group name
48 $this->type("title", $groupName);
49
50 // fill description
51 $this->type("description", "New mailing group for Webtest");
52
53 // enable Mailing List
54 $this->click("group_type[2]");
55
56 // select Visibility as Public Pages
57 $this->select("visibility", "value=Public Pages");
58
59 // Clicking save.
60 $this->click("_qf_Edit_upload");
61 $this->waitForPageToLoad($this->getTimeoutMsec());
62
63 // Is status message correct?
64 $this->assertElementContainsText('crm-notification-container', "The Group '$groupName' has been saved.");
65
66 //---- create mailing contact and add to mailing Group
67 $firstName = substr(sha1(rand()), 0, 7);
68 $this->webtestAddContact($firstName, "Mailson", "mailino$firstName@mailson.co.in");
69
70 // Get contact id from url.
71 $matches = array();
72 preg_match('/cid=([0-9]+)/', $this->getLocation(), $matches);
73 $contactId = $matches[1];
74
75 // go to group tab and add to mailing group
76 $this->click("css=li#tab_group a");
77 $this->waitForElementPresent("_qf_GroupContact_next");
78 $this->select("group_id", "$groupName");
79 $this->click("_qf_GroupContact_next");
80 $this->waitForPageToLoad($this->getTimeoutMsec());
81 $this->waitForElementPresent("_qf_GroupContact_next");
82
83 // configure default mail-box
84 $this->openCiviPage("admin/mailSettings", "action=update&id=1&reset=1", '_qf_MailSettings_cancel-bottom');
85 $this->type('name', 'Test Domain');
86 $this->type('domain', 'example.com');
87 $this->select('protocol', 'value=1');
88 $this->click('_qf_MailSettings_next-bottom');
89 $this->waitForPageToLoad($this->getTimeoutMsec());
90
91 // Go directly to Schedule and Send Mailing form
92 $this->openCiviPage("mailing/send", "reset=1", "_qf_Group_cancel");
93
94 //-------select recipients----------
95
96 // fill mailing name
97 $mailingName = substr(sha1(rand()), 0, 7);
98 $this->type("name", "Mailing $mailingName Webtest");
99
100 // Add the test mailing group
101 $this->select("includeGroups-f", "$groupName");
102 $this->click("add");
103
104 // click next
105 $this->click("_qf_Group_next");
106 $this->waitForElementPresent("_qf_Settings_cancel");
107
108 //--------track and respond----------
109
110 // check for default settings options
111 $this->assertChecked("url_tracking");
112 $this->assertChecked("open_tracking");
113
114 // do check count for Recipient
115 $this->assertElementContainsText('css=.messages', "Total Recipients: 1");
116
117 // no need tracking for this test
118
119 // click next with default settings
120 $this->click("_qf_Settings_next");
121 $this->waitForElementPresent("_qf_Upload_cancel");
122
123 //--------Mailing content------------
124 // let from email address be default
125
126 // fill subject for mailing
127 $this->type("subject", "Test subject {$mailingName} for Webtest");
128
129 // check for default option enabled
130 $this->assertChecked("CIVICRM_QFID_1_upload_type");
131
132 // HTML format message
133 $HTMLMessage = "This is HTML formatted content for Mailing {$mailingName} Webtest.";
134 $this->fillRichTextField("html_message", $HTMLMessage);
135
136 // Open Plain-text Format pane and type text format msg
137 $this->click("//fieldset[@id='compose_id']/div[2]/div[1]");
138 $this->type("text_message", "This is text formatted content for Mailing {$mailingName} Webtest.");
139
140 // select default header and footer ( with label )
141 $this->select("header_id", "label=Mailing Header");
142 $this->select("footer_id", "label=Mailing Footer");
143
144 // do check count for Recipient
145 $this->assertElementContainsText('css=.messages', "Total Recipients: 1");
146
147 // click next with nominal content
148 $this->click("_qf_Upload_upload");
149 $this->waitForElementPresent("_qf_Test_cancel");
150
151 //---------------Test------------------
152
153 ////////--Commenting test mailing and mailing preview (test mailing and preview not presently working).
154
155 // send test mailing
156 //$this->type("test_email", "mailino@mailson.co.in");
157 //$this->click("sendtest");
158
159 // verify status message
160 //$this->assertTrue($this->isTextPresent("Your test message has been sent. Click 'Next' when you are ready to Schedule or Send your live mailing (you will still have a chance to confirm or cancel sending this mailing on the next page)."));
161
162 // check mailing preview
163 //$this->click("//form[@id='Test']/div[2]/div[4]/div[1]");
164 //$this->assertTrue($this->isTextPresent("this is test content for Mailing $mailingName Webtest"));
165
166 ////////
167
168 // do check count for Recipient
169 $this->assertElementContainsText('css=.messages', "Total Recipients: 1");
170
171 // click next
172 $this->click("_qf_Test_next");
173 $this->waitForElementPresent("_qf_Schedule_cancel");
174
175 //----------Schedule or Send------------
176
177 // do check for default option enabled
178 $this->assertChecked("now");
179
180 // do check count for Recipient
181 $this->assertElementContainsText('css=.messages', "Total Recipients: 1");
182
183 // finally schedule the mail by clicking submit
184 $this->click("_qf_Schedule_next");
185 $this->waitForPageToLoad($this->getTimeoutMsec());
186
187 //----------end New Mailing-------------
188
189 //check redirected page to Scheduled and Sent Mailings and verify for mailing name
190 $this->assertElementContainsText('page-title', "Scheduled and Sent Mailings");
191 $this->assertElementContainsText("xpath=//table[@class='selector']/tbody//tr//td", "Mailing $mailingName Webtest");
192
193 //--------- mail delivery verification---------
194 // test undelivered report
195
196 // click report link of created mailing
197 $this->click("xpath=//table//tbody/tr[td[1]/text()='Mailing $mailingName Webtest']/descendant::a[text()='Report']");
198 $this->waitForPageToLoad($this->getTimeoutMsec());
199
200 // verify undelivered status message
201 $this->assertElementContainsText('css=.messages', "Delivery has not yet begun for this mailing. If the scheduled delivery date and time is past, ask the system administrator or technical support contact for your site to verify that the automated mailer task ('cron job') is running - and how frequently.");
202
203 // do check for recipient group
204 $this->assertElementContainsText("xpath=//fieldset/legend[text()='Recipients']/../table/tbody//tr/td", "Members of $groupName");
205
206 // directly send schedule mailing -- not working right now
207 $this->openCiviPage("mailing/queue", "reset=1");
208
209 //click report link of created mailing
210 $this->click("xpath=//table//tbody/tr[td[1]/text()='Mailing $mailingName Webtest']/descendant::a[text()='Report']");
211 $this->waitForPageToLoad($this->getTimeoutMsec());
212
213 // do check again for recipient group
214 $this->assertElementContainsText("xpath=//fieldset/legend[text()='Recipients']/../table/tbody//tr/td", "Members of $groupName");
215
216 // verify intended recipients
217 $this->verifyText("xpath=//table//tr[td/a[text()='Intended Recipients']]/descendant::td[2]", preg_quote("1"));
218
219 // verify successful deliveries
220 $this->verifyText("xpath=//table//tr[td/a[text()='Successful Deliveries']]/descendant::td[2]", preg_quote("1 (100.00%)"));
221
222 // verify status
223 $this->verifyText("xpath=//table//tr[td[1]/text()='Status']/descendant::td[2]", preg_quote("Complete"));
224
225 // verify mailing name
226 $this->verifyText("xpath=//table//tr[td[1]/text()='Mailing Name']/descendant::td[2]", preg_quote("Mailing $mailingName Webtest"));
227
228 // verify mailing subject
229 $this->verifyText("xpath=//table//tr[td[1]/text()='Subject']/descendant::td[2]", preg_quote("Test subject $mailingName for Webtest"));
230
231 //---- check for delivery detail--
232
233 $this->click("link=Successful Deliveries");
234 $this->waitForPageToLoad($this->getTimeoutMsec());
235
236 // check for open page
237 $this->assertElementContainsText( 'page-title', "Successful Deliveries");
238
239 // verify email
240 $this->verifyText("xpath=//table[@id='mailing_event']/tbody//tr/td[2]", preg_quote("mailino$firstName@mailson.co.in"));
241
242 require_once 'CRM/Mailing/Event/DAO/Queue.php';
243 $eventQueue = new CRM_Mailing_Event_DAO_Queue();
244 $eventQueue->contact_id = $contactId;
245 $eventQueue->find(TRUE);
246
247 $permission = array('edit-1-access-civimail-subscribeunsubscribe-pages');
248 $this->changePermissions($permission);
249 $this->open($this->sboxPath . "civicrm/logout?reset=1");
250
251 // build forward url
252 $forwardUrl = array("mailing/forward", "reset=1&jid={$eventQueue->job_id}&qid={$eventQueue->id}&h={$eventQueue->hash}");
253 $this->openCiviPage($forwardUrl[0], $forwardUrl[1]);
254
255 $this->type("email_0", substr(sha1(rand()), 0, 7) . '@example.com');
256 $this->type("email_1", substr(sha1(rand()), 0, 7) . '@example.com');
257
258 $this->click("comment_show");
259 $this->type("forward_comment", "Test Message");
260
261 $this->click("_qf_ForwardMailing_next-bottom");
262 $this->waitForPageToLoad($this->getTimeoutMsec());
263 $this->assertElementContainsText('css=div.messages', 'Mailing is forwarded successfully to 2 email addresses');
264
265 $this->open($this->sboxPath);
266 $this->waitForPageToLoad($this->getTimeoutMsec());
267 $this->webtestLogin();
268
269 $this->openCiviPage("mailing/browse/scheduled", "reset=1&scheduled=true");
270
271 //click report link of created mailing
272 $this->click("xpath=//table//tbody/tr[td[1]/text()='Mailing $mailingName Webtest']/descendant::a[text()='Report']");
273 $this->waitForPageToLoad($this->getTimeoutMsec());
274
275 // verify successful forwards
276 $this->verifyText("xpath=//table//tr[td/a[text()='Forwards']]/descendant::td[2]", "2");
277
278 // Mailing is forwarded successfully to 2 email addresses.
279 //------end delivery verification---------
280
281 // //------ check with unsubscribe -------
282 // // FIX ME: there is an issue with DSN setting for Webtest, need to handle by seperate DSN setting for Webtests
283 // // build unsubscribe link
284 // require_once 'CRM/Mailing/Event/DAO/Queue.php';
285 // $eventQueue = new CRM_Mailing_Event_DAO_Queue( );
286 // $eventQueue->contact_id = $contactId;
287 // $eventQueue->find(true);
288
289 // // unsubscribe link
290 // $unsubscribeUrl = "civicrm/mailing/optout?reset=1&jid={$eventQueue->job_id}&qid={$eventQueue->id}&h={$eventQueue->hash}&confirm=1";
291
292 // // logout to unsubscribe
293 // $this->open($this->sboxPath . 'civicrm/logout?reset=1');
294 // $this->waitForPageToLoad($this->getTimeoutMsec());
295
296 // // click(visit) unsubscribe path
297 // $this->open($this->sboxPath . $unsubscribeUrl);
298 // $this->waitForPageToLoad($this->getTimeoutMsec());
299
300 // $this->assertTrue($this->isTextPresent('Optout'));
301 // $this->assertTrue($this->isTextPresent("mailino$firstName@mailson.co.in"));
302
303 // // unsubscribe
304 // $this->click('_qf_optout_next');
305 // $this->waitForPageToLoad($this->getTimeoutMsec());
306
307 // $this->assertTrue($this->isTextPresent('Optout'));
308 // $this->assertTrue($this->isTextPresent("mailino$firstName@mailson.co.in"));
309 // $this->assertTrue($this->isTextPresent('has been successfully opted out.'));
310
311 // //------ end unsubscribe -------
312 }
313
314 function testAdvanceSearchAndReportCheck() {
315
316 $this->open($this->sboxPath);
317 $this->webtestLogin();
318
319 // Go directly to the URL of the screen that you will be testing (New Group).
320 $this->openCiviPage("group/add", "reset=1", "_qf_Edit_upload");
321
322 // make group name
323 $groupName = 'group_' . substr(sha1(rand()), 0, 7);
324
325 // fill group name
326 $this->type("title", $groupName);
327
328 // fill description
329 $this->type("description", "New mailing group for Webtest");
330
331 // enable Mailing List
332 $this->click("group_type[2]");
333
334 // select Visibility as Public Pages
335 $this->select("visibility", "value=Public Pages");
336
337 // Clicking save.
338 $this->click("_qf_Edit_upload");
339 $this->waitForPageToLoad($this->getTimeoutMsec());
340
341 // Is status message correct?
342 $this->assertElementContainsText('crm-notification-container', "The Group '$groupName' has been saved.");
343
344 //---- create mailing contact and add to mailing Group
345 $firstName = substr(sha1(rand()), 0, 7);
346 $this->webtestAddContact($firstName, "Mailson", "mailino$firstName@mailson.co.in");
347
348 // Get contact id from url.
349 $matches = array();
350 preg_match('/cid=([0-9]+)/', $this->getLocation(), $matches);
351 $contactId = $matches[1];
352
353 // go to group tab and add to mailing group
354 $this->click("css=li#tab_group a");
355 $this->waitForElementPresent("_qf_GroupContact_next");
356 $this->select("group_id", "$groupName");
357 $this->click("_qf_GroupContact_next");
358 $this->waitForPageToLoad($this->getTimeoutMsec());
359 $this->waitForElementPresent("_qf_GroupContact_next");
360
361 // configure default mail-box
362 $this->openCiviPage("admin/mailSettings", "action=update&id=1&reset=1", '_qf_MailSettings_cancel-bottom');
363 $this->type('name', 'Test Domain');
364 $this->type('domain', 'example.com');
365 $this->select('protocol', 'value=1');
366 $this->click('_qf_MailSettings_next-bottom');
367 $this->waitForPageToLoad($this->getTimeoutMsec());
368
369 // Go directly to Schedule and Send Mailing form
370 $this->open($this->sboxPath . "civicrm/mailing/send?reset=1");
371 $this->waitForElementPresent("_qf_Group_cancel");
372
373 //-------select recipients----------
374
375 // fill mailing name
376 $mailingName = substr(sha1(rand()), 0, 7);
377 $this->type("name", "Mailing $mailingName Webtest");
378
379 // Add the test mailing group
380 $this->select("includeGroups-f", "$groupName");
381 $this->click("add");
382
383 // click next
384 $this->click("_qf_Group_next");
385 $this->waitForElementPresent("_qf_Settings_cancel");
386
387 //--------track and respond----------
388
389 // check for default settings options
390 $this->assertChecked("url_tracking");
391 $this->assertChecked("open_tracking");
392
393 // do check count for Recipient
394 $this->assertElementContainsText('css=.messages', "Total Recipients: 1");
395
396 // click next with default settings
397 $this->click("_qf_Settings_next");
398 $this->waitForElementPresent("_qf_Upload_cancel");
399
400 // fill subject for mailing
401 $this->type("subject", "Test subject {$mailingName} for Webtest");
402
403 // check for default option enabled
404 $this->assertChecked("CIVICRM_QFID_1_upload_type");
405
406 // HTML format message
407 $HTMLMessage = "This is HTML formatted content for Mailing {$mailingName} Webtest.";
408 $this->fillRichTextField("html_message", $HTMLMessage);
409
410 // Open Plain-text Format pane and type text format msg
411 $this->click("//fieldset[@id='compose_id']/div[2]/div[1]");
412 $this->type("text_message", "This is text formatted content for Mailing {$mailingName} Webtest.");
413
414 // select default header and footer ( with label )
415 $this->select("header_id", "label=Mailing Header");
416 $this->select("footer_id", "label=Mailing Footer");
417
418 // do check count for Recipient
419 $this->assertElementContainsText('css=.messages', "Total Recipients: 1");
420
421 // click next with nominal content
422 $this->click("_qf_Upload_upload");
423 $this->waitForElementPresent("_qf_Test_cancel");
424
425 // do check count for Recipient
426 $this->assertElementContainsText('css=.messages', "Total Recipients: 1");
427
428 // click next
429 $this->click("_qf_Test_next");
430 $this->waitForElementPresent("_qf_Schedule_cancel");
431
432 //----------Schedule or Send------------
433
434 // do check for default option enabled
435 $this->assertChecked("now");
436
437 // do check count for Recipient
438 $this->assertElementContainsText('css=.messages', "Total Recipients: 1");
439
440 // finally schedule the mail by clicking submit
441 $this->click("_qf_Schedule_next");
442 $this->waitForPageToLoad($this->getTimeoutMsec());
443
444 //----------end New Mailing-------------
445
446 //check redirected page to Scheduled and Sent Mailings and verify for mailing name
447 $this->assertElementContainsText('page-title', "Scheduled and Sent Mailings");
448 $this->assertElementContainsText("xpath=//table[@class='selector']/tbody//tr//td", "Mailing $mailingName Webtest");
449
450 // directly send schedule mailing -- not working right now
451 $this->openCiviPage("mailing/queue", "reset=1");
452
453 //click report link of created mailing
454 $this->click("xpath=//table//tbody/tr[td[1]/text()='Mailing $mailingName Webtest']/descendant::a[text()='Report']");
455 $this->waitForPageToLoad($this->getTimeoutMsec());
456
457 $mailingReportUrl = $this->getLocation();
458 // do check again for recipient group
459 $this->assertElementContainsText("xpath=//fieldset/legend[text()='Recipients']/../table/tbody//tr/td", "Members of $groupName");
460
461 // verify successful deliveries
462 $this->verifyText("xpath=//table//tr[td/a[text()='Successful Deliveries']]/descendant::td[2]", preg_quote("1 (100.00%)"));
463
464 $summaryInfoLinks = array('Intended Recipients', 'Successful Deliveries', 'Tracked Opens', 'Click-throughs', 'Forwards', 'Replies', 'Bounces', 'Unsubscribe Requests','Opt-out Requests');
465
466 //check for report and adv search links
467 foreach($summaryInfoLinks as $value) {
468 $this->assertTrue($this->isElementPresent("xpath=//fieldset/legend[text()='Delivery Summary']/../table//tr[td/a[text()='{$value}']]/descendant::td[3]/span/a[1][text()='Report']"), "Report link missing for {$value}");
469 $this->assertTrue($this->isElementPresent("xpath=//fieldset/legend[text()='Delivery Summary']/../table//tr[td/a[text()='{$value}']]/descendant::td[3]/span/a[2][text()='Advanced Search']"), "Advance Search link missing for {$value}");
470 }
471 // verify mailing name
472 $this->verifyText("xpath=//table//tr[td[1]/text()='Mailing Name']/descendant::td[2]", preg_quote("Mailing $mailingName Webtest"));
473
474 // verify mailing subject
475 $this->verifyText("xpath=//table//tr[td[1]/text()='Subject']/descendant::td[2]", preg_quote("Test subject $mailingName for Webtest"));
476
477 // after asserts do clicks and confirm filters
478 $criteriaCheck =
479 array(
480 'Intended Recipients' =>
481 array(
482 'report' => array('report_name' => 'Mailing Details', 'Mailing' => "Mailing $mailingName Webtest"),
483 'search' => array('Mailing Name IN' => "\"Mailing {$mailingName} Webtest")
484 ),
485 'Successful Deliveries' =>
486 array(
487 'report' => array('report_name' => 'Mailing Details', 'Mailing' => "Mailing $mailingName Webtest",
488 "Delivery Status" => " Successful"),
489 'search' => array('Mailing Name IN' => "\"Mailing {$mailingName} Webtest", 'Mailing Delivery -' => "Successful")
490 ),
491 'Tracked Opens' =>
492 array(
493 'report' => array('report_name' => 'Mail Opened', 'Mailing' => "Mailing $mailingName Webtest"),
494 'search' => array('Mailing Name IN' => "\"Mailing {$mailingName} Webtest", 'Mailing: Trackable Opens -' => "Opened")
495 ),
496 'Click-throughs' =>
497 array(
498 'report' => array('report_name' => 'Mail Clickthroughs', 'Mailing' => "Mailing $mailingName Webtest"),
499 'search' => array('Mailing Name IN' => "\"Mailing {$mailingName} Webtest", 'Mailing: Trackable URL Clicks -' => "Clicked")
500 ),
501 'Forwards' =>
502 array(
503 'report' => array('report_name' => 'Mailing Details', 'Mailing' => "Mailing $mailingName Webtest",
504 'Forwarded' => 'Is equal to Yes'),
505 'search' => array('Mailing Name IN' => "\"Mailing {$mailingName} Webtest", 'Mailing: -' => "Forwards")
506 ),
507 'Replies' =>
508 array(
509 'report' => array('report_name' => 'Mailing Details', 'Mailing' => "Mailing $mailingName Webtest",
510 'Replied' => 'Is equal to Yes'),
511 'search' => array('Mailing Name IN' => "\"Mailing {$mailingName} Webtest", 'Mailing: Trackable Replies -' => "Replied")
512 ),
513 'Bounces' =>
514 array(
515 'report' => array('report_name' => 'Mail Bounces', 'Mailing' => "Mailing $mailingName Webtest"),
516 'search' => array('Mailing Name IN' => "\"Mailing {$mailingName} Webtest", 'Mailing Delivery -' => "Bounced")
517 ),
518 'Unsubscribe Requests' =>
519 array(
520 'report' => array('report_name' => 'Mailing Details', 'Mailing' => "Mailing $mailingName Webtest",
521 'Unsubscribed' => 'Is equal to Yes'),
522 'search' => array('Mailing Name IN' => "\"Mailing {$mailingName} Webtest", 'Mailing: -' => "Unsubscribe Requests")
523 ),
524 'Opt-out Requests' =>
525 array(
526 'report' => array('report_name' => 'Mailing Details', 'Mailing' => "Mailing $mailingName Webtest",
527 'Opted-out' => 'Is equal to Yes'),
528 'search' => array('Mailing Name IN' => "\"Mailing {$mailingName} Webtest", 'Mailing: -' => "Opt-out Requests")
529 ),
530 );
531 $this->criteriaCheck($criteriaCheck, $mailingReportUrl);
532 }
533
534 function criteriaCheck($criteriaCheck, $mailingReportUrl) {
535 foreach($criteriaCheck as $key => $infoFilter) {
536 foreach($infoFilter as $entity => $dataToCheck) {
537 $this->open($mailingReportUrl);
538 if ($entity == "report") {
539 $this->click("xpath=//fieldset/legend[text()='Delivery Summary']/../table//tr[td/a[text()='{$key}']]/descendant::td[3]/span/a[1][text()='Report']");
540 } else {
541 $this->click("xpath=//fieldset/legend[text()='Delivery Summary']/../table//tr[td/a[text()='{$key}']]/descendant::td[3]/span/a[2][text()='Advanced Search']");
542 }
543 $this->waitForPageToLoad($this->getTimeoutMsec());
544 $this-> _verifyCriteria($key, $dataToCheck, $entity);
545 }
546 }
547 }
548
549 function _verifyCriteria($summaryInfo, $dataToCheck, $entity) {
550 foreach($dataToCheck as $key => $value) {
551 if ($entity == 'report') {
552 if ($key == 'report_name') {
553 $this->assertElementContainsText('page-title', "{$value}");
554 continue;
555 }
556 $this->assertTrue($this->isElementPresent("xpath=//form//div[3]/table/tbody//tr/th[contains(text(),'{$key}')]/../td[contains(text(),'{$value}')]"),"Criteria check for {$key} failed for Report for {$summaryInfo}");
557 } else {
558 $this->assertElementContainsText('page-title', "Advanced Search");
559 $assertedValue = $this->isElementPresent("xpath=//div[@class='crm-results-block']//div[@class='qill'][contains(text(),'{$key} {$value}')]");
560 if (!$assertedValue) {
561 $assertedValue = $this->isTextPresent("{$key} {$value}");
562 }
563 $this->assertTrue($assertedValue,"Criteria check for {$key} failed for Advance Search for {$summaryInfo}");
564 }
565 }
566 }
567 }