[Fusionforge-commits] r7468 - in trunk/tests/func: Forums News Site Tasks Testing

Alain Peyrat aljeux at libremir.placard.fr.eu.org
Tue Apr 21 23:48:13 CEST 2009


Author: aljeux
Date: 2009-04-21 23:48:13 +0200 (Tue, 21 Apr 2009)
New Revision: 7468

Modified:
   trunk/tests/func/Forums/forums.php
   trunk/tests/func/News/news.php
   trunk/tests/func/Site/login.php
   trunk/tests/func/Site/projects.php
   trunk/tests/func/Site/top.php
   trunk/tests/func/Tasks/csv.php
   trunk/tests/func/Testing/SeleniumGforge.php
Log:
Refactoring of testsuite for simplicity

Modified: trunk/tests/func/Forums/forums.php
===================================================================
--- trunk/tests/func/Forums/forums.php	2009-04-21 21:48:05 UTC (rev 7467)
+++ trunk/tests/func/Forums/forums.php	2009-04-21 21:48:13 UTC (rev 7468)
@@ -45,52 +45,36 @@
 
 require_once 'config.php';
 require_once 'Testing/SeleniumGforge.php';
-require_once 'PHPUnit/Framework/TestCase.php';
 
-class CreateForum extends PHPUnit_Framework_TestCase
+class CreateForum extends FForge_SeleniumTestCase
 {
-	function setUp()
-	{
-		// Reload a fresh database before running this test suite.
-		system("php ".dirname(dirname(__FILE__))."/db_reload.php");
-
-		$this->verificationErrors = array();
-		$this->selenium = new Testing_SeleniumGforge($this, "*firefox", URL, SELENIUM_RC_HOST);
-		$result = $this->selenium->start();
-	}
-
-	function tearDown()
-	{
-		$this->selenium->stop();
-	}
-
 	function testSimplePost()
 	{
-		$this->selenium->createProject($this, 'ProjectA');
+		$this->createProject('ProjectA');
 					
 		// Create the first message (Message1/Text1).
-		$this->selenium->open( BASE );
-		$this->selenium->click("link=ProjectA");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=Forums");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertFalse($this->selenium->isTextPresent("Permission denied."));
-		$this->assertTrue($this->selenium->isTextPresent("open-discussion"));
-		$this->selenium->click("link=open-discussion");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=Start New Thread");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->type("subject", "Message1");
-		$this->selenium->type("body", "Text1");
-		$this->selenium->click("submit");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("Message Posted Successfully"));
-		$this->selenium->click("link=Forums");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("open-discussion"));
-		$this->selenium->click("link=open-discussion");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("Message1"));
+		$this->open( BASE );
+		$this->click("link=ProjectA");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=Forums");
+		$this->waitForPageToLoad("30000");
+		$this->assertFalse($this->isTextPresent("Permission denied."));
+		$this->assertTrue($this->isTextPresent("open-discussion"));
+		$this->click("link=open-discussion");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=Start New Thread");
+		$this->waitForPageToLoad("30000");
+		$this->type("subject", "Message1");
+		$this->type("body", "Text1");
+		$this->click("submit");
+		$this->waitForPageToLoad("30000");
+		$this->assertTrue($this->isTextPresent("Message Posted Successfully"));
+		$this->click("link=Forums");
+		$this->waitForPageToLoad("30000");
+		$this->assertTrue($this->isTextPresent("open-discussion"));
+		$this->click("link=open-discussion");
+		$this->waitForPageToLoad("30000");
+		$this->assertTrue($this->isTextPresent("Message1"));
 	}
 }
 ?>

Modified: trunk/tests/func/News/news.php
===================================================================
--- trunk/tests/func/News/news.php	2009-04-21 21:48:05 UTC (rev 7467)
+++ trunk/tests/func/News/news.php	2009-04-21 21:48:13 UTC (rev 7468)
@@ -45,108 +45,92 @@
 
 require_once 'config.php';
 require_once 'Testing/SeleniumGforge.php';
-require_once 'PHPUnit/Framework/TestCase.php';
 
-class CreateNews extends PHPUnit_Framework_TestCase
+class CreateNews extends FForge_SeleniumTestCase
 {
-	function setUp()
-	{
-		// Reload a fresh database before running this test suite.
-		system("php ".dirname(dirname(__FILE__))."/db_reload.php");
-
-		$this->verificationErrors = array();
-		$this->selenium = new Testing_SeleniumGforge($this, "*firefox", URL, SELENIUM_RC_HOST);
-		$result = $this->selenium->start();
-	}
-
-	function tearDown()
-	{
-		$this->selenium->stop();
-	}
-
 	function testMyTestCase()
 	{
-		$this->selenium->createProject($this, 'ProjectA');
+		$this->createProject('ProjectA');
 
 		// Create a simple news.
-		$this->selenium->click("link=News");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=Submit");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->type("summary", "First news");
-		$this->selenium->type("details", "This is a simple news.");
-		$this->selenium->click("submit");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=News");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("First news"));
-		$this->selenium->click("link=First news");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("First news"));
-		$this->assertTrue($this->selenium->isTextPresent("This is a simple news."));
+		$this->click("link=News");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=Submit");
+		$this->waitForPageToLoad("30000");
+		$this->type("summary", "First news");
+		$this->type("details", "This is a simple news.");
+		$this->click("submit");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=News");
+		$this->waitForPageToLoad("30000");
+		$this->assertTrue($this->isTextPresent("First news"));
+		$this->click("link=First news");
+		$this->waitForPageToLoad("30000");
+		$this->assertTrue($this->isTextPresent("First news"));
+		$this->assertTrue($this->isTextPresent("This is a simple news."));
 
 		// Create a second news.
-		$this->selenium->click("link=News");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=Submit");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->type("summary", "Second news");
-		$this->selenium->type("details", "This is another text");
-		$this->selenium->click("submit");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=News");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=Second news");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("Second news"));
-		$this->assertTrue($this->selenium->isTextPresent("This is another text"));
+		$this->click("link=News");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=Submit");
+		$this->waitForPageToLoad("30000");
+		$this->type("summary", "Second news");
+		$this->type("details", "This is another text");
+		$this->click("submit");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=News");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=Second news");
+		$this->waitForPageToLoad("30000");
+		$this->assertTrue($this->isTextPresent("Second news"));
+		$this->assertTrue($this->isTextPresent("This is another text"));
 		
 		// Check that news are visible in the activity
 		// TODO: Not implemented in gforge-4.6
-//		$this->selenium->click("link=Activity");
-//		$this->selenium->waitForPageToLoad("30000");
-//		$this->assertTrue($this->selenium->isTextPresent("First news"));
-//		$this->assertTrue($this->selenium->isTextPresent("Second news"));
+//		$this->click("link=Activity");
+//		$this->waitForPageToLoad("30000");
+//		$this->assertTrue($this->isTextPresent("First news"));
+//		$this->assertTrue($this->isTextPresent("Second news"));
 		
 		// Check modification of a news.
-		$this->selenium->click("link=News");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("//a[contains(@href, '" . BASE . "/news/admin/?group_id=6')]");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=Second news");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->type("details", "This is another text (corrected)");
-		$this->selenium->click("submit");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=Second news");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=News");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=Second news");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("This is another text (corrected)"));
-		$this->selenium->click("link=News");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=Submit");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->type("summary", "Test3");
-		$this->selenium->type("details", "Special ' chars \"");
-		$this->selenium->click("submit");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=News");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=Test3");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("Special ' chars \""));
-		$this->selenium->click("link=News");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("//a[contains(@href, '". BASE . "/news/admin/?group_id=6')]");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=Test3");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("document.forms[2].status[1]");
-		$this->selenium->click("submit");
-		$this->selenium->waitForPageToLoad("30000");
+		$this->click("link=News");
+		$this->waitForPageToLoad("30000");
+		$this->click("//a[contains(@href, '" . BASE . "/news/admin/?group_id=6')]");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=Second news");
+		$this->waitForPageToLoad("30000");
+		$this->type("details", "This is another text (corrected)");
+		$this->click("submit");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=Second news");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=News");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=Second news");
+		$this->waitForPageToLoad("30000");
+		$this->assertTrue($this->isTextPresent("This is another text (corrected)"));
+		$this->click("link=News");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=Submit");
+		$this->waitForPageToLoad("30000");
+		$this->type("summary", "Test3");
+		$this->type("details", "Special ' chars \"");
+		$this->click("submit");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=News");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=Test3");
+		$this->waitForPageToLoad("30000");
+		$this->assertTrue($this->isTextPresent("Special ' chars \""));
+		$this->click("link=News");
+		$this->waitForPageToLoad("30000");
+		$this->click("//a[contains(@href, '". BASE . "/news/admin/?group_id=6')]");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=Test3");
+		$this->waitForPageToLoad("30000");
+		$this->click("document.forms[2].status[1]");
+		$this->click("submit");
+		$this->waitForPageToLoad("30000");
 
 	}
 
@@ -155,33 +139,33 @@
 	 */
 	function testAcBug4100()
 	{
-		$this->selenium->createProject($this, 'ProjectA');
+		$this->createProject('ProjectA');
 
 		// Create a simple news.
-		$this->selenium->click("link=News");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=Submit");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->type("summary", "Multi line news");
-		$this->selenium->type("details", "<p>line1</p><p>line2</p><p>line3</p><br />hello<p>line5</p>\n");
-		$this->selenium->click("submit");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=News");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("Multi line news"));
-		$this->assertTrue($this->selenium->isTextPresent("line1"));
-		$this->assertTrue($this->selenium->isTextPresent("line2"));
-		$this->assertTrue($this->selenium->isTextPresent("line3"));
-		$this->assertTrue($this->selenium->isTextPresent("hello"));
-		// $this->assertFalse($this->selenium->isTextPresent("line5"));
-		$this->selenium->click("link=Multi line news");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("Multi line news"));
-		$this->assertTrue($this->selenium->isTextPresent("line1"));
-		$this->assertTrue($this->selenium->isTextPresent("line2"));
-		$this->assertTrue($this->selenium->isTextPresent("line3"));
-		$this->assertTrue($this->selenium->isTextPresent("hello"));
-		$this->assertTrue($this->selenium->isTextPresent("line5"));
+		$this->click("link=News");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=Submit");
+		$this->waitForPageToLoad("30000");
+		$this->type("summary", "Multi line news");
+		$this->type("details", "<p>line1</p><p>line2</p><p>line3</p><br />hello<p>line5</p>\n");
+		$this->click("submit");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=News");
+		$this->waitForPageToLoad("30000");
+		$this->assertTrue($this->isTextPresent("Multi line news"));
+		$this->assertTrue($this->isTextPresent("line1"));
+		$this->assertTrue($this->isTextPresent("line2"));
+		$this->assertTrue($this->isTextPresent("line3"));
+		$this->assertTrue($this->isTextPresent("hello"));
+		// $this->assertFalse($this->isTextPresent("line5"));
+		$this->click("link=Multi line news");
+		$this->waitForPageToLoad("30000");
+		$this->assertTrue($this->isTextPresent("Multi line news"));
+		$this->assertTrue($this->isTextPresent("line1"));
+		$this->assertTrue($this->isTextPresent("line2"));
+		$this->assertTrue($this->isTextPresent("line3"));
+		$this->assertTrue($this->isTextPresent("hello"));
+		$this->assertTrue($this->isTextPresent("line5"));
 	}
 	
 	/*
@@ -190,24 +174,24 @@
 	 */
 	function skiptestPreventMultiplePost()
 	{
-		$this->selenium->createProject($this, 'ProjectA');
+		$this->createProject('ProjectA');
 
 		// Create a simple news.
-		$this->selenium->click("link=News");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=Submit");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->type("summary", "My ABC news");
-		$this->selenium->type("details", "hello DEF with a long detail.\n");
-		$this->selenium->click("submit");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("News Added.")); 
-		$this->selenium->chooseOkOnNextConfirmation();
+		$this->click("link=News");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=Submit");
+		$this->waitForPageToLoad("30000");
+		$this->type("summary", "My ABC news");
+		$this->type("details", "hello DEF with a long detail.\n");
+		$this->click("submit");
+		$this->waitForPageToLoad("30000");
+		$this->assertTrue($this->isTextPresent("News Added.")); 
+		$this->chooseOkOnNextConfirmation();
 		// Problem, a confirmation window is displayed and I didn't found
 		// the way to automatically click on the Ok button.
-		$this->selenium->refresh();
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("Error - double submit")); 
+		$this->refresh();
+		$this->waitForPageToLoad("30000");
+		$this->assertTrue($this->isTextPresent("Error - double submit")); 
 	}
 	
 }

Modified: trunk/tests/func/Site/login.php
===================================================================
--- trunk/tests/func/Site/login.php	2009-04-21 21:48:05 UTC (rev 7467)
+++ trunk/tests/func/Site/login.php	2009-04-21 21:48:13 UTC (rev 7468)
@@ -45,65 +45,49 @@
 
 require_once 'config.php';
 require_once 'Testing/SeleniumGforge.php';
-require_once 'PHPUnit/Framework/TestCase.php';
 
-class LoginProcess extends PHPUnit_Framework_TestCase
+class LoginProcess extends FForge_SeleniumTestCase
 {
-	function setUp()
-	{
-		// Reload a fresh database before running this test suite.
-		system("php ".dirname(dirname(__FILE__))."/db_reload.php");
-
-		$this->verificationErrors = array();
-		$this->selenium = new Testing_SeleniumGforge($this, "*firefox", URL, SELENIUM_RC_HOST);
-		$result = $this->selenium->start();
-	}
-
-	function tearDown()
-	{
-		$this->selenium->stop();
-	}
-
 	// Simple creation of a project by the admin user and
 	// approval of the creation just after.
 	// After creation, project is visible on the main page.
 	function testLogin()
 	{
 		// Test with a normal login.
-		$this->selenium->open( BASE );
-		$this->selenium->click("link=Log In");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->type("form_loginname", "admin");
-		$this->selenium->type("form_pw", "myadmin");
-		$this->selenium->click("login");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("ACOS Forge Admin"));
-		$this->assertTrue($this->selenium->isTextPresent("Log Out"));
-		$this->selenium->logout();
+		$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->assertTrue($this->isTextPresent("ACOS Forge Admin"));
+		$this->assertTrue($this->isTextPresent("Log Out"));
+		$this->logout();
 				
 		// Test with an empty password.
-		$this->selenium->open( BASE );
-		$this->selenium->click("link=Log In");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->type("form_loginname", "admin");
-		$this->selenium->type("form_pw", "");
-		$this->selenium->click("login");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("Missing Password Or Users Name"));
-		$this->assertFalse($this->selenium->isTextPresent("ACOS Forge Admin"));
-		$this->assertTrue($this->selenium->isTextPresent("Log In"));
+		$this->open( BASE );
+		$this->click("link=Log In");
+		$this->waitForPageToLoad("30000");
+		$this->type("form_loginname", "admin");
+		$this->type("form_pw", "");
+		$this->click("login");
+		$this->waitForPageToLoad("30000");
+		$this->assertTrue($this->isTextPresent("Missing Password Or Users Name"));
+		$this->assertFalse($this->isTextPresent("ACOS Forge Admin"));
+		$this->assertTrue($this->isTextPresent("Log In"));
 		
 		// Test with a wrong password.
-		$this->selenium->open( BASE );
-		$this->selenium->click("link=Log In");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->type("form_loginname", "admin");
-		$this->selenium->type("form_pw", "awrongpassword");
-		$this->selenium->click("login");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("Invalid Password Or User Name"));
-		$this->assertFalse($this->selenium->isTextPresent("ACOS Forge Admin"));
-		$this->assertTrue($this->selenium->isTextPresent("Log In"));
+		$this->open( BASE );
+		$this->click("link=Log In");
+		$this->waitForPageToLoad("30000");
+		$this->type("form_loginname", "admin");
+		$this->type("form_pw", "awrongpassword");
+		$this->click("login");
+		$this->waitForPageToLoad("30000");
+		$this->assertTrue($this->isTextPresent("Invalid Password Or User Name"));
+		$this->assertFalse($this->isTextPresent("ACOS Forge Admin"));
+		$this->assertTrue($this->isTextPresent("Log In"));
 		
 	}
 }

Modified: trunk/tests/func/Site/projects.php
===================================================================
--- trunk/tests/func/Site/projects.php	2009-04-21 21:48:05 UTC (rev 7467)
+++ trunk/tests/func/Site/projects.php	2009-04-21 21:48:13 UTC (rev 7468)
@@ -45,117 +45,103 @@
 
 require_once 'config.php';
 require_once 'Testing/SeleniumGforge.php';
-require_once 'PHPUnit/Framework/TestCase.php';
 
-class CreateProject extends PHPUnit_Framework_TestCase
+class CreateProject extends FForge_SeleniumTestCase
 {
-	function setUp()
-	{
-		// Reload a fresh database before running this test suite.
-		system("php ".dirname(dirname(__FILE__))."/db_reload.php");
-
-		$this->verificationErrors = array();
-		$this->selenium = new Testing_SeleniumGforge($this, "*firefox", URL, SELENIUM_RC_HOST);
-		$result = $this->selenium->start();
-	}
-
-	function tearDown()
-	{
-		$this->selenium->stop();
-	}
-
 	// Simple creation of a project by the admin user and
 	// approval of the creation just after.
 	// After creation, project is visible on the main page.
 	function testSimpleCreate()
 	{
-		$this->selenium->open( BASE );
-		$this->selenium->click("link=Log In");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->type("form_loginname", "admin");
-		$this->selenium->type("form_pw", "myadmin");
-		$this->selenium->click("login");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=My Page");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=Register Project");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->type("full_name", "ProjectA");
-		$this->selenium->type("purpose", "This is a simple description for project A");
-		$this->selenium->type("description", "This is the public description for project A.");
-		$this->selenium->type("unix_name", "projecta");
-		$this->selenium->click("submit");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("Your project has been submitted"));
-		$this->assertTrue($this->selenium->isTextPresent("you will receive notification of their decision and further instructions"));
-		$this->selenium->click("link=Admin");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=Pending (P) (New Project Approval)");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("document.forms['approve.projecta'].submit");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=Home");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("ProjectA"));
-		$this->selenium->click("link=ProjectA");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("This is the public description for project A."));
-		$this->assertTrue($this->selenium->isTextPresent("This project has not yet categorized itself"));
+		$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->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("unix_name", "projecta");
+    	$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=Admin");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=Pending (P) (New Project Approval)");
+		$this->waitForPageToLoad("30000");
+		$this->click("document.forms['approve.projecta'].submit");
+		$this->waitForPageToLoad("30000");
+		$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 project has not yet categorized itself"));
 	}
 
 	function testCharsCreateTestCase()
 	{
-		$this->selenium->open( BASE );
-		$this->selenium->click("link=Log In");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->type("form_loginname", "admin");
-		$this->selenium->type("form_pw", "myadmin");
-		$this->selenium->click("login");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=My Page");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=Register Project");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->type("full_name", "Project ' & B");
-		$this->selenium->type("purpose", "This is a & été simple description for project B");
-		$this->selenium->type("description", "This is & été the public description for project B.");
-		$this->selenium->type("unix_name", "projectb");
-		$this->selenium->click("submit");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("Your project has been submitted"));
-		$this->assertTrue($this->selenium->isTextPresent("you will receive notification of their decision and further instructions"));
-		$this->selenium->click("link=Admin");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=Pending (P) (New Project Approval)");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("document.forms['approve.projectb'].submit");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=Home");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("Project ' & B"));
-		$this->selenium->click("link=Project ' & B");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("This is & été the public description for project B."));
+		$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->click("link=My Page");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=Register Project");
+		$this->waitForPageToLoad("30000");
+		$this->type("full_name", "Project ' & B");
+		$this->type("purpose", "This is a & été simple description for project B");
+		$this->type("description", "This is & été the public description for project B.");
+		$this->type("unix_name", "projectb");
+    	$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=Admin");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=Pending (P) (New Project Approval)");
+		$this->waitForPageToLoad("30000");
+		$this->click("document.forms['approve.projectb'].submit");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=Home");
+		$this->waitForPageToLoad("30000");
+		$this->assertTrue($this->isTextPresent("Project ' & B"));
+		$this->click("link=Project ' & B");
+		$this->waitForPageToLoad("30000");
+		$this->assertTrue($this->isTextPresent("This is & été the public description for project B."));
 	}
 
 	// Test removal of project.
 	// TODO: Test not finished as removal does not work.
 	function testRemoveProject()
 	{
-		$this->selenium->createProject($this, 'testal1');
+		$this->createProject('testal1');
 		
-		$this->selenium->click("link=Admin");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=Display Full Project List/Edit Projects");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=testal1");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=Permanently Delete Project");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("sure");
-		$this->selenium->click("reallysure");
-		$this->selenium->click("reallyreallysure");
-		$this->selenium->click("submit");
+		$this->click("link=Admin");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=Display Full Project List/Edit Projects");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=testal1");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=Permanently Delete Project");
+		$this->waitForPageToLoad("30000");
+		$this->click("sure");
+		$this->click("reallysure");
+		$this->click("reallyreallysure");
+		$this->click("submit");
 	}
 }
 ?>

Modified: trunk/tests/func/Site/top.php
===================================================================
--- trunk/tests/func/Site/top.php	2009-04-21 21:48:05 UTC (rev 7467)
+++ trunk/tests/func/Site/top.php	2009-04-21 21:48:13 UTC (rev 7468)
@@ -45,49 +45,34 @@
 
 require_once 'config.php';
 require_once 'Testing/SeleniumGforge.php';
-require_once 'PHPUnit/Framework/TestCase.php';
 
-class Top extends PHPUnit_Framework_TestCase
+class Top extends FForge_SeleniumTestCase
 {
-    function setUp()
-    {
-    	global $url;
-    	
-        $this->verificationErrors = array();
-		$this->selenium = new Testing_SeleniumGforge($this, "*firefox", URL, SELENIUM_RC_HOST);
-        $result = $this->selenium->start();
-    }
-
-    function tearDown()
-    {
-        $this->selenium->stop();
-    }
-
     function testWalkInTop()
     {
-    	$this->selenium->open( BASE );
+    	$this->open( BASE );
 
 		// Test that from the main page we access the most active this week.    
-	    $this->selenium->click("link=[ More ]");
-    	$this->selenium->waitForPageToLoad("30000");
-    	$this->assertTrue($this->selenium->isTextPresent("Most Active This Week"));
+	    $this->click("link=[ More ]");
+    	$this->waitForPageToLoad("30000");
+    	$this->assertTrue($this->isTextPresent("Most Active This Week"));
 
     	// Test that we can return back to all the tops.
-    	$this->selenium->click("link=[View Other Top Categories]");
-    	$this->selenium->waitForPageToLoad("30000");
-    	$this->assertTrue($this->selenium->isTextPresent("We track many project usage statistics"));
+    	$this->click("link=[View Other Top Categories]");
+    	$this->waitForPageToLoad("30000");
+    	$this->assertTrue($this->isTextPresent("We track many project usage statistics"));
 
     	// Test that we can go the view the most active all time.
-    	$this->selenium->click("link=Most Active All Time");
-    	$this->selenium->waitForPageToLoad("30000");
-    	$this->assertTrue($this->selenium->isTextPresent("Most Active All Time"));
+    	$this->click("link=Most Active All Time");
+    	$this->waitForPageToLoad("30000");
+    	$this->assertTrue($this->isTextPresent("Most Active All Time"));
 
     	// Return back to tops.
-    	$this->selenium->click("link=[View Other Top Categories]");
-    	$this->selenium->waitForPageToLoad("30000");
-    	$this->selenium->click("link=Top Downloads");
-    	$this->selenium->waitForPageToLoad("30000");
-    	$this->assertTrue($this->selenium->isTextPresent("Rank"));
+    	$this->click("link=[View Other Top Categories]");
+    	$this->waitForPageToLoad("30000");
+    	$this->click("link=Top Downloads");
+    	$this->waitForPageToLoad("30000");
+    	$this->assertTrue($this->isTextPresent("Rank"));
     }
 }
 ?>

Modified: trunk/tests/func/Tasks/csv.php
===================================================================
--- trunk/tests/func/Tasks/csv.php	2009-04-21 21:48:05 UTC (rev 7467)
+++ trunk/tests/func/Tasks/csv.php	2009-04-21 21:48:13 UTC (rev 7468)
@@ -45,67 +45,51 @@
 
 require_once 'config.php';
 require_once 'Testing/SeleniumGforge.php';
-require_once 'PHPUnit/Framework/TestCase.php';
 
-class ExportCSV extends PHPUnit_Framework_TestCase
+class ExportCSV extends FForge_SeleniumTestCase
 {
-	function setUp()
-	{
-		// Reload a fresh database before running this test suite.
-		system("php ".dirname(dirname(__FILE__))."/db_reload.php");
-
-		$this->verificationErrors = array();
-		$this->selenium = new Testing_SeleniumGforge($this, "*firefox", URL, SELENIUM_RC_HOST);
-		$result = $this->selenium->start();
-	}
-
-	function tearDown()
-	{
-		$this->selenium->stop();
-	}
-
 	function testexportCSV()
 	{
-		$this->selenium->createProject($this, 'ProjectA');
+		$this->createProject('ProjectA');
 
 		// Test: Create a simple bug report (Message1/Text1).
-		$this->selenium->open( BASE );
-		$this->selenium->click("link=ProjectA");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->click("link=Task Manager");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("To Do"));
-		$this->assertTrue($this->selenium->isTextPresent("Next Release"));
-		$this->selenium->click("link=To Do");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("No Matching Tasks found"));
+		$this->open( BASE );
+		$this->click("link=ProjectA");
+		$this->waitForPageToLoad("30000");
+		$this->click("link=Task Manager");
+		$this->waitForPageToLoad("30000");
+		$this->assertTrue($this->isTextPresent("To Do"));
+		$this->assertTrue($this->isTextPresent("Next Release"));
+		$this->click("link=To Do");
+		$this->waitForPageToLoad("30000");
+		$this->assertTrue($this->isTextPresent("No Matching Tasks found"));
 
-		$this->selenium->click("link=Add task");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->type("summary", "Task1: Hello Paris");
-		$this->selenium->type("details", "Hello Paris");
-		$this->selenium->type("hours", "10");
-		$this->selenium->click("submit");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("Task Created Successfully"));
+		$this->click("link=Add task");
+		$this->waitForPageToLoad("30000");
+		$this->type("summary", "Task1: Hello Paris");
+		$this->type("details", "Hello Paris");
+		$this->type("hours", "10");
+		$this->click("submit");
+		$this->waitForPageToLoad("30000");
+		$this->assertTrue($this->isTextPresent("Task Created Successfully"));
 
-		$this->selenium->click("link=Add task");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->type("summary", "Task2: Hello France");
-		$this->selenium->type("details", "Hello France");
-		$this->selenium->type("hours", "15");
-		$this->selenium->click("submit");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("Task Created Successfully"));
+		$this->click("link=Add task");
+		$this->waitForPageToLoad("30000");
+		$this->type("summary", "Task2: Hello France");
+		$this->type("details", "Hello France");
+		$this->type("hours", "15");
+		$this->click("submit");
+		$this->waitForPageToLoad("30000");
+		$this->assertTrue($this->isTextPresent("Task Created Successfully"));
 
-		$this->selenium->click("link=Add task");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->selenium->type("summary", "Task3: Hello World");
-		$this->selenium->type("details", "Hello World");
-		$this->selenium->type("hours", "20");
-		$this->selenium->click("submit");
-		$this->selenium->waitForPageToLoad("30000");
-		$this->assertTrue($this->selenium->isTextPresent("Task Created Successfully"));
+		$this->click("link=Add task");
+		$this->waitForPageToLoad("30000");
+		$this->type("summary", "Task3: Hello World");
+		$this->type("details", "Hello World");
+		$this->type("hours", "20");
+		$this->click("submit");
+		$this->waitForPageToLoad("30000");
+		$this->assertTrue($this->isTextPresent("Task Created Successfully"));
 	}
 }
 ?>

Modified: trunk/tests/func/Testing/SeleniumGforge.php
===================================================================
--- trunk/tests/func/Testing/SeleniumGforge.php	2009-04-21 21:48:05 UTC (rev 7467)
+++ trunk/tests/func/Testing/SeleniumGforge.php	2009-04-21 21:48:13 UTC (rev 7468)
@@ -44,27 +44,31 @@
  */
 
 require dirname(__FILE__).'/Selenium.php';
+require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
 
-class Testing_SeleniumGforge extends Testing_Selenium {
+// New class to use, next one is now obsolete.
+class FForge_SeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase
+{
+    protected function setUp()
+    {
+		// Reload a fresh database before running this test suite.
+		system("php ".dirname(dirname(__FILE__))."/db_reload.php");
 
-	var $test;
+    	$this->setBrowser('*firefox');
+        $this->setBrowserUrl(URL);
+        $this->setHost(SELENIUM_RC_HOST);
+    }
 
-	function __construct($test, $browser, $browserUrl, $host = 'localhost', $port = 4444, $timeout = 30000)
-	{
-		$this->test = $test;
-		parent::__construct($browser, $browserUrl, $host, $port, $timeout);
-	}
+//	protected function waitForPageToLoad($timeout)
+//	{
+//		parent::waitForPageToLoad($timeout);
+//		$this->test->assertFalse($this->isTextPresent("Notice: Undefined variable:"));
+//		$this->test->assertFalse($this->isTextPresent("Notice: Undefined index:"));
+//		$this->test->assertFalse($this->isTextPresent("Warning: Missing argument"));
+//	}
 
-	function waitForPageToLoad($timeout)
+    protected function login($username)
 	{
-		parent::waitForPageToLoad($timeout);
-		$this->test->assertFalse($this->isTextPresent("Notice: Undefined variable:"));
-		$this->test->assertFalse($this->isTextPresent("Notice: Undefined index:"));
-		$this->test->assertFalse($this->isTextPresent("Warning: Missing argument"));
-	}
-
-	function login($username)
-	{
 		if ($username == 'admin') {
 			$password = 'myadmin';
 		} else {
@@ -80,19 +84,14 @@
 		
 	}
 	
-	function logout()
+	protected function logout()
 	{
 //		$this->click("link=Log Out");
 		$this->open( BASE ."/account/logout.php" );
 		$this->waitForPageToLoad("30000");
 	}
-	
-	function swithUser($username)
-	{
-		$this->logout();
-		$this->login($username);
-	}
-	function createProject ($test, $name) {
+
+	protected function createProject ($name) {
 		$unix_name = strtolower($name);
 		
 		// Create a simple project.
@@ -111,10 +110,11 @@
 		$this->type("purpose", "This is a simple description for $name");
 		$this->type("description", "This is the public description for $name.");
 		$this->type("unix_name", $unix_name);
+    	$this->click("//input[@name='scm' and @value='scmsvn']");
 		$this->click("submit");
 		$this->waitForPageToLoad("30000");
-		$test->assertTrue($this->isTextPresent("Your project has been submitted"));
-		$test->assertTrue($this->isTextPresent("you will receive notification of their decision and further instructions"));
+		$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->waitForPageToLoad("30000");
 		$this->click("link=Pending (P) (New Project Approval)");
@@ -123,15 +123,21 @@
 		$this->waitForPageToLoad("30000");
 		$this->click("link=Home");
 		$this->waitForPageToLoad("30000");
-		$test->assertTrue($this->isTextPresent($name));
+		$this->assertTrue($this->isTextPresent($name));
 		$this->click("link=$name");
 		$this->waitForPageToLoad("30000");
-		$test->assertTrue($this->isTextPresent("This is the public description for $name."));
-		$test->assertTrue($this->isTextPresent("This project has not yet categorized itself"));
+		$this->assertTrue($this->isTextPresent("This is the public description for $name."));
+		$this->assertTrue($this->isTextPresent("This project has not yet categorized itself"));
 	}
 
-	function createUser ($login, $id)
+	protected function swithUser($username)
 	{
+		$this->logout();
+		$this->login($username);
+	}
+	
+	protected function createUser ($login, $id)
+	{
 		$this->open("/");
 		$this->click("link=Admin");
 		$this->waitForPageToLoad("30000");
@@ -153,7 +159,6 @@
 		$this->click("//a[contains(@href, 'userlist.php?action=activate&user_id=$id')]");
 		$this->waitForPageToLoad("30000");
 	}
-
 }
 
 ?>




More information about the Fusionforge-commits mailing list