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_Mailing_AddNewMailingComponentTest
extends CiviSeleniumTestCase
{
30 protected function setUp() {
34 function testHeaderAdd() {
35 $this->webtestLogin();
37 $this->openCiviPage("admin/component", "action=add&reset=1");
39 // fill component name.
40 $componentName = 'ComponentName_' . substr(sha1(rand()), 0, 7);
41 $this->type("name", $componentName);
43 // fill component type
44 $this->click("component_type");
45 $this->select("component_type", "value=Header");
48 $subject = "This is subject for New Mailing Component.";
49 $this->type("subject", $subject);
52 $txtMsg = "This is Header Text Message";
53 $this->type("body_text", $txtMsg);
56 $htmlMsg = "This is Header HTML Message";
57 $this->type("body_html", $htmlMsg);
58 $this->click("is_default");
61 $this->click("_qf_Component_next");
62 $this->waitForPageToLoad($this->getTimeoutMsec());
64 // Is status message correct.
65 $this->waitForText('crm-notification-container', "The mailing component '$componentName' has been saved.");
68 $this->assertTrue($this->isElementPresent("xpath=//table/tbody//tr/td[text()='{$componentName}']/../td[2][text()='Header']/../td[3][text()='{$subject}']/../td[4][text()='{$txtMsg}']/../td[5][text()='{$htmlMsg}']"), "The row doesn't consists of proper component details");
71 function testFooterAdd() {
72 $this->webtestLogin();
74 $this->openCiviPage("admin/component", "action=add&reset=1");
76 // fill component name.
77 $componentName = 'ComponentName_' . substr(sha1(rand()), 0, 7);
78 $this->type("name", $componentName);
80 // fill component type
81 $this->click("component_type");
82 $this->select("component_type", "value=Footer");
85 $subject = "This is subject for New Mailing Component.";
86 $this->type("subject", $subject);
89 $txtMsg = "This is Footer Text Message";
90 $this->type("body_text", $txtMsg);
93 $htmlMsg = "This is Footer HTML Message";
94 $this->type("body_html", $htmlMsg);
95 $this->click("is_default");
98 $this->click("_qf_Component_next");
99 $this->waitForPageToLoad($this->getTimeoutMsec());
101 // Is status message correct.
102 $this->waitForText('crm-notification-container', "The mailing component '$componentName' has been saved.");
105 $this->assertTrue($this->isElementPresent("xpath=//table/tbody//tr/td[text()='{$componentName}']/../td[2][text()='Footer']/../td[3][text()='{$subject}']/../td[4][text()='{$txtMsg}']/../td[5][text()='{$htmlMsg}']"), "The row doesn't consists of proper component details");
108 function testAutomatedAdd() {
109 $this->webtestLogin();
111 $this->openCiviPage("admin/component", "action=add&reset=1");
113 // fill component name.
114 $componentName = 'ComponentName_' . substr(sha1(rand()), 0, 7);
115 $this->type("name", $componentName);
117 // fill component type
118 $this->click("component_type");
119 $this->select("component_type", "value=Reply");
122 $subject = "This is subject for New Mailing Component.";
123 $this->type("subject", $subject);
126 $txtMsg = "This is Automated Text Message";
127 $this->type("body_text", $txtMsg);
130 $htmlMsg = "This is Automated HTML Message";
131 $this->type("body_html", $htmlMsg);
132 $this->click("is_default");
135 $this->click("_qf_Component_next");
136 $this->waitForPageToLoad($this->getTimeoutMsec());
138 // Is status message correct.
139 $this->waitForText('crm-notification-container', "The mailing component '$componentName' has been saved.");
142 $this->assertTrue($this->isElementPresent("xpath=//table/tbody//tr/td[text()='{$componentName}']/../td[2][text()='Reply']/../td[3][text()='{$subject}']/../td[4][text()='{$txtMsg}']/../td[5][text()='{$htmlMsg}']"), "The row doesn't consists of proper component details");