From 6e0b42afb1da11640bd72013128ad089b3a0ff43 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Sun, 15 Aug 2010 23:19:46 +0000
Subject: [PATCH] Add selenium tests

---
 test/{ => phpunit}/.cvsignore                 |  0
 test/{ => phpunit}/AdherentTest.php           |  6 +-
 test/{ => phpunit}/BuildDocTest.php           |  6 +-
 test/{ => phpunit}/CommandeTest.php           |  6 +-
 test/{ => phpunit}/CommonObjectTest.php       |  8 +--
 test/{ => phpunit}/CompanyBankAccountTest.php |  6 +-
 test/{ => phpunit}/ContratTest.php            |  6 +-
 test/{ => phpunit}/DateLibTest.php            |  6 +-
 test/{ => phpunit}/FactureTest.php            |  6 +-
 test/{ => phpunit}/MyTestSuite.php            |  4 +-
 test/{ => phpunit}/PropalTest.php             |  6 +-
 test/{ => phpunit}/README                     |  0
 test/{ => phpunit}/UserGroupTest.php          |  6 +-
 test/{ => phpunit}/UserTest.php               |  6 +-
 test/{ => phpunit}/phpunittest.xml            |  0
 test/selenium/test_thirdparty.xml             | 67 +++++++++++++++++++
 test/selenium/testsuite_thirdparty.xml        | 14 ++++
 17 files changed, 117 insertions(+), 36 deletions(-)
 rename test/{ => phpunit}/.cvsignore (100%)
 rename test/{ => phpunit}/AdherentTest.php (96%)
 rename test/{ => phpunit}/BuildDocTest.php (94%)
 rename test/{ => phpunit}/CommandeTest.php (96%)
 rename test/{ => phpunit}/CommonObjectTest.php (94%)
 rename test/{ => phpunit}/CompanyBankAccountTest.php (95%)
 rename test/{ => phpunit}/ContratTest.php (96%)
 rename test/{ => phpunit}/DateLibTest.php (95%)
 rename test/{ => phpunit}/FactureTest.php (96%)
 rename test/{ => phpunit}/MyTestSuite.php (96%)
 rename test/{ => phpunit}/PropalTest.php (96%)
 rename test/{ => phpunit}/README (100%)
 rename test/{ => phpunit}/UserGroupTest.php (97%)
 rename test/{ => phpunit}/UserTest.php (96%)
 rename test/{ => phpunit}/phpunittest.xml (100%)
 create mode 100644 test/selenium/test_thirdparty.xml
 create mode 100644 test/selenium/testsuite_thirdparty.xml

diff --git a/test/.cvsignore b/test/phpunit/.cvsignore
similarity index 100%
rename from test/.cvsignore
rename to test/phpunit/.cvsignore
diff --git a/test/AdherentTest.php b/test/phpunit/AdherentTest.php
similarity index 96%
rename from test/AdherentTest.php
rename to test/phpunit/AdherentTest.php
index 3257a397d48..e48096c0db2 100644
--- a/test/AdherentTest.php
+++ b/test/phpunit/AdherentTest.php
@@ -17,7 +17,7 @@
  */
 
 /**
- *      \file       test/AdherentTest.php
+ *      \file       test/phpunit/AdherentTest.php
  *		\ingroup    test
  *      \brief      This file is an example for a PHPUnit test
  *      \version    $Id$
@@ -27,8 +27,8 @@
 global $conf,$user,$langs,$db;
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
 require_once 'PHPUnit/Framework.php';
-require_once dirname(__FILE__).'/../htdocs/master.inc.php';
-require_once dirname(__FILE__).'/../htdocs/adherents/class/adherent.class.php';
+require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
+require_once dirname(__FILE__).'/../../htdocs/adherents/class/adherent.class.php';
 
 if (empty($user->id))
 {
diff --git a/test/BuildDocTest.php b/test/phpunit/BuildDocTest.php
similarity index 94%
rename from test/BuildDocTest.php
rename to test/phpunit/BuildDocTest.php
index 0c0e787e37d..619b904b6fd 100644
--- a/test/BuildDocTest.php
+++ b/test/phpunit/BuildDocTest.php
@@ -17,7 +17,7 @@
  */
 
 /**
- *      \file       test/BuildDocTest.php
+ *      \file       test/phpunit/BuildDocTest.php
  *		\ingroup    test
  *      \brief      This file is an example for a PHPUnit test
  *      \version    $Id$
@@ -27,8 +27,8 @@
 global $conf,$user,$langs,$db;
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
 require_once 'PHPUnit/Framework.php';
-require_once dirname(__FILE__).'/../htdocs/master.inc.php';
-require_once dirname(__FILE__).'/../htdocs/compta/facture/class/facture.class.php';
+require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
+require_once dirname(__FILE__).'/../../htdocs/compta/facture/class/facture.class.php';
 
 if (empty($user->id))
 {
diff --git a/test/CommandeTest.php b/test/phpunit/CommandeTest.php
similarity index 96%
rename from test/CommandeTest.php
rename to test/phpunit/CommandeTest.php
index b3e6b0ce299..c07b119881e 100644
--- a/test/CommandeTest.php
+++ b/test/phpunit/CommandeTest.php
@@ -17,7 +17,7 @@
  */
 
 /**
- *      \file       test/CommandeTest.php
+ *      \file       test/phpunit/CommandeTest.php
  *		\ingroup    test
  *      \brief      This file is an example for a PHPUnit test
  *      \version    $Id$
@@ -27,8 +27,8 @@
 global $conf,$user,$langs,$db;
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
 require_once 'PHPUnit/Framework.php';
-require_once dirname(__FILE__).'/../htdocs/master.inc.php';
-require_once dirname(__FILE__).'/../htdocs/commande/class/commande.class.php';
+require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
+require_once dirname(__FILE__).'/../../htdocs/commande/class/commande.class.php';
 
 if (empty($user->id))
 {
diff --git a/test/CommonObjectTest.php b/test/phpunit/CommonObjectTest.php
similarity index 94%
rename from test/CommonObjectTest.php
rename to test/phpunit/CommonObjectTest.php
index 0c148c7da6f..22af5847a63 100644
--- a/test/CommonObjectTest.php
+++ b/test/phpunit/CommonObjectTest.php
@@ -17,7 +17,7 @@
  */
 
 /**
- *      \file       test/CommonObjectTest.php
+ *      \file       test/phpunit/CommonObjectTest.php
  *		\ingroup    test
  *      \brief      This file is an example for a PHPUnit test
  *      \version    $Id$
@@ -27,9 +27,9 @@
 global $conf,$user,$langs,$db;
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
 require_once 'PHPUnit/Framework.php';
-require_once dirname(__FILE__).'/../htdocs/master.inc.php';
-require_once dirname(__FILE__).'/../htdocs/commande/class/commande.class.php';
-require_once dirname(__FILE__).'/../htdocs/projet/class/project.class.php';
+require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
+require_once dirname(__FILE__).'/../../htdocs/commande/class/commande.class.php';
+require_once dirname(__FILE__).'/../../htdocs/projet/class/project.class.php';
 
 if (empty($user->id))
 {
diff --git a/test/CompanyBankAccountTest.php b/test/phpunit/CompanyBankAccountTest.php
similarity index 95%
rename from test/CompanyBankAccountTest.php
rename to test/phpunit/CompanyBankAccountTest.php
index bdec9452a56..2fd8f567095 100644
--- a/test/CompanyBankAccountTest.php
+++ b/test/phpunit/CompanyBankAccountTest.php
@@ -17,7 +17,7 @@
  */
 
 /**
- *      \file       test/CompanyBankAccount.php
+ *      \file       test/phpunit/CompanyBankAccount.php
  *		\ingroup    test
  *      \brief      This file is an example for a PHPUnit test
  *      \version    $Id$
@@ -27,8 +27,8 @@
 global $conf,$user,$langs,$db;
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
 require_once 'PHPUnit/Framework.php';
-require_once dirname(__FILE__).'/../htdocs/master.inc.php';
-require_once dirname(__FILE__).'/../htdocs/societe/class/companybankaccount.class.php';
+require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
+require_once dirname(__FILE__).'/../../htdocs/societe/class/companybankaccount.class.php';
 
 if (empty($user->id))
 {
diff --git a/test/ContratTest.php b/test/phpunit/ContratTest.php
similarity index 96%
rename from test/ContratTest.php
rename to test/phpunit/ContratTest.php
index 61d1118262b..bcad727db5e 100644
--- a/test/ContratTest.php
+++ b/test/phpunit/ContratTest.php
@@ -17,7 +17,7 @@
  */
 
 /**
- *      \file       test/ContratTest.php
+ *      \file       test/phpunit/ContratTest.php
  *		\ingroup    test
  *      \brief      This file is an example for a PHPUnit test
  *      \version    $Id$
@@ -27,8 +27,8 @@
 global $conf,$user,$langs,$db;
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
 require_once 'PHPUnit/Framework.php';
-require_once dirname(__FILE__).'/../htdocs/master.inc.php';
-require_once dirname(__FILE__).'/../htdocs/contrat/class/contrat.class.php';
+require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
+require_once dirname(__FILE__).'/../../htdocs/contrat/class/contrat.class.php';
 
 if (empty($user->id))
 {
diff --git a/test/DateLibTest.php b/test/phpunit/DateLibTest.php
similarity index 95%
rename from test/DateLibTest.php
rename to test/phpunit/DateLibTest.php
index 592cf8af8d1..4a2182b6247 100644
--- a/test/DateLibTest.php
+++ b/test/phpunit/DateLibTest.php
@@ -17,7 +17,7 @@
  */
 
 /**
- *      \file       test/DateLibTest.php
+ *      \file       test/phpunit/DateLibTest.php
  *		\ingroup    test
  *      \brief      This file is an example for a PHPUnit test
  *      \version    $Id$
@@ -27,8 +27,8 @@
 global $conf,$user,$langs,$db;
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
 require_once 'PHPUnit/Framework.php';
-require_once dirname(__FILE__).'/../htdocs/master.inc.php';
-require_once dirname(__FILE__).'/../htdocs/lib/date.lib.php';
+require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
+require_once dirname(__FILE__).'/../../htdocs/lib/date.lib.php';
 
 if (empty($user->id))
 {
diff --git a/test/FactureTest.php b/test/phpunit/FactureTest.php
similarity index 96%
rename from test/FactureTest.php
rename to test/phpunit/FactureTest.php
index 3b79653de28..c8a40fb5175 100644
--- a/test/FactureTest.php
+++ b/test/phpunit/FactureTest.php
@@ -17,7 +17,7 @@
  */
 
 /**
- *      \file       test/FactureTest.php
+ *      \file       test/phpunit/FactureTest.php
  *		\ingroup    test
  *      \brief      This file is an example for a PHPUnit test
  *      \version    $Id$
@@ -27,8 +27,8 @@
 global $conf,$user,$langs,$db;
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
 require_once 'PHPUnit/Framework.php';
-require_once dirname(__FILE__).'/../htdocs/master.inc.php';
-require_once dirname(__FILE__).'/../htdocs/compta/facture/class/facture.class.php';
+require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
+require_once dirname(__FILE__).'/../../htdocs/compta/facture/class/facture.class.php';
 
 if (empty($user->id))
 {
diff --git a/test/MyTestSuite.php b/test/phpunit/MyTestSuite.php
similarity index 96%
rename from test/MyTestSuite.php
rename to test/phpunit/MyTestSuite.php
index 13fb364ad87..6bf7d1b9609 100644
--- a/test/MyTestSuite.php
+++ b/test/phpunit/MyTestSuite.php
@@ -17,7 +17,7 @@
  */
 
 /**
- *      \file       test/MyTestSuite.php
+ *      \file       test/phpunit/MyTestSuite.php
  *		\ingroup    test
  *      \brief      This file is a test suite to run all unit tests
  *      \version    $Id$
@@ -29,7 +29,7 @@ print "Memory: ". ini_get('memory_limit')."\n";
 global $conf,$user,$langs,$db;
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
 require_once 'PHPUnit/Framework.php';
-require_once dirname(__FILE__).'/../htdocs/master.inc.php';
+require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
 
 if (empty($user->id))
 {
diff --git a/test/PropalTest.php b/test/phpunit/PropalTest.php
similarity index 96%
rename from test/PropalTest.php
rename to test/phpunit/PropalTest.php
index 7beed32501e..3b47b430f3f 100644
--- a/test/PropalTest.php
+++ b/test/phpunit/PropalTest.php
@@ -17,7 +17,7 @@
  */
 
 /**
- *      \file       test/PropalTest.php
+ *      \file       test/phpunit/PropalTest.php
  *		\ingroup    test
  *      \brief      This file is an example for a PHPUnit test
  *      \version    $Id$
@@ -27,8 +27,8 @@
 global $conf,$user,$langs,$db;
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
 require_once 'PHPUnit/Framework.php';
-require_once dirname(__FILE__).'/../htdocs/master.inc.php';
-require_once dirname(__FILE__).'/../htdocs/comm/propal/class/propal.class.php';
+require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
+require_once dirname(__FILE__).'/../../htdocs/comm/propal/class/propal.class.php';
 
 if (empty($user->id))
 {
diff --git a/test/README b/test/phpunit/README
similarity index 100%
rename from test/README
rename to test/phpunit/README
diff --git a/test/UserGroupTest.php b/test/phpunit/UserGroupTest.php
similarity index 97%
rename from test/UserGroupTest.php
rename to test/phpunit/UserGroupTest.php
index 93791088d9d..fddbad3fcb3 100644
--- a/test/UserGroupTest.php
+++ b/test/phpunit/UserGroupTest.php
@@ -17,7 +17,7 @@
  */
 
 /**
- *      \file       test/UserGroupTest.php
+ *      \file       test/phpunit/UserGroupTest.php
  *		\ingroup    test
  *      \brief      This file is an example for a PHPUnit test
  *      \version    $Id$
@@ -27,8 +27,8 @@
 global $conf,$user,$langs,$db;
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
 require_once 'PHPUnit/Framework.php';
-require_once dirname(__FILE__).'/../htdocs/master.inc.php';
-require_once dirname(__FILE__).'/../htdocs/user/class/usergroup.class.php';
+require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
+require_once dirname(__FILE__).'/../../htdocs/user/class/usergroup.class.php';
 
 if (empty($user->id))
 {
diff --git a/test/UserTest.php b/test/phpunit/UserTest.php
similarity index 96%
rename from test/UserTest.php
rename to test/phpunit/UserTest.php
index 1ffd9c707db..a31d5dd7887 100644
--- a/test/UserTest.php
+++ b/test/phpunit/UserTest.php
@@ -17,7 +17,7 @@
  */
 
 /**
- *      \file       test/UserTest.php
+ *      \file       test/phpunit/UserTest.php
  *		\ingroup    test
  *      \brief      This file is an example for a PHPUnit test
  *      \version    $Id$
@@ -27,8 +27,8 @@
 global $conf,$user,$langs,$db;
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
 require_once 'PHPUnit/Framework.php';
-require_once dirname(__FILE__).'/../htdocs/master.inc.php';
-require_once dirname(__FILE__).'/../htdocs/user/class/user.class.php';
+require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
+require_once dirname(__FILE__).'/../../htdocs/user/class/user.class.php';
 
 if (empty($user->id))
 {
diff --git a/test/phpunittest.xml b/test/phpunit/phpunittest.xml
similarity index 100%
rename from test/phpunittest.xml
rename to test/phpunit/phpunittest.xml
diff --git a/test/selenium/test_thirdparty.xml b/test/selenium/test_thirdparty.xml
new file mode 100644
index 00000000000..36783bbcbd2
--- /dev/null
+++ b/test/selenium/test_thirdparty.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>Création tiers (UCTP01)</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">Création tiers (UCTP01)</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/dolibarrnew/fourn/fiche.php?socid=14</td>
+	<td></td>
+</tr>
+<tr>
+	<td>clickAndWait</td>
+	<td>//a[@id='mainmenua_companies']/span</td>
+	<td></td>
+</tr>
+<tr>
+	<td>clickAndWait</td>
+	<td>link=Nouveau tiers</td>
+	<td></td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>nom</td>
+	<td>SeleThirdParty2</td>
+</tr>
+<tr>
+	<td>selectAndWait</td>
+	<td>pays_id</td>
+	<td>label=FR - France</td>
+</tr>
+<tr>
+	<td>select</td>
+	<td>departement_id</td>
+	<td>label=01 - Ain</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>cp</td>
+	<td>59500</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>ville</td>
+	<td>ville</td>
+</tr>
+<tr>
+	<td>select</td>
+	<td>default_lang</td>
+	<td>label=Français</td>
+</tr>
+<tr>
+	<td>clickAndWait</td>
+	<td>//input[@value='Créer tiers']</td>
+	<td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/test/selenium/testsuite_thirdparty.xml b/test/selenium/testsuite_thirdparty.xml
new file mode 100644
index 00000000000..b1f15239c50
--- /dev/null
+++ b/test/selenium/testsuite_thirdparty.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+  <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
+  <title>Test Suite</title>
+</head>
+<body>
+<table id="suiteTable" cellpadding="1" cellspacing="1" border="1" class="selenium"><tbody>
+<tr><td><b>Test Suite</b></td></tr>
+<tr><td><a href="test_thirdparty.xml">test_thirdparty</a></td></tr>
+</tbody></table>
+</body>
+</html>
-- 
GitLab