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 CreateForum extends FForge_SeleniumTestCase
50 function testSimplePost()
52 // Create the first message (Message1/Text1).
54 $this->click("link=Forums");
55 $this->waitForPageToLoad("30000");
56 $this->assertFalse($this->isTextPresent("Permission denied."));
57 $this->assertTrue($this->isTextPresent("open-discussion"));
58 $this->click("link=open-discussion");
59 $this->waitForPageToLoad("30000");
60 $this->click("link=Start New Thread");
61 $this->waitForPageToLoad("30000");
62 $this->type("subject", "Message1");
63 $this->type("body", "Text1");
64 $this->click("submit");
65 $this->waitForPageToLoad("30000");
66 $this->assertTrue($this->isTextPresent("Message Posted Successfully"));
67 $this->click("link=Forums");
68 $this->waitForPageToLoad("30000");
69 $this->assertTrue($this->isTextPresent("open-discussion"));
70 $this->click("link=open-discussion");
71 $this->waitForPageToLoad("30000");
72 $this->assertTrue($this->isTextPresent("Message1"));
76 * Simulate a click on the link from a mail.
77 * As the forum is private, the users should be
78 * redirected to the login prompt saying that he has
79 * to login to get access to the message. Once logged,
80 * he should be redirected to the given forum.
82 function testSimpleAccessWhenPrivate()
87 $this->open( ROOT.'/forum/message.php?msg_id=3' );
88 $this->waitForPageToLoad("30000");
89 $this->type("form_loginname", 'admin');
90 $this->type("form_pw", 'myadmin');
91 $this->click("login");
92 $this->waitForPageToLoad("30000");
93 $this->assertTrue($this->isTextPresent("Welcome to Developers"));
97 * Simulate a user non logged that will reply
98 * to a message in a forum. He will be redirected
99 * to the login page, then will reply and then
100 * we check that his reply is present in the thread.
102 function testReplyToMessage()
107 $this->open("/projects/projecta/");
108 $this->click("link=Forums");
109 $this->waitForPageToLoad("30000");
110 $this->click("link=open-discussion");
111 $this->waitForPageToLoad("30000");
112 $this->click("link=Welcome to Open-Discussion");
113 $this->waitForPageToLoad("30000");
114 $this->click("link=[ reply ]");
115 $this->waitForPageToLoad("30000");
116 $this->assertTrue($this->isTextPresent("Cookies must be enabled past this point."));
117 // $this->assertEquals("ACOS Forge - Login", $this->getTitle());
118 $this->type("form_loginname", "admin");
119 $this->type("form_pw", 'myadmin');
120 $this->click("login");
121 $this->waitForPageToLoad("30000");
122 $this->type("body", "Here is my 19823 reply");
123 $this->click("submit");
124 $this->waitForPageToLoad("30000");
125 $this->assertTrue($this->isTextPresent("Message Posted Successfully"));
126 $this->click("link=Welcome to Open-Discussion");
127 $this->waitForPageToLoad("30000");
128 $this->assertTrue($this->isTextPresent("Here is my 19823 reply"));
133 * Verify that it is imposible to use name already used by a mailing list
135 function testEmailAddressNotAlreadyUsed() {
137 $this->click("link=Mailing Lists");
138 $this->waitForPageToLoad("30000");
139 $this->click("//body/div[@id='maindiv']/p[1]/strong/a");
140 $this->waitForPageToLoad("30000");
141 $this->click("link=Add Mailing List");
142 $this->waitForPageToLoad("30000");
143 $this->type("list_name", "toto");
144 $this->type("description", "Toto mailing list");
145 $this->click("submit");
146 $this->waitForPageToLoad("30000");
147 $this->assertTrue($this->isTextPresent("List Added"));
148 $this->click("link=Forums");
149 $this->waitForPageToLoad("30000");
150 $this->click("link=open-discussion");
151 $this->waitForPageToLoad("30000");
152 $this->click("//body/div[@id='maindiv']/p[1]/strong/a[2]");
153 $this->waitForPageToLoad("30000");
154 $this->click("link=Add forum");
155 $this->waitForPageToLoad("30000");
156 $this->type("forum_name", "toto");
157 $this->type("description", "Toto forum");
158 $this->click("submit");
159 $this->waitForPageToLoad("30000");
160 $this->assertTrue($this->isTextPresent("Error: a mailing list with the same email address already exists"));