3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
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';
30 * Class WebTest_Mailing_AddNewMailingComponentTest
32 class WebTest_Mailing_AddNewMailingComponentTest
extends CiviSeleniumTestCase
{
34 protected function setUp() {
38 public function testHeaderAdd() {
39 $this->webtestLogin();
41 $this->openCiviPage("admin/component", "action=add&reset=1");
43 // fill component name.
44 $componentName = 'ComponentName_' . substr(sha1(rand()), 0, 7);
45 $this->type("name", $componentName);
47 // fill component type
48 $this->click("component_type");
49 $this->select("component_type", "value=Header");
52 $subject = "This is subject for New Mailing Component.";
53 $this->type("subject", $subject);
56 $txtMsg = "This is Header Text Message";
57 $this->type("body_text", $txtMsg);
60 $htmlMsg = "This is Header HTML Message";
61 $this->type("body_html", $htmlMsg);
62 $this->click("is_default");
65 $this->click("_qf_Component_next");
66 $this->waitForPageToLoad($this->getTimeoutMsec());
68 // Is status message correct.
69 $this->waitForText('crm-notification-container', "The mailing component '$componentName' has been saved.");
72 $this->assertTrue($this->isElementPresent("xpath=//table/tbody//tr/td/div[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");
75 public function testFooterAdd() {
76 $this->webtestLogin();
78 $this->openCiviPage("admin/component", "action=add&reset=1");
80 // fill component name.
81 $componentName = 'ComponentName_' . substr(sha1(rand()), 0, 7);
82 $this->type("name", $componentName);
84 // fill component type
85 $this->click("component_type");
86 $this->select("component_type", "value=Footer");
89 $subject = "This is subject for New Mailing Component.";
90 $this->type("subject", $subject);
93 $txtMsg = "This is Footer Text Message";
94 $this->type("body_text", $txtMsg);
97 $htmlMsg = "This is Footer HTML Message";
98 $this->type("body_html", $htmlMsg);
99 $this->click("is_default");
102 $this->click("_qf_Component_next");
103 $this->waitForPageToLoad($this->getTimeoutMsec());
105 // Is status message correct.
106 $this->waitForText('crm-notification-container', "The mailing component '$componentName' has been saved.");
109 $this->assertTrue($this->isElementPresent("xpath=//table/tbody//tr/td/div[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");
112 public function testAutomatedAdd() {
113 $this->webtestLogin();
115 $this->openCiviPage("admin/component", "action=add&reset=1");
117 // fill component name.
118 $componentName = 'ComponentName_' . substr(sha1(rand()), 0, 7);
119 $this->type("name", $componentName);
121 // fill component type
122 $this->click("component_type");
123 $this->select("component_type", "value=Reply");
126 $subject = "This is subject for New Mailing Component.";
127 $this->type("subject", $subject);
130 $txtMsg = "This is Automated Text Message";
131 $this->type("body_text", $txtMsg);
134 $htmlMsg = "This is Automated HTML Message";
135 $this->type("body_html", $htmlMsg);
136 $this->click("is_default");
139 $this->click("_qf_Component_next");
140 $this->waitForPageToLoad($this->getTimeoutMsec());
142 // Is status message correct.
143 $this->waitForText('crm-notification-container', "The mailing component '$componentName' has been saved.");
146 $this->assertTrue($this->isElementPresent("xpath=//table/tbody//tr/td/div[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");