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 along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * Standard Alcatel-Lucent disclaimer for contributing to open source
26 * "The test suite ("Contribution") has not been tested and/or
27 * validated for release as or in products, combinations with products or
28 * other commercial use. Any use of the Contribution is entirely made at
29 * the user's own responsibility and the user can not rely on any features,
30 * functionalities or performances Alcatel-Lucent has attributed to the
33 * THE CONTRIBUTION BY ALCATEL-LUCENT IS PROVIDED AS IS, WITHOUT WARRANTY
34 * OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
35 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, COMPLIANCE,
36 * NON-INTERFERENCE AND/OR INTERWORKING WITH THE SOFTWARE TO WHICH THE
37 * CONTRIBUTION HAS BEEN MADE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
38 * ALCATEL-LUCENT BE LIABLE FOR ANY DAMAGES OR OTHER LIABLITY, WHETHER IN
39 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
40 * CONTRIBUTION OR THE USE OR OTHER DEALINGS IN THE CONTRIBUTION, WHETHER
41 * TOGETHER WITH THE SOFTWARE TO WHICH THE CONTRIBUTION RELATES OR ON A STAND
45 require_once dirname(dirname(__FILE__)).'/Testing/SeleniumGforge.php';
47 class CreateNews extends FForge_SeleniumTestCase
49 function testMonitorProjectNews()
51 $this->populateStandardTemplate(array());
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->assertTextPresent("First news");
92 // $this->assertTextPresent("Second news");
94 // Check modification of a news.
95 $this->clickAndWait("link=News");
96 $this->click("//a[contains(@href, '" . ROOT . "/news/admin/?group_id=6')]");
97 $this->waitForPageToLoad("30000");
98 $this->clickAndWait("link=Second news");
99 $this->type("details", "This is another text (corrected)");
100 $this->clickAndWait("submit");
101 $this->clickAndWait("link=Second news");
102 $this->clickAndWait("link=News");
103 $this->clickAndWait("link=Second news");
104 $this->assertTextPresent("This is another text (corrected)");
105 $this->clickAndWait("link=News");
106 $this->clickAndWait("link=Submit");
107 $this->type("summary", "Test3");
108 $this->type("details", "Special ' chars \"");
109 $this->clickAndWait("submit");
110 $this->clickAndWait("link=News");
111 $this->clickAndWait("link=Test3");
112 $this->assertTextPresent("Special ' chars \"");
113 $this->clickAndWait("link=News");
114 $this->click("//a[contains(@href, '". ROOT . "/news/admin/?group_id=6')]");
115 $this->waitForPageToLoad("30000");
116 $this->clickAndWait("link=Test3");
117 $this->click("//form[@id='newsadminform']//input[@name='status' and @value=4]");
118 $this->clickAndWait("submit");
123 * Test multilines news formated in HTML.
125 function testAcBug4100()
127 // Create a simple news.
129 $this->clickAndWait("link=News");
130 $this->clickAndWait("link=Submit");
131 $this->type("summary", "Multi line news");
132 $this->type("details", "<p>line1</p><p>line2</p><p>line3</p><br />hello<p>line5</p>\n");
133 $this->clickAndWait("submit");
134 $this->clickAndWait("link=News");
135 $this->assertTextPresent("Multi line news");
136 $this->assertTextPresent("line1");
137 $this->assertTextPresent("line2");
138 $this->assertTextPresent("line3");
139 $this->assertTextPresent("hello");
140 // $this->assertFalse($this->isTextPresent("line5"));
141 $this->clickAndWait("link=Multi line news");
142 $this->assertTextPresent("Multi line news");
143 $this->assertTextPresent("line1");
144 $this->assertTextPresent("line2");
145 $this->assertTextPresent("line3");
146 $this->assertTextPresent("hello");
147 $this->assertTextPresent("line5");
151 * Test multiple post of the news (reload).
152 * Test skipped due to manual intervention required.
154 function skiptestPreventMultiplePost()
156 // Create a simple news.
159 $this->clickAndWait("link=News");
160 $this->clickAndWait("link=Submit");
161 $this->type("summary", "My ABC news");
162 $this->type("details", "hello DEF with a long detail.\n");
163 $this->clickAndWait("submit");
164 $this->assertTextPresent("News Added.");
165 $this->chooseOkOnNextConfirmation();
166 // Problem, a confirmation window is displayed and I didn't found
167 // the way to automatically click on the Ok button.
169 $this->waitForPageToLoad("30000");
170 $this->assertTextPresent("Error - double submit");
177 // c-file-style: "bsd"