3 * Copyright (C) 2008 Alain Peyrat <aljeux@free.fr>
4 * Copyright (C) 2009 - 2010 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 CreateTracker extends FForge_SeleniumTestCase
49 function testSimpleCreate()
51 $this->populateStandardTemplate('trackers');
54 // Test: Create a simple bug report (Message1/Text1).
55 $this->click("link=Tracker");
56 $this->waitForPageToLoad("30000");
57 $this->assertTrue($this->isTextPresent("Bugs"));
58 $this->assertTrue($this->isTextPresent("Support"));
59 $this->assertTrue($this->isTextPresent("Patches"));
60 $this->assertTrue($this->isTextPresent("Feature Requests"));
61 $this->click("link=Bugs");
62 $this->waitForPageToLoad("30000");
63 $this->click("//a[contains(@href, '".ROOT. "/tracker/admin/')]");
64 $this->waitForPageToLoad("30000");
65 $this->click("link=Manage Custom Fields");
66 $this->waitForPageToLoad("30000");
67 $this->type("name", "URL");
68 $this->type("alias", "url");
69 $this->click("//input[@name='field_type' and @value='4']");
70 $this->click("post_changes");
71 $this->waitForPageToLoad("30000");
72 $this->click("link=Submit New");
73 $this->waitForPageToLoad("30000");
74 $this->type("summary", "Summary1");
75 $this->type("details", "Description1");
76 $this->click("//form[@id='trackeraddform']//input[@type='submit']");
77 $this->waitForPageToLoad("30000");
78 $this->assertTrue($this->isTextPresent("Summary1"));
79 $this->click("link=Summary1");
80 $this->waitForPageToLoad("30000");
81 $this->assertTrue($this->isTextPresent(""));
82 $this->assertTrue($this->isTextPresent("Description1"));
84 // Test: Adding a comment and checking that it is recorded.
85 $this->type("details", 'This is comment 1');
86 $this->clickAndWait("submit");
87 $this->clickAndWait("link=Summary1");
88 $this->assertTextPresent('This is comment 1');
90 // Test: Adding a second comment and checking that it is recorded.
91 $this->type("details", 'Comment 2 \n added');
92 $this->clickAndWait("submit");
93 $this->clickAndWait("link=Summary1");
94 $this->assertTextPresent('Comment 2 \n added');
95 $this->assertTextPresent("This is comment 1");
97 // Test: Adding another comment (chars) and checking that it is recorded.
98 $this->type("details", "This & été");
99 $this->clickAndWait("submit");
100 $this->clickAndWait("link=Summary1");
101 $this->assertTextPresent("This & été");
103 // Test: Updating the URL extra field and checking that it is recorded.
104 $this->type("//form[@id='trackermodform']//input[@type='text']", "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("//form[@id='trackermodform']//input[@type='text']"));
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->populateStandardTemplate('trackers');
129 // Testing extra-fields
130 $this->click("link=Tracker");
131 $this->waitForPageToLoad("30000");
132 $this->click("link=Bugs");
133 $this->waitForPageToLoad("30000");
134 $this->click("//a[contains(@href, '".ROOT. "/tracker/admin/')]");
135 $this->waitForPageToLoad("30000");
136 $this->click("link=Manage Custom Fields");
137 $this->waitForPageToLoad("30000");
138 $this->type("name", "Number");
139 $this->type("alias", "number");
140 $this->click("field_type");
141 $this->click("post_changes");
142 $this->waitForPageToLoad("30000");
143 $this->click("//tr[@id='field-number']/td[4]/a[1]");
144 $this->waitForPageToLoad("30000");
145 $this->type("name", "1");
146 $this->clickAndWait("post_changes");
147 $this->assertTextPresent("Element inserted");
148 $this->type("name", "2");
149 $this->clickAndWait("post_changes");
150 $this->assertTextPresent("Element inserted");
152 // Testing [#3609]: Select Box does not accept 0 as choice
153 $this->type("name", "0");
154 $this->click("post_changes");
155 $this->waitForPageToLoad("30000");
156 $this->assertTrue($this->isTextPresent("Element inserted"));
158 // Testing [#3649]: 0 not accepted when modifying a select list value
159 $this->click("link=Manage Custom Fields");
160 $this->waitForPageToLoad("30000");
161 $this->click("//tr[@id='field-number']/td[3]/a[5]");
162 $this->waitForPageToLoad("30000");
163 $this->type("name", "10");
164 $this->click("post_changes");
165 $this->waitForPageToLoad("30000");
166 $this->click("//tr[@id='field-number']/td[3]/a[5]");
167 $this->waitForPageToLoad("30000");
168 $this->type("name", "0");
169 $this->click("post_changes");
170 $this->waitForPageToLoad("30000");
171 $this->assertTrue($this->isTextPresent("Element updated"));
174 function testCreateAndDeleteNewTracker()
176 $this->populateStandardTemplate('trackers');
179 // Create a new tracker and delete it after.
180 $this->click("link=Tracker");
181 $this->waitForPageToLoad("30000");
182 $this->click("//a[contains(@href,'".ROOT."/tracker/admin/')]");
183 $this->waitForPageToLoad("30000");
184 $this->type("name", "newTracker");
185 $this->type("description", "This is a new tracker");
186 $this->click("post_changes");
187 $this->waitForPageToLoad("30000");
188 $this->assertTrue($this->isTextPresent("Tracker created successfully"));
189 $this->assertTrue($this->isTextPresent("newTracker"));
190 $this->assertTrue($this->isTextPresent("This is a new tracker"));
191 $this->click("link=newTracker");
192 $this->waitForPageToLoad("30000");
193 $this->click("link=Delete");
194 $this->waitForPageToLoad("30000");
195 $this->click("sure");
196 $this->click("really_sure");
197 $this->click("post_changes");
198 $this->waitForPageToLoad("30000");
199 $this->assertTrue($this->isTextPresent("Successfully Deleted."));
200 $this->assertFalse($this->isTextPresent("newTracker"));
201 $this->assertFalse($this->isTextPresent("This is a new tracker"));
207 // c-file-style: "bsd"