Merge pull request #5535 from colemanw/CRM-16081
[civicrm-core.git] / tests / phpunit / WebTest / Mailing / ABMailingTest.php
CommitLineData
d1a27213 1<?php
2/*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License along with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
25 */
26
27require_once 'CiviTest/CiviSeleniumTestCase.php';
28
29/**
30 * Class WebTest_Mailing_ABMailingTest
31 */
32class WebTest_Mailing_ABMailingTest extends CiviSeleniumTestCase {
33
34 protected function setUp() {
35 parent::setUp();
36 }
37
f13a7d55 38 public function testWithDifferentSubject() {
d1a27213 39 $this->webtestLogin();
40
41 //----do create test mailing 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->clickLink("_qf_Edit_upload");
61
62 // Is status message correct?
63 $this->waitForText('crm-notification-container', "The Group '$groupName' has been saved.");
64
65 // no. of user to add into group
66 $totalUser = 10;
67
68 //---- create mailing contact and add to mailing Group
82647609 69 for ($i = 1; $i <= $totalUser; $i++) {
d1a27213 70 $firstName = substr(sha1(rand()), 0, 7);
71 $this->webtestAddContact($firstName, "Mailson", "mailino$firstName@mailson.co.in");
72
73 // Get contact id from url.
74 $contactId = $this->urlArg('cid');
75
76 // go to group tab and add to mailing group
77 $this->click("css=li#tab_group a");
78 $this->waitForElementPresent("_qf_GroupContact_next");
79 $this->select("group_id", "$groupName");
80 $this->clickLink("_qf_GroupContact_next", "_qf_GroupContact_next", FALSE);
81 }
82 // configure default mail-box
83 $this->setupDefaultMailbox();
84
85 $this->openCiviPage("a/#/abtest/new", NULL, "xpath=//div[@class='crm-wizard-buttons']");
86 $this->waitForElementPresent("xpath=//input[@name='abName']");
87
88 $ABTestName = substr(sha1(rand()), 0, 7) . "ABTestName";
89 $this->type("xpath=//input[@name='abName']", "$ABTestName");
90
91 $this->click("xpath=//input[@value='subject']");
92
93 //click on next
94 $this->click("//button[@ng-click='crmUiWizardCtrl.next()']");
95
96 // Add the test mailing group
97 $this->select2("s2id_crmUiId_13", $groupName, TRUE);
98
99 //$this->fireEvent('xpath=//div[@class="ui-slider-range"]', 'drag');
100
101 //click on next
102 $this->click("//button[@ng-click='crmUiWizardCtrl.next()']");
103 $this->waitForElementPresent("xpath=//input[@name='subjectA']");
104
105 //-------Compose Mail----------
106
107 // fill subject for mailing
108 $MailingSubject = substr(sha1(rand()), 0, 7);
109 $this->type("xpath=//input[@name='subjectA']", "Test subject {$MailingSubject} for A");
82647609 110 $this->type("xpath=//input[@name='subjectB']", "Test subject {$MailingSubject} for B");
d1a27213 111
112 // HTML format message
113 $HTMLMessage = "This is HTML formatted content for Mailing {$MailingSubject} Webtest.";
114 $this->fillRichTextField("crmUiId_1", $HTMLMessage);
115
116 $this->click("xpath=//div[@class='preview-popup']//a[text()='Preview as HTML']");
117 $this->waitForTextPresent($HTMLMessage);
118 $this->waitForAjaxContent();
119 $this->click("xpath=//button[@title='Close']");
120
121 // Open Plain-text Format pane and type text format msg
122 $this->click("//div[text()='Plain Text']");
123 $this->type("xpath=//*[@name='body_text']", "This is text formatted content for Mailing {$MailingSubject} Webtest.");
124
125 $this->click("xpath=//div[@class='preview-popup']//a[text()='Preview as Plain Text']");
126 $this->waitForTextPresent("This is text formatted content for Mailing {$MailingSubject} Webtest.");
127 $this->waitForAjaxContent();
128 $this->click("xpath=//button[@title='Close']");
129
130 // click next with default settings
131 $this->click("xpath=//div[@class='crm-wizard-buttons']/button[text()='Next']");
132
133 // click next with nominal content
134 $this->click("xpath=//center/a/div[text()='Submit Mailing']");
135
136 $this->waitForElementPresent("xpath=//button[text()='Select as Final']");
137 $this->click("xpath=//button[text()='Select as Final']");
138 $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Submit final mailing']");
139 $this->click("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Submit final mailing']");
140
141 //----------end New Mailing-------------
142
143 $this->waitForAjaxContent();
144
145 //check redirected page to Scheduled and Sent Mailings and verify for mailing name
146 $this->openCiviPage("mailing/browse/scheduled", "reset=1&scheduled=true");
147 $this->waitForTextPresent("Find Mailings");
148
149 //--------- mail delivery verification---------
150
151 // click report link of created mailing
152 $this->clickLink("xpath=//table//tbody/tr[td[1]/text()='Final ($ABTestName)']/descendant::a[text()='Report']");
153
154 // directly send schedule mailing -- not working right now
155 $this->openCiviPage("mailing/queue", "reset=1");
156
157 //click report link of created mailing
158 $this->clickLink("xpath=//table//tbody/tr[td[1]/text()='Final ($ABTestName)']/descendant::a[text()='Report']");
159
160 //get actual number of user for mailing
4961a013 161 $mailedUser = round($totalUser * ($totalUser / 100));
d1a27213 162
163 //---- check for delivery detail--
164
82647609 165 $this->waitForElementPresent("xpath=//table[@class='crm-mailing-ab-table']/tbody/tr//td//a[text()=" . $mailedUser . "]");
d1a27213 166 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']/tbody/tr//td//a[2]", "$mailedUser");
167 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']//tbody//tr//td/span", 'Complete');
168
169 //check value for Mailing A
82647609 170 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']/tbody[3]//tr/td[2]", 'Test A (' . $ABTestName . ')');
171 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']/tbody[3]/tr[3]//td[2]", 'Test subject ' . $MailingSubject . ' for A');
172 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']//tbody//tr[@ng-controller='ViewRecipCtrl']//td/div", "Include: " . $groupName);
d1a27213 173
174 ////check value for Mailing B
2ae100d8 175 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']/tbody[3]//tr//td[3]", 'Test B (' . $ABTestName . ')');
176 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']/tbody[3]/tr[3]//td[3]", 'Test subject ' . $MailingSubject . ' for B');
d1a27213 177
178 //check value for Mailing Final
2ae100d8 179 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']/tbody[3]//tr//td[4]", 'Final (' . $ABTestName . ')');
82647609 180 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']/tbody[3]/tr[3]//td[4]", 'Test subject ' . $MailingSubject . ' for A');
2ae100d8 181 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']//tbody//tr[@ng-controller='ViewRecipCtrl']//td/div", "Include: " . $groupName);
d1a27213 182 }
183
184 public function testWithDifferentFrom() {
185 $this->webtestLogin();
186
187 //----do create test mailing group
188 $this->openCiviPage("group/add", "reset=1", "_qf_Edit_upload");
189
190 // make group name
191 $groupName = 'group_' . substr(sha1(rand()), 0, 7);
192
193 // fill group name
194 $this->type("title", $groupName);
195
196 // fill description
197 $this->type("description", "New mailing group for Webtest");
198
199 // enable Mailing List
200 $this->click("group_type[2]");
201
202 // select Visibility as Public Pages
203 $this->select("visibility", "value=Public Pages");
204
205 // Clicking save.
206 $this->clickLink("_qf_Edit_upload");
207
208 // Is status message correct?
209 $this->waitForText('crm-notification-container', "The Group '$groupName' has been saved.");
210
211 // no. of user to add into group
212 $totalUser = 10;
213
214 //---- create mailing contact and add to mailing Group
82647609 215 for ($i = 1; $i <= $totalUser; $i++) {
d1a27213 216 $firstName = substr(sha1(rand()), 0, 7);
217 $this->webtestAddContact($firstName, "Mailson", "mailino$firstName@mailson.co.in");
218
219 // Get contact id from url.
220 $contactId = $this->urlArg('cid');
221
222 // go to group tab and add to mailing group
223 $this->click("css=li#tab_group a");
224 $this->waitForElementPresent("_qf_GroupContact_next");
225 $this->select("group_id", "$groupName");
226 $this->clickLink("_qf_GroupContact_next", "_qf_GroupContact_next", FALSE);
227 }
228 // configure default mail-box
229 $this->setupDefaultMailbox();
230
231 // configure new Form
232 $this->openCiviPage("admin/options/from_email_address", "reset=1");
233 $this->waitForElementPresent("xpath=//div[@class='action-link']/a/span[contains(text(), 'Add From Email Address')]");
234 $this->click("xpath=//div[@class='action-link']/a/span[contains(text(), 'Add From Email Address')]");
82647609 235 $this->waitForAjaxContent();
d1a27213 236
237 // make Form Email address
238 $formEmailAddressA = 'ABMailing_' . substr(sha1(rand()), 0, 7);
82647609 239 $aEmailID = '"' . $formEmailAddressA . '" <' . $formEmailAddressA . '@abtest.org>';
f13a7d55 240 $this->type("xpath=//input[@name='label']", "$aEmailID");
241 $this->click("xpath=//button/span[text()='Save']");
d1a27213 242
82647609 243 // make Form Email address
d1a27213 244 $this->click("xpath=//div[@class='action-link']/a/span[contains(text(), 'Add From Email Address')]");
82647609 245 $this->waitForAjaxContent();
d1a27213 246 $formEmailAddressB = 'ABMailing_' . substr(sha1(rand()), 0, 7);
4961a013 247 $bEmailID = '"' . $formEmailAddressB . '" <' . $formEmailAddressB . '@abtest.org>';
f13a7d55 248 $this->type("xpath=//input[@name='label']", "$bEmailID");
249 $this->click("xpath=//button/span[text()='Save']");
d1a27213 250
f13a7d55 251 $this->openCiviPage("a/#/abtest/new", NULL, "xpath=//div[@class='crm-wizard-buttons']");
252 $this->waitForElementPresent("xpath=//input[@name='abName']");
d1a27213 253
82647609 254 $ABTestName = substr(sha1(rand()), 0, 7) . "ABTestName";
f13a7d55 255 $this->type("xpath=//input[@name='abName']", "$ABTestName");
d1a27213 256
f13a7d55 257 $this->click("xpath=//input[@value='from']");
d1a27213 258
f13a7d55 259 //click on next
260 $this->click("//button[@ng-click='crmUiWizardCtrl.next()']");
d1a27213 261
f13a7d55 262 // Add the test mailing group
d1a27213 263 $this->select2("s2id_crmUiId_13", $groupName, TRUE);
264
82647609 265 //click on next
f13a7d55 266 $this->click("//button[@ng-click='crmUiWizardCtrl.next()']");
267 $this->waitForElementPresent("xpath=//input[@name='subject']");
d1a27213 268
82647609 269 //-------Compose Mail----------
d1a27213 270
271 // fill subject for mailing
272 $MailingSubject = substr(sha1(rand()), 0, 7);
273 $this->type("xpath=//input[@name='subject']", "Test subject {$MailingSubject} for webtest");
274 $this->waitForElementPresent("xpath=//div[@id='s2id_crmUiId_20']");
275
276 // choose form email address for A
277 $this->select2("s2id_crmUiId_20", $aEmailID);
278
279 // choose form email address for B
280 $this->select2("s2id_crmUiId_21", $bEmailID);
281
282 // HTML format message
283 $HTMLMessage = "This is HTML formatted content for Mailing {$MailingSubject} Webtest.";
284 $this->fillRichTextField("crmUiId_1", $HTMLMessage);
285
286 $this->click("xpath=//div[@class='preview-popup']//a[text()='Preview as HTML']");
287 $this->waitForTextPresent($HTMLMessage);
288 $this->waitForAjaxContent();
289 $this->click("xpath=//button[@title='Close']");
290
291 // Open Plain-text Format pane and type text format msg
292 $this->click("//div[text()='Plain Text']");
293 $this->type("xpath=//*[@name='body_text']", "This is text formatted content for Mailing {$MailingSubject} Webtest.");
294
295 $this->click("xpath=//div[@class='preview-popup']//a[text()='Preview as Plain Text']");
296 $this->waitForTextPresent("This is text formatted content for Mailing {$MailingSubject} Webtest.");
297 $this->waitForAjaxContent();
298 $this->click("xpath=//button[@title='Close']");
299
300 // click next with default settings
301 $this->click("xpath=//div[@class='crm-wizard-buttons']/button[text()='Next']");
302
303 // click next with nominal content
304 $this->click("xpath=//center/a/div[text()='Submit Mailing']");
305
306 $this->waitForElementPresent("xpath=//button[text()='Select as Final']");
307 $this->click("xpath=//button[text()='Select as Final']");
308 $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Submit final mailing']");
309 $this->click("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Submit final mailing']");
310
311 //----------end New Mailing-------------
312
313 $this->waitForAjaxContent();
314
315 //check redirected page to Scheduled and Sent Mailings and verify for mailing name
316 $this->openCiviPage("mailing/browse/scheduled", "reset=1&scheduled=true");
317 $this->waitForTextPresent("Find Mailings");
318
319 //--------- mail delivery verification---------
320
321 // click report link of created mailing
322 $this->clickLink("xpath=//table//tbody/tr[td[1]/text()='Final ($ABTestName)']/descendant::a[text()='Report']");
323
324 // directly send schedule mailing -- not working right now
325 $this->openCiviPage("mailing/queue", "reset=1");
326
327 //click report link of created mailing
328 $this->clickLink("xpath=//table//tbody/tr[td[1]/text()='Final ($ABTestName)']/descendant::a[text()='Report']");
329
330 //get actual number of user for mailing
4961a013 331 $mailedUser = round($totalUser * ($totalUser / 100));
d1a27213 332
333 //---- check for delivery detail--
82647609 334 $this->waitForElementPresent("xpath=//table[@class='crm-mailing-ab-table']/tbody/tr//td//a[text()=" . $mailedUser . "]");
d1a27213 335 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']/tbody/tr//td//a[2]", "$mailedUser");
336 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']//tbody//tr//td/span", 'Complete');
337
338 //check value for Mailing A
82647609 339 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']/tbody[3]//tr/td[2]", 'Test A (' . $ABTestName . ')');
d1a27213 340 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']/tbody[3]/tr[2]/td[2]", "$aEmailID");
82647609 341 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']/tbody[3]/tr[3]//td[2]", 'Test subject ' . $MailingSubject . ' for webtest');
342 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']//tbody//tr[@ng-controller='ViewRecipCtrl']//td/div", "Include: " . $groupName);
d1a27213 343
344 //check value for Mailing B
82647609 345 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']/tbody[3]//tr//td[3]", 'Test B (' . $ABTestName . ')');
d1a27213 346 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']/tbody[3]/tr[2]/td[3]", "$bEmailID");
82647609 347 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']/tbody[3]/tr[3]//td[3]", 'Test subject ' . $MailingSubject . ' for webtest');
d1a27213 348
349 //check value for Mailing Final
82647609 350 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']/tbody[3]//tr//td[4]", 'Final (' . $ABTestName . ')');
d1a27213 351 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']/tbody[3]/tr[2]/td[4]", "$aEmailID");
82647609 352 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']/tbody[3]/tr[3]//td[4]", 'Test subject ' . $MailingSubject . ' for webtest');
353 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']//tbody//tr[@ng-controller='ViewRecipCtrl']//td/div", "Include: " . $groupName);
d1a27213 354 }
355
356 public function testWithDifferentABMailing() {
357 $this->webtestLogin();
358
359 //----do create test mailing group
360 $this->openCiviPage("group/add", "reset=1", "_qf_Edit_upload");
361
362 // make group name
363 $groupName = 'group_' . substr(sha1(rand()), 0, 7);
364
365 // fill group name
366 $this->type("title", $groupName);
367
368 // fill description
369 $this->type("description", "New mailing group for Webtest");
370
371 // enable Mailing List
372 $this->click("group_type[2]");
373
374 // select Visibility as Public Pages
375 $this->select("visibility", "value=Public Pages");
376
377 // Clicking save.
378 $this->clickLink("_qf_Edit_upload");
379
380 // Is status message correct?
381 $this->waitForText('crm-notification-container', "The Group '$groupName' has been saved.");
382
383 // no. of user to add into group
384 $totalUser = 10;
385
386 //---- create mailing contact and add to mailing Group
82647609 387 for ($i = 1; $i <= $totalUser; $i++) {
d1a27213 388 $firstName = substr(sha1(rand()), 0, 7);
389 $this->webtestAddContact($firstName, "Mailson", "mailino$firstName@mailson.co.in");
390
391 // Get contact id from url.
392 $contactId = $this->urlArg('cid');
393
394 // go to group tab and add to mailing group
395 $this->click("css=li#tab_group a");
396 $this->waitForElementPresent("_qf_GroupContact_next");
397 $this->select("group_id", "$groupName");
398 $this->clickLink("_qf_GroupContact_next", "_qf_GroupContact_next", FALSE);
399 }
400 // configure default mail-box
401 $this->setupDefaultMailbox();
402
403 $this->openCiviPage("a/#/abtest/new", NULL, "xpath=//div[@class='crm-wizard-buttons']");
404 $this->waitForElementPresent("xpath=//input[@name='abName']");
405
406 $ABTestName = substr(sha1(rand()), 0, 7) . "ABTestName";
407 $this->type("xpath=//input[@name='abName']", "$ABTestName");
408
409 $this->click("xpath=//input[@value='full_email']");
410
411 //click on next
412 $this->click("//button[@ng-click='crmUiWizardCtrl.next()']");
413
414 // Add the test mailing group
415 $this->select2("s2id_crmUiId_13", $groupName, TRUE);
416
417 //click on next
418 $this->click("//button[@ng-click='crmUiWizardCtrl.next()']");
419 $this->waitForElementPresent("xpath=//input[@name='subjectA']");
420
421 //-------Compose A----------
422
423 // fill subject for mailing
424 $AMailingSubject = substr(sha1(rand()), 0, 7);
425 $this->type("xpath=//input[@name='subjectA']", "Test subject {$AMailingSubject} for Webtest");
426
427 // HTML format message
428 $AHTMLMessage = "This is HTML formatted content for Mailing {$AMailingSubject} Webtest.";
429 $this->fillRichTextField("crmUiId_19", $AHTMLMessage);
430
431 $this->click("xpath=//div[@class='preview-popup']//a[text()='Preview as HTML']");
432 $this->waitForTextPresent($AHTMLMessage);
433 $this->waitForAjaxContent();
434 $this->click("xpath=//button[@title='Close']");
435
436 // Open Plain-text Format pane and type text format msg
437 $this->click("//div[text()='Plain Text']");
438 $this->type("xpath=//*[@name='body_text']", "This is text formatted content for Mailing {$AMailingSubject} Webtest.");
439
440 $this->click("xpath=//div[@class='preview-popup']//a[text()='Preview as Plain Text']");
441 $this->waitForTextPresent("This is text formatted content for Mailing {$AMailingSubject} Webtest.");
442 $this->waitForAjaxContent();
443 $this->click("xpath=//button[@title='Close']");
444
445 // click next with default settings
446 $this->click("xpath=//div[@class='crm-wizard-buttons']/button[text()='Next']");
447 $this->waitForElementPresent("xpath=//input[@name='subjectB']");
448
449 //-------Compose B----------
450
451 // fill subject for mailing
452 $BMailingSubject = substr(sha1(rand()), 0, 7);
453 $this->type("xpath=//input[@name='subjectB']", "Test subject {$BMailingSubject} for Webtest");
454 $this->waitForElementPresent("xpath=//div[@id='tab-mailingB']//div[text()='Plain Text']");
455
456 // HTML format message
457 $BHTMLMessage = "This is HTML formatted content for Mailing {$BMailingSubject} Webtest.";
458 $this->fillRichTextField("crmUiId_28", $BHTMLMessage);
459
460 $this->click("xpath=//div[@class='preview-popup']//a[text()='Preview as HTML']");
461 $this->waitForTextPresent($BHTMLMessage);
462 $this->waitForAjaxContent();
463 $this->click("xpath=//button[@title='Close']");
464
465 // Open Plain-text Format pane and type text format msg
466 $this->click("xpath=//div[@id='tab-mailingB']//div[text()='Plain Text']");
467 $this->type("xpath=//div[@id='tab-mailingB']//*[@name='body_text']", "This is text formatted content for Mailing {$BMailingSubject} Webtest.");
468
469 $this->click("xpath=//div[@crm-mailing='abtest.mailings.b']//div[@class='preview-popup']//a[text()='Preview as Plain Text']");
470 $this->waitForTextPresent("This is text formatted content for Mailing {$BMailingSubject} Webtest.");
471 $this->waitForAjaxContent();
472 $this->click("xpath=//button[@title='Close']");
473
474 // click next with default settings
475 $this->click("xpath=//div[@class='crm-wizard-buttons']/button[text()='Next']");
476
477 // click next with nominal content
478 $this->click("xpath=//center/a/div[text()='Submit Mailing']");
479
480 $this->waitForElementPresent("xpath=//button[text()='Select as Final']");
481 $this->click("xpath=//button[text()='Select as Final']");
482 $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Submit final mailing']");
483 $this->click("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Submit final mailing']");
484
485 //----------end New Mailing-------------
486
487 $this->waitForAjaxContent();
488
489 //check redirected page to Scheduled and Sent Mailings and verify for mailing name
490 $this->openCiviPage("mailing/browse/scheduled", "reset=1&scheduled=true");
491 $this->waitForTextPresent("Find Mailings");
492
493 //--------- mail delivery verification---------
494
495 // click report link of created mailing
496 $this->clickLink("xpath=//table//tbody/tr[td[1]/text()='Final ($ABTestName)']/descendant::a[text()='Report']");
497
498 // directly send schedule mailing -- not working right now
499 $this->openCiviPage("mailing/queue", "reset=1");
500
501 //click report link of created mailing
502 $this->clickLink("xpath=//table//tbody/tr[td[1]/text()='Final ($ABTestName)']/descendant::a[text()='Report']");
503
504 //get actual number of user for mailing
4961a013 505 $mailedUser = round($totalUser * ($totalUser / 100));
d1a27213 506
507 //---- check for delivery detail--
82647609 508 $this->waitForElementPresent("xpath=//table[@class='crm-mailing-ab-table']/tbody/tr//td//a[text()=" . $mailedUser . "]");
d1a27213 509 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']/tbody/tr//td//a[2]", "$mailedUser");
510 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']//tbody//tr//td/span", 'Complete');
511
512 //check value for Mailing A
82647609 513 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']/tbody[3]//tr/td[2]", 'Test A (' . $ABTestName . ')');
514 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']/tbody[3]/tr[3]//td[2]", 'Test subject ' . $AMailingSubject . ' for Webtest');
515 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']//tbody//tr[@ng-controller='ViewRecipCtrl']//td/div", "Include: " . $groupName);
d1a27213 516
517 //check value for Mailing B
82647609 518 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']/tbody[3]//tr//td[3]", 'Test B (' . $ABTestName . ')');
519 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']/tbody[3]/tr[3]//td[3]", 'Test subject ' . $BMailingSubject . ' for Webtest');
d1a27213 520
521 //check value for Mailing Final
2ae100d8 522 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']/tbody[3]//tr//td[4]", 'Final (' . $ABTestName . ')');
523 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']/tbody[3]/tr[3]//td[4]", 'Test subject ' . $AMailingSubject . ' for Webtest');
524 $this->assertElementContainsText("xpath=//table[@class='crm-mailing-ab-table']//tbody//tr[@ng-controller='ViewRecipCtrl']//td/div", "Include: " . $groupName);
d1a27213 525 }
82647609 526
527}