* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with FusionForge; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
* ALONE BASIS."
*/
-require_once 'func/Testing/SeleniumGforge.php';
+require_once dirname(dirname(__FILE__)).'/Testing/SeleniumGforge.php';
class CreateProject extends FForge_SeleniumTestCase
{
// After creation, project is visible on the main page.
function testSimpleCreate()
{
- $this->open( BASE );
- $this->click("link=Log In");
- $this->waitForPageToLoad("30000");
- $this->type("form_loginname", "admin");
- $this->type("form_pw", "myadmin");
- $this->click("login");
- $this->waitForPageToLoad("30000");
+ // "Manual" procedure
+ $this->login (FORGE_ADMIN_USERNAME);
$this->click("link=My Page");
$this->waitForPageToLoad("30000");
$this->click("link=Register Project");
$this->waitForPageToLoad("30000");
$this->type("full_name", "ProjectA");
- $this->type("purpose", "This is a simple description for project A");
- $this->type("description", "This is the public description for project A.");
+ $this->type("purpose", "This is a simple description for ProjectA");
+ $this->type("description", "This is the public description for ProjectA.");
$this->type("unix_name", "projecta");
$this->click("//input[@name='scm' and @value='scmsvn']");
+ $this->assertTrue($this->isElementPresent("//select[@name='built_from_template']"));
$this->click("submit");
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent("Your project has been submitted"));
$this->assertTrue($this->isTextPresent("you will receive notification of their decision and further instructions"));
- $this->click("link=Admin");
+ $this->click("link=Site Admin");
$this->waitForPageToLoad("30000");
- $this->click("link=Pending (P) (New Project Approval)");
+ $this->click("link=Pending projects (new project approval)");
$this->waitForPageToLoad("30000");
$this->click("document.forms['approve.projecta'].submit");
- $this->waitForPageToLoad("30000");
+ $this->waitForPageToLoad("60000");
$this->click("link=Home");
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent("ProjectA"));
$this->click("link=ProjectA");
$this->waitForPageToLoad("30000");
- $this->assertTrue($this->isTextPresent("This is the public description for project A."));
+ $this->assertTrue($this->isTextPresent("This is the public description for ProjectA."));
$this->assertTrue($this->isTextPresent("This project has not yet categorized itself"));
}
function testCharsCreateTestCase()
{
- $this->open( BASE );
- $this->click("link=Log In");
- $this->waitForPageToLoad("30000");
- $this->type("form_loginname", "admin");
- $this->type("form_pw", "myadmin");
- $this->click("login");
- $this->waitForPageToLoad("30000");
+ $this->login(FORGE_ADMIN_USERNAME);
$this->click("link=My Page");
$this->waitForPageToLoad("30000");
$this->click("link=Register Project");
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent("Your project has been submitted"));
$this->assertTrue($this->isTextPresent("you will receive notification of their decision and further instructions"));
- $this->click("link=Admin");
+ $this->click("link=Site Admin");
$this->waitForPageToLoad("30000");
- $this->click("link=Pending (P) (New Project Approval)");
+ $this->click("link=Pending projects (new project approval)");
$this->waitForPageToLoad("30000");
$this->click("document.forms['approve.projectb'].submit");
- $this->waitForPageToLoad("30000");
+ $this->waitForPageToLoad("60000");
$this->click("link=Home");
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent("Project ' & B"));
$this->assertTrue($this->isTextPresent("Project ' & B - This is & été the public description for project B."));
$this->click("link=My Page");
$this->waitForPageToLoad("30000");
- $this->click("//div[@id='tabber']/ul/li[5]/a");
$this->assertFalse($this->isTextPresent("Project ' & B"));
}
+ function testHighLevelFunctions()
+ {
+ // Test our high-level functions (testing the test-suite)
+ $this->createProject ('ProjectB');
+ $this->click("link=Home");
+ $this->waitForPageToLoad("30000");
+ $this->assertTrue($this->isTextPresent("ProjectB"));
+ $this->click("link=ProjectB");
+ $this->waitForPageToLoad("30000");
+ $this->assertTrue($this->isTextPresent("This is the public description for ProjectB."));
+ $this->assertTrue($this->isTextPresent("This project has not yet categorized itself"));
+ $this->gotoProject ('ProjectB');
+ $this->assertTrue($this->isTextPresent("This is the public description for ProjectB."));
+ $this->createAndGoto ('ProjectC');
+ $this->assertTrue($this->isTextPresent("This is the public description for ProjectC."));
+ $this->init ();
+ $this->assertTrue($this->isTextPresent("This is the public description for ProjectA."));
+ }
+
+ function testTemplateProject()
+ {
+ $this->populateStandardTemplate('trackers');
+
+ $this->open( ROOT . '/projects/tmpl') ;
+ $this->waitForPageToLoad("30000");
+
+ $this->click("link=Admin");
+ $this->waitForPageToLoad("30000");
+ $this->click("link=Tools");
+ $this->waitForPageToLoad("30000");
+ $this->click("link=Trackers Admin");
+ $this->waitForPageToLoad("30000");
+ $this->type("name", "Local tracker for UNIXNAME");
+ $this->type("description", "Tracker for PUBLICNAME (UNIXNAME)");
+ $this->click("post_changes");
+ $this->waitForPageToLoad("30000");
+ $this->assertTrue($this->isTextPresent("Tracker created successfully"));
+
+ $this->init();
+ $this->assertTrue($this->isElementPresent("//a[.='Tracker']"));
+ $this->assertTrue($this->isElementPresent("//a[.='Forums']"));
+ $this->assertTrue($this->isElementPresent("//a[.='Tasks']"));
+ $this->click("link=Tracker");
+ $this->waitForPageToLoad("30000");
+ $this->assertTrue($this->isTextPresent("Tracker for ProjectA (projecta)"));
+
+ // Test for fusionforge.org bug #245
+ $this->open( ROOT . '/projects/tmpl') ;
+ $this->waitForPageToLoad("30000");
+
+ $this->click("link=Admin");
+ $this->waitForPageToLoad("30000");
+ $this->click("link=Tools");
+ $this->waitForPageToLoad("30000");
+ $this->uncheck("//input[@name='use_tracker']") ;
+ $this->click("submit");
+ $this->waitForPageToLoad("30000");
+
+ $this->createAndGoto('ProjectB');
+ }
+
+ function testEmptyProject()
+ {
+ // Create an empty project despite the template being full
+ $this->populateStandardTemplate('all');
+
+ $this->click("link=My Page");
+ $this->waitForPageToLoad("30000");
+ $this->click("link=Register Project");
+ $this->waitForPageToLoad("30000");
+ $this->assertTrue($this->isElementPresent("//select[@name='built_from_template']"));
+ $this->type("full_name", "ProjectA");
+ $this->type("purpose", "This is a simple description for ProjectA");
+ $this->type("description", "This is the public description for ProjectA.");
+ $this->type("unix_name", "projecta");
+ $this->select("//select[@name='built_from_template']", "label=Start from empty project");
+ $this->click("//input[@name='scm' and @value='scmsvn']");
+ $this->click("submit");
+ $this->waitForPageToLoad("30000");
+ $this->assertTrue($this->isTextPresent("Your project has been submitted"));
+ $this->assertTrue($this->isTextPresent("you will receive notification of their decision and further instructions"));
+ $this->click("link=Site Admin");
+ $this->waitForPageToLoad("30000");
+ $this->click("link=Pending projects (new project approval)");
+ $this->waitForPageToLoad("30000");
+ $this->click("document.forms['approve.projecta'].submit");
+ $this->waitForPageToLoad("60000");
+ $this->click("link=Home");
+ $this->waitForPageToLoad("30000");
+ $this->assertTrue($this->isTextPresent("ProjectA"));
+ $this->click("link=ProjectA");
+ $this->waitForPageToLoad("30000");
+ $this->assertTrue($this->isTextPresent("This is the public description for ProjectA."));
+ $this->assertTrue($this->isTextPresent("This project has not yet categorized itself"));
+ $this->assertFalse($this->isElementPresent("//a[.='Tracker']"));
+ $this->assertFalse($this->isElementPresent("//a[.='Forums']"));
+ $this->assertFalse($this->isElementPresent("//a[.='Tasks']"));
+ }
+
// Test removal of project.
- // TODO: Test not finished as removal does not work.
function testRemoveProject()
{
- $this->createProject('testal1');
+ $this->login(FORGE_ADMIN_USERNAME);
- $this->click("link=Admin");
+ // Create project as a different user
+ // Non-regression test for Adacore ticket K720-005
+ $this->createUser('toto');
+
+ $this->click("link=Site Admin");
+ $this->waitForPageToLoad("30000");
+ $this->select ("//form[contains(@action,'globalroleedit.php')]//select[@name='role_id']", "label=Forge administrators") ;
+ $this->click ("//form[contains(@action,'globalroleedit.php')]//input[@value='Edit Role']") ;
+ $this->waitForPageToLoad("30000");
+ $this->type ("//form[contains(@action,'globalroleedit.php')]//input[@name='form_unix_name']", "toto") ;
+ $this->click ("//input[@value='Add User']") ;
+ $this->waitForPageToLoad("30000");
+ $this->assertTrue($this->isTextPresent("toto Lastname"));
+
+ $this->registerProject('testal1','toto');
+ $this->approveProject('testal1',FORGE_ADMIN_USERNAME);
+
+ $this->click("link=Site Admin");
$this->waitForPageToLoad("30000");
$this->click("link=Display Full Project List/Edit Projects");
$this->waitForPageToLoad("30000");
$this->click("reallysure");
$this->click("reallyreallysure");
$this->click("submit");
+ $this->waitForPageToLoad("30000");
+ $this->click("link=Home");
+ $this->waitForPageToLoad("30000");
+ $this->assertFalse($this->isTextPresent("testal1"));
}
}
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
?>