3 * Copyright (C) 2010 Alain Peyrat, Alcatel-Lucent
5 * This file is part of FusionForge.
7 * FusionForge is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published
9 * by the Free Software Foundation; either version 2 of the License,
10 * or (at your option) any later version.
12 * FusionForge is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with FusionForge; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
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
44 require_once 'func/Testing/SeleniumGforge.php';
46 class CreateTask extends FForge_SeleniumTestCase
48 function testcreateTask()
51 $this->createSomeTasks();
52 // $this->browseTasks();
53 $this->setTaskPriority();
54 $this->completeTask();
57 // $this->assignTask();
59 $this->registerEmailAddressForNotification();
60 // $this->createSubproject();
61 // $this->createPrivateSubproject();
62 $this->displayGANTT();
63 //$this->displayActivityReportByDeveloper();
64 //$this->displayActivityReportBySubproject();
72 // Initialize "rep_time_tracking" table
73 $this->click("link=Reporting");
74 $this->waitForPageToLoad("30000");
76 $this->click("link=Initialize / Rebuild Reporting Tables");
77 $this->waitForPageToLoad("30000");
78 $this->click("im_sure");
79 $this->click("submit");
80 $this->waitForPageToLoad("30000");
82 // $this->switchUser('uadmin');
84 $this->waitForPageToLoad("30000");
85 $this->click("link=ProjectA");
86 $this->waitForPageToLoad("30000");
88 $this->click("link=Task Manager");
89 $this->waitForPageToLoad("30000");
90 $this->assertTrue($this->isTextPresent("To Do"));
91 $this->assertTrue($this->isTextPresent("Next Release"));
92 $this->click("link=To Do");
93 $this->waitForPageToLoad("30000");
94 $this->assertTrue($this->isTextPresent("No Matching Tasks found"));
97 function createSomeTasks()
99 // Create a first task
100 $this->click("link=Add task");
101 $this->waitForPageToLoad("30000");
102 $this->type("summary", "Task1: Hello Paris");
103 $this->type("details", "Details: Hello Paris");
104 $this->type("hours", "10");
105 $this->click("//body/div[@id='maindiv']/form/table/tbody/tr[9]/td/input");
106 $this->waitForPageToLoad("30000");
107 $this->assertTrue($this->isTextPresent("Task Created Successfully"));
109 // Create a second task
110 $this->click("link=Add task");
111 $this->waitForPageToLoad("30000");
112 $this->type("summary", "Task2: Hello France");
113 $this->type("details", "Details: Hello France");
114 $this->type("hours", "15");
115 $this->click("//body/div[@id='maindiv']/form/table/tbody/tr[9]/td/input");
116 $this->waitForPageToLoad("30000");
117 $this->assertTrue($this->isTextPresent("Task Created Successfully"));
119 // Create a third task
120 $this->click("link=Add task");
121 $this->waitForPageToLoad("30000");
122 $this->type("summary", "Task3: Hello World");
123 $this->type("details", "Details: Hello World");
124 $this->type("hours", "20");
125 $this->click("//body/div[@id='maindiv']/form/table/tbody/tr[9]/td/input");
126 $this->waitForPageToLoad("30000");
127 $this->assertTrue($this->isTextPresent("Task Created Successfully"));
130 function browseTasks()
132 // Let us check that the 3 tasks appear on the list of tasks
133 $this->click("link=Tasks");
134 $this->waitForPageToLoad("30000");
135 $this->click("link=To Do");
136 $this->waitForPageToLoad("30000");
137 $this->assertTrue($this->isTextPresent("Task1: Hello Paris"));
138 $this->assertTrue($this->isTextPresent("Task2: Hello France"));
139 $this->assertTrue($this->isTextPresent("Task3: Hello World"));
141 // Let us assign tasks to users so that we can filter by assignee
142 $this->click("link=exact:Task1: Hello Paris");
143 $this->waitForPageToLoad("30000");
144 $this->removeSelection("assigned_to[]", "label=None");
145 $this->addSelection("assigned_to[]", "label=ucoredev Lastname");
146 $this->click("submit");
147 $this->waitForPageToLoad("30000");
148 $this->click("link=exact:Task2: Hello France");
149 $this->waitForPageToLoad("30000");
150 $this->removeSelection("assigned_to[]", "label=None");
151 $this->addSelection("assigned_to[]", "label=ucontrib Lastname");
152 $this->click("submit");
153 $this->waitForPageToLoad("30000");
154 $this->click("link=exact:Task3: Hello World");
155 $this->waitForPageToLoad("30000");
156 $this->removeSelection("assigned_to[]", "label=None");
157 $this->addSelection("assigned_to[]", "label=ucontrib Lastname");
158 $this->click("submit");
159 $this->waitForPageToLoad("30000");
161 // There should not be unassigned tasks
162 $this->select("_assigned_to", "label=Unassigned");
163 $this->click("submit");
164 $this->waitForPageToLoad("30000");
165 $this->assertTrue($this->isTextPresent("No Matching Tasks found"));
167 // Tasks 2 and 3 should be assigned to ucontrib
168 $this->select("_assigned_to", "label=ucontrib Lastname");
169 $this->click("submit");
170 $this->waitForPageToLoad("30000");
171 $this->assertTrue($this->isTextPresent("Task2:"));
172 $this->assertTrue($this->isTextPresent("Task3:"));
174 // Task 1 should be assigned to ucoredev
175 $this->select("_assigned_to", "label=ucoredev Lastname");
176 $this->click("submit");
177 $this->waitForPageToLoad("30000");
178 $this->assertTrue($this->isTextPresent("Task1:"));
180 // "Any" should show the 3 tasks
181 $this->select("_assigned_to", "label=Any");
182 $this->click("submit");
183 $this->waitForPageToLoad("30000");
184 $this->assertTrue($this->isTextPresent("Task1:"));
185 $this->assertTrue($this->isTextPresent("Task2:"));
186 $this->assertTrue($this->isTextPresent("Task3:"));
188 // Let use close a task to sort by status
189 $this->click("link=exact:Task1: Hello Paris");
190 $this->waitForPageToLoad("30000");
191 $this->click("status_id");
192 $this->select("status_id", "label=Closed");
193 $this->click("submit");
194 $this->waitForPageToLoad("30000");
197 $this->select("_status", "label=Open");
198 $this->click("submit");
199 $this->waitForPageToLoad("30000");
200 $this->assertTrue($this->isTextPresent("Task2:"));
201 $this->assertTrue($this->isTextPresent("Task3:"));
203 // Select closed tasks
204 $this->select("_status", "label=Closed");
205 $this->click("submit");
206 $this->waitForPageToLoad("30000");
207 $this->assertTrue($this->isTextPresent("Task1:"));
209 // Select "Any" status
210 $this->select("_status", "label=Any");
211 $this->click("submit");
212 $this->waitForPageToLoad("30000");
213 $this->assertTrue($this->isTextPresent("Task1:"));
214 $this->assertTrue($this->isTextPresent("Task2:"));
215 $this->assertTrue($this->isTextPresent("Task3:"));
217 // Let us add categories to sort by category
218 $this->click("link=Admin");
219 $this->waitForPageToLoad("30000");
220 $this->click("link=Add/Edit Categories");
221 $this->waitForPageToLoad("30000");
222 $this->type("name", "mycategory");
223 $this->click("post_changes");
224 $this->waitForPageToLoad("30000");
225 $this->assertTrue($this->isTextPresent("Category Inserted"));
226 $this->type("name", "yourcategory");
227 $this->click("post_changes");
228 $this->waitForPageToLoad("30000");
229 $this->assertTrue($this->isTextPresent("Category Inserted"));
230 $this->assertTrue($this->isTextPresent("mycategory"));
231 $this->assertTrue($this->isTextPresent("yourcategory"));
233 // Set Task1 to mycategory
234 $this->click("link=To Do: Browse tasks");
235 $this->waitForPageToLoad("30000");
236 $this->click("link=exact:Task1: Hello Paris");
237 $this->waitForPageToLoad("30000");
238 $this->select("category_id", "label=mycategory");
239 $this->click("submit");
240 $this->waitForPageToLoad("30000");
242 // Set Task2 to yourcategory
243 $this->click("link=To Do: Browse tasks");
244 $this->waitForPageToLoad("30000");
245 $this->click("link=exact:Task2: Hello France");
246 $this->waitForPageToLoad("30000");
247 $this->select("category_id", "label=yourcategory");
248 $this->click("submit");
249 $this->waitForPageToLoad("30000");
251 // Select "Any" category
252 $this->select("_category_id", "label=Any");
253 $this->click("submit");
254 $this->waitForPageToLoad("30000");
255 $this->select("_order", "label=Task Summary");
256 $this->click("submit");
257 $this->waitForPageToLoad("30000");
258 $this->assertTrue($this->isTextPresent("Task1:"));
259 $this->assertTrue($this->isTextPresent("Task2:"));
260 $this->assertTrue($this->isTextPresent("Task3:"));
262 // Select "mycategory" category
263 $this->select("_category_id", "label=mycategory");
264 $this->click("submit");
265 $this->waitForPageToLoad("30000");
266 $this->assertTrue($this->isTextPresent("Task1:"));
267 $this->assertFalse($this->isTextPresent("Task2:"));
268 $this->assertFalse($this->isTextPresent("Task3:"));
270 // Select "yourcategory" category
271 $this->select("_category_id", "label=yourcategory");
272 $this->click("submit");
273 $this->waitForPageToLoad("30000");
274 $this->assertFalse($this->isTextPresent("Task1:"));
275 $this->assertTrue($this->isTextPresent("Task2:"));
276 $this->assertFalse($this->isTextPresent("Task3:"));
278 // Set Detail view to Detailed
279 $this->click("link=To Do: Browse tasks");
280 $this->waitForPageToLoad("30000");
281 $this->select("_category_id", "label=Any");
282 $this->select("_view", "label=Detailed");
283 $this->click("submit");
284 $this->waitForPageToLoad("30000");
285 $this->assertTrue($this->isTextPresent("Details: Hello Paris"));
286 $this->assertTrue($this->isTextPresent("Details: Hello France"));
287 $this->assertTrue($this->isTextPresent("Details: Hello World"));
289 // Set Detail view to Summary
290 $this->select("_view", "label=Summary");
291 $this->click("submit");
292 $this->waitForPageToLoad("30000");
293 $this->assertFalse($this->isTextPresent("Details: Hello"));
297 function setTaskPriority()
299 // Set the priority of a task
300 $this->click("link=exact:Task2: Hello France");
301 $this->waitForPageToLoad("30000");
302 $this->select("priority", "label=5 - Highest");
303 $this->click("submit");
304 $this->waitForPageToLoad("30000");
306 // Check the priority is OK
307 $this->click("link=exact:Task2: Hello France");
308 $this->waitForPageToLoad("30000");
309 $this->assertTrue($this->isTextPresent("Highest"));
312 function completeTask()
314 // Set the completing value of a task
315 $this->select("percent_complete", "label=45%");
316 $this->click("//option[@value='45']");
317 $this->click("submit");
318 $this->waitForPageToLoad("30000");
319 $this->assertTrue($this->isTextPresent("Task Updated Successfully"));
321 // Check the percentage is OK
322 $this->click("link=exact:Task2: Hello France");
323 $this->waitForPageToLoad("30000");
324 $this->assertTrue($this->isTextPresent("45%"));
329 // Done in browseTasks()
332 function deleteTask()
335 $this->click("link=To Do: Browse tasks");
336 $this->waitForPageToLoad("30000");
337 $this->click("link=exact:Task3: Hello World");
338 $this->waitForPageToLoad("30000");
339 $this->click("link=Delete this task");
340 $this->waitForPageToLoad("30000");
341 $this->click("confirm_delete");
342 $this->click("submit");
343 $this->waitForPageToLoad("30000");
344 $this->assertTrue($this->isTextPresent("Task Successfully Deleted"));
346 // Let us check that Task3 no longer appears on the list of tasks
347 $this->click("link=Tasks");
348 $this->waitForPageToLoad("30000");
349 $this->click("link=To Do");
350 $this->waitForPageToLoad("30000");
351 $this->assertTrue($this->isTextPresent("Task1: Hello Paris"));
352 $this->assertTrue($this->isTextPresent("Task2: Hello France"));
353 $this->assertFalse($this->isTextPresent("Task3: Hello World"));
356 function assignTask()
358 $this->open("/pm/task.php?group_id=6&group_project_id=2");
359 $this->click("link=exact:Task1: Hello Paris");
360 $this->waitForPageToLoad("30000");
361 $this->addSelection("assigned_to[]", "label=ucontrib Lastname");
362 $this->removeSelection("assigned_to[]", "label=ucoredev Lastname");
363 $this->click("submit");
364 $this->waitForPageToLoad("30000");
366 $this->switchUser('ucontrib');
368 $this->waitForPageToLoad("30000");
369 $this->click("link=ProjectA");
370 $this->waitForPageToLoad("30000");
371 $this->click("link=My Page");
372 $this->waitForPageToLoad("30000");
373 // You cannot click on "Assigned Tasks" tabs,
374 // but the text is present in the page anyway.
375 // $this->click("link=Assigned Tasks");
376 $this->assertTrue($this->isTextPresent("Task2: Hello France"));
377 $this->switchUser('uadmin');
379 $this->waitForPageToLoad("30000");
386 function registerEmailAddressForNotification()
390 function createSubproject()
392 $this->open("/pm/task.php?group_id=6");
393 $this->click("link=Project Admin");
394 $this->waitForPageToLoad("30000");
395 $this->click("link=Tools");
396 $this->waitForPageToLoad("30000");
397 $this->click("link=Task Manager Admin");
398 $this->waitForPageToLoad("30000");
399 $this->click("link=Add a Subproject");
400 $this->waitForPageToLoad("30000");
401 $this->type("project_name", "public");
402 $this->type("description", "This is a public subproject");
403 $this->click("submit");
404 $this->waitForPageToLoad("30000");
405 $this->assertTrue($this->isTextPresent("Subproject Inserted"));
406 $this->click("link=Task Manager");
407 $this->waitForPageToLoad("30000");
408 $this->assertTrue($this->isTextPresent("This is a public subproject"));
411 function createPrivateSubproject()
413 $this->open("/pm/task.php?group_id=6");
414 $this->click("link=Project Admin");
415 $this->waitForPageToLoad("30000");
416 $this->click("link=Tools");
417 $this->waitForPageToLoad("30000");
418 $this->click("link=Task Manager Admin");
419 $this->waitForPageToLoad("30000");
420 $this->click("link=Add a Subproject");
421 $this->waitForPageToLoad("30000");
422 $this->click("//input[@name='is_public' and @value='0']");
423 $this->type("project_name", "private");
424 $this->type("description", "This is a private subproject");
425 $this->click("submit");
426 $this->waitForPageToLoad("30000");
427 $this->assertTrue($this->isTextPresent("Subproject Inserted"));
428 $this->click("link=Task Manager");
429 $this->waitForPageToLoad("30000");
430 $this->assertTrue($this->isTextPresent("This is a private subproject"));
433 function displayGANTT()
435 // Display GANTT diagram
436 $this->click("link=Tasks");
437 $this->waitForPageToLoad("30000");
438 $this->click("link=To Do");
439 $this->waitForPageToLoad("30000");
440 $this->click("link=Gantt Chart");
441 $this->waitForPopUp("Gantt_Chart", "30000");
444 function displayActivityReportByDeveloper()
446 // Display activity report by developer
447 $this->click("link=Reporting");
448 $this->waitForPageToLoad("30000");
449 $this->select("what", "label=Report by Assignee");
450 $this->click("//input[@value='Show']");
451 $this->waitForPageToLoad("30000");
452 $this->assertTrue($this->isTextPresent("Tasks By Assignee"));
453 $this->assertTrue($this->isTextPresent("ucontrib"));
454 $this->assertFalse($this->isTextPresent("ucoredev"));
457 function displayActivityReportBySubproject()
459 // Display activity report by subproject
460 $this->select("what", "label=Report by Subproject");
461 $this->click("//input[@value='Show']");
462 $this->waitForPageToLoad("30000");
463 $this->assertTrue($this->isTextPresent("Tasks By Category"));
464 $this->assertTrue($this->isTextPresent("To Do"));