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 CreateTracker extends FForge_SeleniumTestCase
50 function testSimpleCreate()
52 $this->createProject('ProjectA');
54 // Test: Create a simple bug report (Message1/Text1).
56 $this->click("link=ProjectA");
57 $this->waitForPageToLoad("30000");
58 $this->click("link=Tracker");
59 $this->waitForPageToLoad("30000");
60 $this->assertTrue($this->isTextPresent("Bugs"));
61 $this->assertTrue($this->isTextPresent("Support"));
62 $this->assertTrue($this->isTextPresent("Patches"));
63 $this->assertTrue($this->isTextPresent("Feature Requests"));
64 $this->click("link=Bugs");
65 $this->waitForPageToLoad("30000");
66 $this->click("link=Submit New");
67 $this->waitForPageToLoad("30000");
68 $this->type("summary", "Summary1");
69 $this->type("details", "Description1");
70 $this->click("document.forms[2].submit[1]");
71 $this->waitForPageToLoad("30000");
72 $this->assertTrue($this->isTextPresent("Summary1"));
73 $this->click("link=Summary1");
74 $this->waitForPageToLoad("30000");
75 $this->assertTrue($this->isTextPresent(""));
76 $this->assertTrue($this->isTextPresent("Description1"));
78 // Test: Adding a comment and checking that it is recorded.
79 $this->type("details", "This is comment 1");
80 $this->click("submit");
81 $this->waitForPageToLoad("30000");
82 $this->click("link=Summary1");
83 $this->waitForPageToLoad("30000");
84 $this->assertTrue($this->isTextPresent("This is comment 1"));
86 // Test: Adding a second comment and checking that it is recorded.
87 $this->type("details", "Comment 2 added");
88 $this->click("submit");
89 $this->waitForPageToLoad("30000");
90 $this->click("link=Summary1");
91 $this->waitForPageToLoad("30000");
92 $this->assertTrue($this->isTextPresent("Comment 2 added"));
93 $this->assertTrue($this->isTextPresent("This is comment 1"));
95 // Test: Adding another comment (chars) and checking that it is recorded.
96 $this->type("details", "This & été");
97 $this->click("submit");
98 $this->waitForPageToLoad("30000");
99 $this->click("link=Summary1");
100 $this->waitForPageToLoad("30000");
101 $this->assertTrue($this->isTextPresent("This & été"));
103 // Test: Updating the URL extra field and checking that it is recorded.
104 $this->type("extra_fields[8]", "http://google.com/");
105 $this->click("submit");
106 $this->waitForPageToLoad("30000");
107 $this->click("link=Summary1");
108 $this->waitForPageToLoad("30000");
110 $this->assertEquals("http://google.com/", $this->getValue("extra_fields[8]"));
111 } catch (PHPUnit_Framework_AssertionFailedError $e) {
112 array_push($this->verificationErrors, $e->toString());
115 // Test: Updating the priority and checking that it is recorded.
116 $this->select("priority", "label=5 - Highest");
117 $this->click("submit");
118 $this->waitForPageToLoad("30000");
119 $this->assertTrue($this->isTextPresent("5"));
120 $this->click("link=Summary1");
121 $this->waitForPageToLoad("30000");
124 function testExtraFields()
126 $this->createProject('ProjectA');
128 // Testing extra-fields
130 $this->click("link=ProjectA");
131 $this->waitForPageToLoad("30000");
132 $this->click("link=Tracker");
133 $this->waitForPageToLoad("30000");
134 $this->click("link=Bugs");
135 $this->waitForPageToLoad("30000");
136 $this->click("//a[contains(@href, '".BASE. "/tracker/admin/?group_id=6&atid=101')]");
137 $this->waitForPageToLoad("30000");
138 $this->click("link=Manage Custom Fields");
139 $this->waitForPageToLoad("30000");
140 $this->type("name", "Number");
141 $this->type("alias", "number");
142 $this->click("field_type");
143 $this->click("post_changes");
144 $this->waitForPageToLoad("30000");
145 $this->click("//a[contains(@href, '".BASE. "/tracker/admin/index.php?add_opt=1&boxid=22&group_id=6&atid=101')]");
146 $this->waitForPageToLoad("30000");
147 $this->type("name", "1");
148 $this->click("post_changes");
149 $this->waitForPageToLoad("30000");
150 $this->assertTrue($this->isTextPresent("Element inserted"));
151 $this->type("name", "2");
152 $this->click("post_changes");
153 $this->waitForPageToLoad("30000");
154 $this->assertTrue($this->isTextPresent("Element inserted"));
156 // Testing [#3609]: Select Box does not accept 0 as choice
157 $this->type("name", "0");
158 $this->click("post_changes");
159 $this->waitForPageToLoad("30000");
160 $this->assertTrue($this->isTextPresent("Element inserted"));
162 // Testing [#3649]: 0 not accepted when modifying a select list value
163 $this->open(BASE."/tracker/admin/index.php?group_id=6&atid=101&add_extrafield=1");
164 $this->click("//tr[@id='field-number']/td[3]/a[5]");
165 $this->waitForPageToLoad("30000");
166 $this->type("name", "10");
167 $this->click("post_changes");
168 $this->waitForPageToLoad("30000");
169 $this->click("//tr[@id='field-number']/td[3]/a[5]");
170 $this->waitForPageToLoad("30000");
171 $this->type("name", "0");
172 $this->click("post_changes");
173 $this->waitForPageToLoad("30000");
174 $this->assertTrue($this->isTextPresent("Element updated"));
177 function testCreateAndDeleteNewTracker()
179 $this->createProject('ProjectA');
181 // Create a new tracker and delete it after.
183 $this->click("link=ProjectA");
184 $this->waitForPageToLoad("30000");
185 $this->click("link=Tracker");
186 $this->waitForPageToLoad("30000");
187 $this->click("//a[@href='".URL."tracker/admin/?group_id=6']");
188 $this->waitForPageToLoad("30000");
189 $this->type("name", "newTracker");
190 $this->type("description", "This is a new tracker");
191 $this->click("post_changes");
192 $this->waitForPageToLoad("30000");
193 $this->assertTrue($this->isTextPresent("Tracker created successfully"));
194 $this->assertTrue($this->isTextPresent("newTracker"));
195 $this->assertTrue($this->isTextPresent("This is a new tracker"));
196 $this->click("link=newTracker");
197 $this->waitForPageToLoad("30000");
198 $this->click("//a[@href='".URL."tracker/admin/?group_id=6&atid=105']");
199 $this->waitForPageToLoad("30000");
200 $this->click("link=Delete");
201 $this->waitForPageToLoad("30000");
202 $this->click("sure");
203 $this->click("really_sure");
204 $this->click("post_changes");
205 $this->waitForPageToLoad("30000");
206 $this->assertTrue($this->isTextPresent("Successfully Deleted."));
207 $this->assertFalse($this->isTextPresent("newTracker"));
208 $this->assertFalse($this->isTextPresent("This is a new tracker"));