3 * Copyright (C) 2007-2008 Alain Peyrat <aljeux at free dot 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 dirname(__FILE__).'/Selenium.php';
48 class Testing_SeleniumGforge extends Testing_Selenium {
52 function __construct($test, $browser, $browserUrl, $host = 'localhost', $port = 4444, $timeout = 30000)
55 parent::__construct($browser, $browserUrl, $host, $port, $timeout);
58 function waitForPageToLoad($timeout)
60 parent::waitForPageToLoad($timeout);
61 $this->test->assertFalse($this->isTextPresent("Notice: Undefined variable:"));
62 $this->test->assertFalse($this->isTextPresent("Notice: Undefined index:"));
63 $this->test->assertFalse($this->isTextPresent("Warning: Missing argument"));
66 function login($username)
68 if ($username == 'admin') {
69 $password = 'myadmin';
71 $password = 'password';
74 $this->click("link=Log In");
75 $this->waitForPageToLoad("30000");
76 $this->type("form_loginname", $username);
77 $this->type("form_pw", $password);
78 $this->click("login");
79 $this->waitForPageToLoad("30000");
85 // $this->click("link=Log Out");
86 $this->open( BASE ."/account/logout.php" );
87 $this->waitForPageToLoad("30000");
90 function swithUser($username)
93 $this->login($username);
95 function createProject ($test, $name) {
96 $unix_name = strtolower($name);
98 // Create a simple project.
100 $this->click("link=Log In");
101 $this->waitForPageToLoad("30000");
102 $this->type("form_loginname", "admin");
103 $this->type("form_pw", "myadmin");
104 $this->click("login");
105 $this->waitForPageToLoad("30000");
106 $this->click("link=My Page");
107 $this->waitForPageToLoad("30000");
108 $this->click("link=Register Project");
109 $this->waitForPageToLoad("30000");
110 $this->type("full_name", $name);
111 $this->type("purpose", "This is a simple description for $name");
112 $this->type("description", "This is the public description for $name.");
113 $this->type("unix_name", $unix_name);
114 $this->click("submit");
115 $this->waitForPageToLoad("30000");
116 $test->assertTrue($this->isTextPresent("Your project has been submitted"));
117 $test->assertTrue($this->isTextPresent("you will receive notification of their decision and further instructions"));
118 $this->click("link=Admin");
119 $this->waitForPageToLoad("30000");
120 $this->click("link=Pending (P) (New Project Approval)");
121 $this->waitForPageToLoad("30000");
122 $this->click("document.forms['approve.$unix_name'].submit");
123 $this->waitForPageToLoad("30000");
124 $this->click("link=Home");
125 $this->waitForPageToLoad("30000");
126 $test->assertTrue($this->isTextPresent($name));
127 $this->click("link=$name");
128 $this->waitForPageToLoad("30000");
129 $test->assertTrue($this->isTextPresent("This is the public description for $name."));
130 $test->assertTrue($this->isTextPresent("This project has not yet categorized itself"));
133 function createUser ($login, $id)
136 $this->click("link=Admin");
137 $this->waitForPageToLoad("30000");
138 $this->click("link=Register a New User");
139 $this->waitForPageToLoad("30000");
140 $this->type("unix_name", $login);
141 $this->type("alt_user_name", $login);
142 $this->type("password1", "password");
143 $this->type("password2", "password");
144 $this->type("firstname", $login);
145 $this->type("lastname", "Lastname");
146 $this->type("email", $login."@debug.log");
147 $this->click("submit");
148 $this->waitForPageToLoad("30000");
149 $this->click("link=Admin");
150 $this->waitForPageToLoad("30000");
151 $this->click("link=Display Full User List/Edit Users");
152 $this->waitForPageToLoad("30000");
153 $this->click("//a[contains(@href, 'userlist.php?action=activate&user_id=$id')]");
154 $this->waitForPageToLoad("30000");