[Fusionforge-commits] FusionForge branch master updated. v6.1-193-g47697fa

Franck Villaume nerville at libremir.placard.fr.eu.org
Sun Jan 20 13:34:17 CET 2019


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  47697fa7760f956fdd6124a65ee13b32043ff9db (commit)
      from  e48192ba95aa941485ec57ebe37d120bdd516a8e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=47697fa7760f956fdd6124a65ee13b32043ff9db

commit 47697fa7760f956fdd6124a65ee13b32043ff9db
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun Jan 20 13:33:32 2019 +0100

    implement check & uncheck. adapt tests with select & clickAndWait

diff --git a/tests/func/10_Site/projectsTest.php b/tests/func/10_Site/projectsTest.php
index c4df5fe..30184ca 100644
--- a/tests/func/10_Site/projectsTest.php
+++ b/tests/func/10_Site/projectsTest.php
@@ -186,7 +186,7 @@ class CreateProject extends FForge_SeleniumTestCase
 		$this->type("purpose", "This is a simple description for ProjectA");
 		$this->type("//textarea[@name='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->select($this->byXpath("//select[@name='built_from_template']"))->selectOptionByLabel("Start from empty project");
 		$this->clickAndWait("//input[@name='scm' and @value='scmsvn']");
 		$this->clickAndWait("submit");
 		$this->waitForPageToLoad("30000");
@@ -215,7 +215,7 @@ class CreateProject extends FForge_SeleniumTestCase
 
 		$this->url(ROOT."/admin/");
 		$this->waitForPageToLoad("30000");
-		$this->select ("//form[contains(@action,'globalroleedit.php')]//select[@name='role_id']", "label=Forge administrators") ;
+		$this->select($this->byXpath("//form[contains(@action,'globalroleedit.php')]//select[@name='role_id']"))->selectOptionByLabel("Forge administrators") ;
 		$this->clickAndWait("//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") ;
diff --git a/tests/func/20_FRS/FRSTest.php b/tests/func/20_FRS/FRSTest.php
index c73285b..c7154ea 100644
--- a/tests/func/20_FRS/FRSTest.php
+++ b/tests/func/20_FRS/FRSTest.php
@@ -1,6 +1,6 @@
 <?php
 /**
- * Copyright, 2014,2016, Franck Villaume - TrivialDev
+ * Copyright, 2014,2016,2019, Franck Villaume - TrivialDev
  * Copyright (C) 2015  Inria (Sylvain Beucler)
  *
  * This file is part of FusionForge.
@@ -52,7 +52,7 @@ class CreateFRS extends FForge_SeleniumTestCase
 		$this->assertTextPresent("Added Package");
 		$this->clickAndWait("link=Administration");
 		$this->type('//td[2]/input', 'My Named Packaged');
-		$this->click('//td[5]/input');
+		$this->clickAndWait('//td[5]/input');
 		$this->clickAndWait("link=View File Releases");
 		$this->assertTextPresent('My Named Package');
 	}
diff --git a/tests/func/20_Forums/forumsTest.php b/tests/func/20_Forums/forumsTest.php
index 3efa96c..a447273 100644
--- a/tests/func/20_Forums/forumsTest.php
+++ b/tests/func/20_Forums/forumsTest.php
@@ -59,19 +59,19 @@ class CreateForum extends FForge_SeleniumTestCase
 		$this->clickAndWait("link=Forums");
 		$this->assertFalse($this->isTextPresent("Permission denied."));
 		$this->assertTrue($this->isTextPresent("open-discussion"));
-		$this->click("link=open-discussion");
+		$this->clickAndWait("link=open-discussion");
 		$this->waitForPageToLoad("30000");
-		$this->click("link=Start New Thread");
+		$this->clickAndWait("link=Start New Thread");
 		$this->waitForPageToLoad("30000");
 		$this->type("subject", "Message1");
 		$this->type("body", "Text1");
-		$this->click("submit");
+		$this->clickAndWait("submit");
 		$this->waitForPageToLoad("30000");
 		$this->assertTrue($this->isTextPresent("Message Posted Successfully"));
-		$this->click("link=Forums");
+		$this->clickAndWait("link=Forums");
 		$this->waitForPageToLoad("30000");
 		$this->assertTrue($this->isTextPresent("open-discussion"));
-		$this->click("link=open-discussion");
+		$this->clickAndWait("link=open-discussion");
 		$this->waitForPageToLoad("30000");
 		$this->assertTrue($this->isTextPresent("Message1"));
 	}
@@ -115,14 +115,14 @@ class CreateForum extends FForge_SeleniumTestCase
 		$this->clickAndWait("link=Forums");
 		$this->clickAndWait("link=open-discussion");
 		$this->clickAndWait("link=Welcome to open-discussion");
-		$this->click("link=[ Reply ]");
+		$this->clickAndWait("link=[ Reply ]");
 		$this->waitForPageToLoad("30000");
 		$this->assertTrue($this->isLoginRequired());
 		$this->triggeredLogin(FORGE_ADMIN_USERNAME);
 		$this->type("body", "Here is my 19823 reply");
 		$this->clickAndWait("submit");
 		$this->assertTextPresent("Message Posted Successfully");
-		$this->click("link=Welcome to open-discussion");
+		$this->clickAndWait("link=Welcome to open-discussion");
 		$this->waitForPageToLoad("30000");
 		$this->assertTextPresent("Here is my 19823 reply");
 
@@ -136,26 +136,26 @@ class CreateForum extends FForge_SeleniumTestCase
 		$this->switchUser(FORGE_ADMIN_USERNAME);
 
 		$this->gotoProject('ProjectA');
-		$this->click("link=Mailing Lists");
+		$this->clickAndWait("link=Mailing Lists");
 		$this->waitForPageToLoad("30000");
-		$this->click("//body//main[@id='maindiv']//a[.='Administration']");
+		$this->clickAndWait("//body//main[@id='maindiv']//a[.='Administration']");
 		$this->waitForPageToLoad("30000");
-		$this->click("link=Add Mailing List");
+		$this->clickAndWait("link=Add Mailing List");
 		$this->waitForPageToLoad("30000");
 		$this->type("list_name", "toto");
 		$this->type("//input[@name='description']", "Toto mailing list");
-		$this->click("submit");
+		$this->clickAndWait("submit");
 		$this->waitForPageToLoad("30000");
 		$this->assertTrue($this->isTextPresent("List Added"));
-		$this->click("link=Forums");
+		$this->clickAndWait("link=Forums");
 		$this->waitForPageToLoad("30000");
-		$this->click("//body//main[@id='maindiv']//a[.='Administration']");
+		$this->clickAndWait("//body//main[@id='maindiv']//a[.='Administration']");
 		$this->waitForPageToLoad("30000");
-		$this->click("link=Add Forum");
+		$this->clickAndWait("link=Add Forum");
 		$this->waitForPageToLoad("30000");
 		$this->type("forum_name", "toto");
 		$this->type("//input[@name='description']", "Toto forum");
-		$this->click("submit");
+		$this->clickAndWait("submit");
 		$this->waitForPageToLoad("30000");
 		$this->assertTrue($this->isTextPresent("Error: a mailing list with the same email address already exists"));
 	}
diff --git a/tests/func/20_News/newsTest.php b/tests/func/20_News/newsTest.php
index 8179779..9ed2aa6 100644
--- a/tests/func/20_News/newsTest.php
+++ b/tests/func/20_News/newsTest.php
@@ -3,6 +3,7 @@
  * Copyright (C) 2008 Alain Peyrat <aljeux at free.fr>
  * Copyright (C) 2009 Alain Peyrat, Alcatel-Lucent
  * Copyright (C) 2015  Inria (Sylvain Beucler)
+ * Copyright 2019, Franck Villaume - TrivialDev
  *
  * This file is part of FusionForge.
  *
@@ -56,48 +57,47 @@ class CreateNews extends FForge_SeleniumTestCase
 		$this->gotoProject('ProjectA');
 
 		// Create a simple news.
-		$this->click("link=News");
+		$this->clickAndWait("link=News");
 		$this->waitForPageToLoad("30000");
-		$this->click("link=Submit");
+		$this->clickAndWait("link=Submit");
 		$this->waitForPageToLoad("30000");
 		$this->type("summary", "First news");
 		$this->type("details", "This is a simple news.");
-		$this->click("submit");
+		$this->clickAndWait("submit");
 		$this->waitForPageToLoad("30000");
-		$this->click("link=News");
+		$this->clickAndWait("link=News");
 		$this->waitForPageToLoad("30000");
 		$this->assertTrue($this->isTextPresent("First news"));
-		$this->click("link=First news");
+		$this->clickAndWait("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->click("link=News");
+		$this->clickAndWait("link=News");
 		$this->waitForPageToLoad("30000");
-		$this->click("link=Submit");
+		$this->clickAndWait("link=Submit");
 		$this->waitForPageToLoad("30000");
 		$this->type("summary", "Second news");
 		$this->type("details", "This is another text");
-		$this->click("submit");
+		$this->clickAndWait("submit");
 		$this->waitForPageToLoad("30000");
-		$this->click("link=News");
+		$this->clickAndWait("link=News");
 		$this->waitForPageToLoad("30000");
-		$this->click("link=Second news");
+		$this->clickAndWait("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->click("link=Activity");
-//		$this->waitForPageToLoad("30000");
-//		$this->assertTextPresent("First news");
-//		$this->assertTextPresent("Second news");
+		$this->clickAndWait("link=Activity");
+		$this->waitForPageToLoad("30000");
+		$this->assertTextPresent("First news");
+		$this->assertTextPresent("Second news");
 
 		// Check modification of a news.
 		$this->clickAndWait("link=News");
-		$this->click("//a[contains(@href, '" . ROOT . "/news/admin/?group_id=7')]");
+		$this->clickAndWait("//a[contains(@href, '" . ROOT . "/news/admin/?group_id=7')]");
 		$this->waitForPageToLoad("30000");
 		$this->clickAndWait("link=Second news");
 		$this->type("details", "This is another text (corrected)");
@@ -120,7 +120,6 @@ class CreateNews extends FForge_SeleniumTestCase
 		$this->clickAndWait("link=Test3");
 		$this->click("//form[@id='newsadminform']//input[@name='status' and @value=4]");
 		$this->clickAndWait("submit");
-
 	}
 
 	/**
diff --git a/tests/func/20_Surveys/surveysTest.php b/tests/func/20_Surveys/surveysTest.php
index 26a47b7..5c2c213 100644
--- a/tests/func/20_Surveys/surveysTest.php
+++ b/tests/func/20_Surveys/surveysTest.php
@@ -2,6 +2,7 @@
 /**
  * Copyright (C) 2010 Alcatel-Lucent
  * Copyright (C) 2015  Inria (Sylvain Beucler)
+ * Copyright 2019, Franck Villaume - TrivialDev
  *
  * This file is part of FusionForge.
  *
@@ -63,46 +64,46 @@ class Surveys extends FForge_SeleniumTestCase
 		$this->type("question", "This is my first question (radio) ?");
 		$this->clickAndWait("submit");
 		$this->type("question", "This is my second question (text area) ?");
-		$this->select("question_type", "label=Text Area");
+		$this->select($this->byName("question_type"))->selectOptionByLabel("Text Area");
 		$this->clickAndWait("submit");
 		$this->type("question", "This is my third question (yes/no) ?");
-		$this->select("question_type", "label=Radio Buttons Yes/No");
+		$this->select($this->byName("question_type"))->selectOptionByLabel("Radio Buttons Yes/No");
 		$this->clickAndWait("submit");
 		$this->type("question", "This is a comment line of text");
-		$this->select("question_type", "label=Comment Only");
+		$this->select($this->byName("question_type"))->selectOptionByLabel("Comment Only");
 		$this->clickAndWait("submit");
 		$this->type("question", "This is a my fifth question (text field) ?");
-		$this->select("question_type", "label=Text Field");
+		$this->select($this->byName("question_type"))->selectOptionByLabel("Text Field");
 		$this->clickAndWait("submit");
 		$this->type("question", "L'année dernière à Noël, 3 < 4, 中国 \" <em>, père & fils");
-		$this->select("question_type", "label=Text Field");
+		$this->select($this->byName("question_type"))->selectOptionByLabel("Text Field");
 		$this->clickAndWait("submit");
 
 		// Create survey
 		$this->clickAndWait("link=Add Survey");
 		$this->type("survey_title", "My first survey: L'année dernière à Noël, 3 < 4, 中国 \" <em>, père & fils");
-		$this->click("to_add[]");
-		$this->click("//input[@name='to_add[]' and @value='4']");
-		$this->click("//input[@name='to_add[]' and @value='2']");
-		$this->click("//input[@name='to_add[]' and @value='5']");
-		$this->click("//input[@name='to_add[]' and @value='3']");
+		$this->clickAndWait("to_add[]");
+		$this->clickAndWait("//input[@name='to_add[]' and @value='4']");
+		$this->clickAndWait("//input[@name='to_add[]' and @value='2']");
+		$this->clickAndWait("//input[@name='to_add[]' and @value='5']");
+		$this->clickAndWait("//input[@name='to_add[]' and @value='3']");
 		$this->clickAndWait("submit");
-		$this->click("link=My first survey: L'année dernière à Noël, 3 < 4, 中国 \" <em>, père & fils");
+		$this->clickAndWait("link=My first survey: L'année dernière à Noël, 3 < 4, 中国 \" <em>, père & fils");
 		$this->waitForPageToLoad("30000");
 		$this->assertTextPresent("This is a my fifth question (text field) ?");
 		$this->assertTextPresent("This is a comment line of text");
 		$this->assertTextPresent("This is my third question (yes/no) ?");
 		$this->assertTextPresent("This is my second question (text area) ?");
-		$this->assertTextPresent("This is my first question (radio) ?");
+		$this->clickAndWait("This is my first question (radio) ?");
 		$this->click("//input[@name='_1' and @value='3']");
 		$this->type("_2", "hello");
-		$this->click("_3");
-		$this->click("_5");
+		$this->clickAndWait("_3");
+		$this->clickAndWait("_5");
 		$this->type("_5", "text");
 		$this->clickAndWait("submit");
 		$this->clickAndWait("link=Administration");
 		$this->clickAndWait("link=Show Results");
-		$this->click("link=My first survey: L'année dernière à Noël, 3 < 4, 中国 \" <em>, père & fils");
+		$this->clickAndWait("link=My first survey: L'année dernière à Noël, 3 < 4, 中国 \" <em>, père & fils");
 		$this->waitForPageToLoad("30000");
 		$this->assertTextPresent("Warning - you are about to vote a second time on this survey.");
 		$this->clickAndWait("link=Administration");
@@ -136,9 +137,9 @@ class Surveys extends FForge_SeleniumTestCase
 		$this->clickAndWait("submit");
 		$this->clickAndWait("link=Add Survey");
 		$this->clickAndWait("link=Edit");
-		$this->click("to_add[]");
-		$this->click("//input[@name='to_add[]' and @value='8']");
-		$this->click("//input[@name='to_add[]' and @value='9']");
+		$this->clickAndWait("to_add[]");
+		$this->clickAndWait("//input[@name='to_add[]' and @value='8']");
+		$this->clickAndWait("//input[@name='to_add[]' and @value='9']");
 		$this->clickAndWait("submit");
 		$this->assertTextPresent("1, 2, 3, 4, 5, 6, 7, 8, 9");
 
diff --git a/tests/func/20_Tasks/createTaskTest.php b/tests/func/20_Tasks/createTaskTest.php
index 490f849..229085f 100644
--- a/tests/func/20_Tasks/createTaskTest.php
+++ b/tests/func/20_Tasks/createTaskTest.php
@@ -2,6 +2,7 @@
 /**
  * Copyright (C) 2010-2011 Alain Peyrat - Alcatel-Lucent
  * Copyright (C) 2015  Inria (Sylvain Beucler)
+ * Copyright 2019, Franck Villaume - TrivialDev
  *
  * This file is part of FusionForge.
  *
@@ -76,13 +77,13 @@ class CreateTask extends FForge_SeleniumTestCase
 		$this->gotoProject('ProjectA');
 
 		// Initialize "rep_time_tracking" table
-		$this->click("link=Reporting");
+		$this->clickAndWait("link=Reporting");
 		$this->waitForPageToLoad("30000");
 
-		$this->click("link=Initialize / Rebuild Reporting Tables");
+		$this->clickAndWait("link=Initialize / Rebuild Reporting Tables");
 		$this->waitForPageToLoad("30000");
-		$this->click("im_sure");
-		$this->click("submit");
+		$this->clickAndWait("im_sure");
+		$this->clickAndWait("submit");
 		$this->waitForPageToLoad("30000");
 
 	//        $this->switchUser('uadmin');
@@ -102,7 +103,7 @@ class CreateTask extends FForge_SeleniumTestCase
 		$this->type("summary", "Task1: Hello Paris");
 		$this->type("details", "Details: Hello Paris");
 		$this->type("hours", "10");
-		$this->click("//body//main[@id='maindiv']/form/table/tbody/tr[9]/td/input");
+		$this->clickAndWait("//body//main[@id='maindiv']/form/table/tbody/tr[9]/td/input");
 		$this->waitForPageToLoad("30000");
 		$this->assertTextPresent("Task Created Successfully");
 
@@ -111,7 +112,7 @@ class CreateTask extends FForge_SeleniumTestCase
 		$this->type("summary", "Task2: Hello France");
 		$this->type("details", "Details: Hello France");
 		$this->type("hours", "15");
-		$this->click("//body//main[@id='maindiv']/form/table/tbody/tr[9]/td/input");
+		$this->clickAndWait("//body//main[@id='maindiv']/form/table/tbody/tr[9]/td/input");
 		$this->waitForPageToLoad("30000");
 		$this->assertTextPresent("Task Created Successfully");
 
@@ -120,7 +121,7 @@ class CreateTask extends FForge_SeleniumTestCase
 		$this->type("summary", "Task3: Hello World");
 		$this->type("details", "Details: Hello World");
 		$this->type("hours", "20");
-		$this->click("//body//main[@id='maindiv']/form/table/tbody/tr[9]/td/input");
+		$this->clickAndWait("//body//main[@id='maindiv']/form/table/tbody/tr[9]/td/input");
 		$this->waitForPageToLoad("30000");
 		$this->assertTrue($this->isTextPresent("Task Created Successfully"));
 	}
@@ -173,7 +174,7 @@ class CreateTask extends FForge_SeleniumTestCase
 
 		// Let use close a task to sort by status
 		$this->clickAndWait("link=exact:Task1: Hello Paris");
-		$this->click("status_id");
+		$this->clickAndWait("status_id");
 		$this->select("status_id", "label=Closed");
 		$this->clickAndWait("submit");
 
@@ -273,7 +274,7 @@ class CreateTask extends FForge_SeleniumTestCase
 	{
 		// Set the completing value of a task
 		$this->select("percent_complete", "label=45%");
-		$this->click("//option[@value='45']");
+		$this->clickAndWait("//option[@value='45']");
 		$this->clickAndWait("submit");
 		$this->assertTextPresent("Task Updated Successfully");
 
@@ -293,7 +294,7 @@ class CreateTask extends FForge_SeleniumTestCase
 		$this->clickAndWait("link=To Do");
 		$this->clickAndWait("link=exact:Task3: Hello World");
 		$this->clickAndWait("link=Delete this task");
-		$this->click("confirm_delete");
+		$this->clickAndWait("confirm_delete");
 		$this->clickAndWait("submit");
 		$this->assertTextPresent("Task Successfully Deleted");
 
@@ -309,9 +310,9 @@ class CreateTask extends FForge_SeleniumTestCase
 	{
 		$this->gotoProject("ProjectA");
 		$this->waitForPageToLoad("30000");
-		$this->click("link=Tasks");
+		$this->clickAndWait("link=Tasks");
 		$this->waitForPageToLoad("30000");
-		$this->click("link=To Do");
+		$this->clickAndWait("link=To Do");
 		$this->waitForPageToLoad("30000");
 		$this->clickAndWait("link=exact:Task1: Hello Paris");
 		$this->addSelection("assigned_to[]", "label=ucontrib Lastname");
@@ -392,7 +393,7 @@ class CreateTask extends FForge_SeleniumTestCase
 	{
 		// Display activity report by developer
 		$this->clickAndWait("link=Reporting");
-		$this->select("what", "label=Report by Assignee");
+		$this->select($this->byName("what"))->selectOptionByLabel("Report by Assignee");
 		$this->clickAndWait("//input[@value='Show']");
 		$this->assertTextPresent("Tasks By Assignee");
 		$this->assertTextPresent("ucontrib");
@@ -402,7 +403,7 @@ class CreateTask extends FForge_SeleniumTestCase
 	function displayActivityReportBySubproject()
 	{
 		// Display activity report by subproject
-		$this->select("what", "label=Report by Subproject");
+		$this->select($this->byName("what"))->selectOptionByLabel("Report by Subproject");
 		$this->clickAndWait("//input[@value='Show']");
 		$this->assertTextPresent("Tasks By Category");
 		$this->assertTextPresent("To Do");
diff --git a/tests/func/SeleniumForge.php b/tests/func/SeleniumForge.php
index 653dc3b..3e690fe 100644
--- a/tests/func/SeleniumForge.php
+++ b/tests/func/SeleniumForge.php
@@ -614,6 +614,20 @@ class FForge_SeleniumTestCase extends PHPUnit_Extensions_Selenium2TestCase
 	function assertTextPresent($string) {
 		return $this->assertTrue($this->isTextPresent($string));
 	}
+
+	function check($string) {
+		$myelement = $this->byXpath($string);
+		if (!$myelement->attribute('checked')) {
+			$myelement->click();
+		}
+	}
+
+	function uncheck($string) {
+		$myelement = $this->byXpath($string);
+		if ($myelement->attribute('checked')) {
+			$myelement->click();
+		}
+	}
 }
 
 // Local Variables:

-----------------------------------------------------------------------

Summary of changes:
 tests/func/10_Site/projectsTest.php    |  4 ++--
 tests/func/20_FRS/FRSTest.php          |  4 ++--
 tests/func/20_Forums/forumsTest.php    | 30 +++++++++++++--------------
 tests/func/20_News/newsTest.php        | 33 +++++++++++++++---------------
 tests/func/20_Surveys/surveysTest.php  | 37 +++++++++++++++++-----------------
 tests/func/20_Tasks/createTaskTest.php | 29 +++++++++++++-------------
 tests/func/SeleniumForge.php           | 14 +++++++++++++
 7 files changed, 83 insertions(+), 68 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list