3 * Copyright (C) 2008 Alain Peyrat <aljeux@free.fr>
4 * Copyright (C) 2009 Alain Peyrat, Alcatel-Lucent
6 * This file is part of FusionForge.
8 * FusionForge is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published
10 * by the Free Software Foundation; either version 2 of the License,
11 * or (at your option) any later version.
13 * FusionForge is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with FusionForge; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
25 * Standard Alcatel-Lucent disclaimer for contributing to open source
27 * "The test suite ("Contribution") has not been tested and/or
28 * validated for release as or in products, combinations with products or
29 * other commercial use. Any use of the Contribution is entirely made at
30 * the user's own responsibility and the user can not rely on any features,
31 * functionalities or performances Alcatel-Lucent has attributed to the
34 * THE CONTRIBUTION BY ALCATEL-LUCENT IS PROVIDED AS IS, WITHOUT WARRANTY
35 * OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
36 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, COMPLIANCE,
37 * NON-INTERFERENCE AND/OR INTERWORKING WITH THE SOFTWARE TO WHICH THE
38 * CONTRIBUTION HAS BEEN MADE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
39 * ALCATEL-LUCENT BE LIABLE FOR ANY DAMAGES OR OTHER LIABLITY, WHETHER IN
40 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
41 * CONTRIBUTION OR THE USE OR OTHER DEALINGS IN THE CONTRIBUTION, WHETHER
42 * TOGETHER WITH THE SOFTWARE TO WHICH THE CONTRIBUTION RELATES OR ON A STAND
46 require_once 'func/Testing/SeleniumGforge.php';
48 class CreateNews extends FForge_SeleniumTestCase
50 function testMyTestCase()
52 $this->createProject('ProjectA');
54 // Create a simple news.
55 $this->click("link=News");
56 $this->waitForPageToLoad("30000");
57 $this->click("link=Submit");
58 $this->waitForPageToLoad("30000");
59 $this->type("summary", "First news");
60 $this->type("details", "This is a simple news.");
61 $this->click("submit");
62 $this->waitForPageToLoad("30000");
63 $this->click("link=News");
64 $this->waitForPageToLoad("30000");
65 $this->assertTrue($this->isTextPresent("First news"));
66 $this->click("link=First news");
67 $this->waitForPageToLoad("30000");
68 $this->assertTrue($this->isTextPresent("First news"));
69 $this->assertTrue($this->isTextPresent("This is a simple news."));
71 // Create a second news.
72 $this->click("link=News");
73 $this->waitForPageToLoad("30000");
74 $this->click("link=Submit");
75 $this->waitForPageToLoad("30000");
76 $this->type("summary", "Second news");
77 $this->type("details", "This is another text");
78 $this->click("submit");
79 $this->waitForPageToLoad("30000");
80 $this->click("link=News");
81 $this->waitForPageToLoad("30000");
82 $this->click("link=Second news");
83 $this->waitForPageToLoad("30000");
84 $this->assertTrue($this->isTextPresent("Second news"));
85 $this->assertTrue($this->isTextPresent("This is another text"));
87 // Check that news are visible in the activity
88 // TODO: Not implemented in gforge-4.6
89 // $this->click("link=Activity");
90 // $this->waitForPageToLoad("30000");
91 // $this->assertTrue($this->isTextPresent("First news"));
92 // $this->assertTrue($this->isTextPresent("Second news"));
94 // Check modification of a news.
95 $this->click("link=News");
96 $this->waitForPageToLoad("30000");
97 $this->click("//a[contains(@href, '" . BASE . "/news/admin/?group_id=6')]");
98 $this->waitForPageToLoad("30000");
99 $this->click("link=Second news");
100 $this->waitForPageToLoad("30000");
101 $this->type("details", "This is another text (corrected)");
102 $this->click("submit");
103 $this->waitForPageToLoad("30000");
104 $this->click("link=Second news");
105 $this->waitForPageToLoad("30000");
106 $this->click("link=News");
107 $this->waitForPageToLoad("30000");
108 $this->click("link=Second news");
109 $this->waitForPageToLoad("30000");
110 $this->assertTrue($this->isTextPresent("This is another text (corrected)"));
111 $this->click("link=News");
112 $this->waitForPageToLoad("30000");
113 $this->click("link=Submit");
114 $this->waitForPageToLoad("30000");
115 $this->type("summary", "Test3");
116 $this->type("details", "Special ' chars \"");
117 $this->click("submit");
118 $this->waitForPageToLoad("30000");
119 $this->click("link=News");
120 $this->waitForPageToLoad("30000");
121 $this->click("link=Test3");
122 $this->waitForPageToLoad("30000");
123 $this->assertTrue($this->isTextPresent("Special ' chars \""));
124 $this->click("link=News");
125 $this->waitForPageToLoad("30000");
126 $this->click("//a[contains(@href, '". BASE . "/news/admin/?group_id=6')]");
127 $this->waitForPageToLoad("30000");
128 $this->click("link=Test3");
129 $this->waitForPageToLoad("30000");
130 $this->click("document.forms[2].status[1]");
131 $this->click("submit");
132 $this->waitForPageToLoad("30000");
137 * Test multilines news formated in HTML.
139 function testAcBug4100()
141 $this->createProject('ProjectA');
143 // Create a simple news.
144 $this->click("link=News");
145 $this->waitForPageToLoad("30000");
146 $this->click("link=Submit");
147 $this->waitForPageToLoad("30000");
148 $this->type("summary", "Multi line news");
149 $this->type("details", "<p>line1</p><p>line2</p><p>line3</p><br />hello<p>line5</p>\n");
150 $this->click("submit");
151 $this->waitForPageToLoad("30000");
152 $this->click("link=News");
153 $this->waitForPageToLoad("30000");
154 $this->assertTrue($this->isTextPresent("Multi line news"));
155 $this->assertTrue($this->isTextPresent("line1"));
156 $this->assertTrue($this->isTextPresent("line2"));
157 $this->assertTrue($this->isTextPresent("line3"));
158 $this->assertTrue($this->isTextPresent("hello"));
159 // $this->assertFalse($this->isTextPresent("line5"));
160 $this->click("link=Multi line news");
161 $this->waitForPageToLoad("30000");
162 $this->assertTrue($this->isTextPresent("Multi line news"));
163 $this->assertTrue($this->isTextPresent("line1"));
164 $this->assertTrue($this->isTextPresent("line2"));
165 $this->assertTrue($this->isTextPresent("line3"));
166 $this->assertTrue($this->isTextPresent("hello"));
167 $this->assertTrue($this->isTextPresent("line5"));
171 * Test multiple post of the news (reload).
172 * Test skipped due to manual intervention required.
174 function skiptestPreventMultiplePost()
176 $this->createProject('ProjectA');
178 // Create a simple news.
179 $this->click("link=News");
180 $this->waitForPageToLoad("30000");
181 $this->click("link=Submit");
182 $this->waitForPageToLoad("30000");
183 $this->type("summary", "My ABC news");
184 $this->type("details", "hello DEF with a long detail.\n");
185 $this->click("submit");
186 $this->waitForPageToLoad("30000");
187 $this->assertTrue($this->isTextPresent("News Added."));
188 $this->chooseOkOnNextConfirmation();
189 // Problem, a confirmation window is displayed and I didn't found
190 // the way to automatically click on the Ok button.
192 $this->waitForPageToLoad("30000");
193 $this->assertTrue($this->isTextPresent("Error - double submit"));