Make selenium tests full dynamics, no more build_tests.php required.
authorJehan-Guillaume (ioguix) de Rorthais <ioguix@free.fr>
Thu, 29 Dec 2011 23:36:12 +0000 (00:36 +0100)
committerJehan-Guillaume (ioguix) de Rorthais <ioguix@free.fr>
Thu, 29 Dec 2011 23:36:12 +0000 (00:36 +0100)
19 files changed:
.gitignore
build_tests.php [deleted file]
intro.php
libraries/errorhandler.inc.php
tests/selenium/README
tests/selenium/TestSuite.php [new file with mode: 0755]
tests/selenium/src/01-roles.php
tests/selenium/src/04-database.php
tests/selenium/src/06-schema.php
tests/selenium/src/08-domaine.php
tests/selenium/src/10-table.php
tests/selenium/src/15-sequence.php
tests/selenium/src/20-constraint.php
tests/selenium/src/25-column.php
tests/selenium/src/30-view.php
tests/selenium/src/35-index.php
tests/selenium/src/99-cleantests.php
tests/selenium/src/skeleton.php-dist [new file with mode: 0644]
tests/selenium/testBuilder.class.php

index d753bfab7729277e8281e26195f17d4471638ee4..afa3529a5c8c4e73fa3d33bb5027d472638c4d86 100644 (file)
@@ -1,4 +1,2 @@
 selenium/tests/config.inc.php
 tests/selenium/config.test.php
-tests/selenium/TestSuite.html
-tests/selenium/static
diff --git a/build_tests.php b/build_tests.php
deleted file mode 100755 (executable)
index d4de296..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-#!/usr/bin/php
-<?php
-
-       /**
-        * Build the test files for each servers in conf/config.inc.php according to the pg backend version.
-        */
-
-       require('./conf/config.inc.php');
-
-       $test_dir = './tests/selenium/';
-       $test_src_dir = "{$test_dir}src/";
-       $test_static_dir = "{$test_dir}static/";
-       $testsuite_file = "{$test_static_dir}TestSuite.html";
-
-       if(isset($argv[1]) && ($argv[1] == 'clean')) {
-               echo "Cleaning...";
-               /* delete server directories */
-               foreach ($conf['servers'] as $server) {
-                       $dir = "{$test_static_dir}{$server['desc']}";
-                       while(is_dir($dir)) {
-                               $dh = opendir($dir);
-                               while($file = readdir($dh))
-                                       if (($file != '.') && ($file != '..')) unlink("{$dir}/{$file}");
-                               rmdir($dir);
-                       } 
-               }
-               /* delete the TestSuite.html file */
-               @unlink($testsuite_file);
-               echo "done.\n";
-
-               exit;
-       }
-
-       // Include application functions
-       require('./tests/selenium/config.test.php');
-       define('ADODB_ERROR_HANDLER','');
-       require('./classes/database/Connection.php');
-       require('./lang/recoded/english.php');
-       require('./tests/selenium/testBuilder.class.php');
-
-       /* create directory for tests static files */
-       if(!is_dir($test_static_dir))
-               mkdir($test_static_dir);
-
-       /* create the TestSuite.html file with its html header */
-       $fd = fopen($testsuite_file, 'w');
-       fprintf($fd, "<table border=\"1\">
-               <tr>
-                       <th>Test suite for PPA</th>
-               </tr>\n");
-       fclose($fd);
-
-       /* Loop on the servers given in the conf/config.inc.conf file */
-       foreach ($conf['servers'] as $server) {
-               // Is this server in our list of configured servers?
-               if (!in_array($server['desc'],$test_servers))
-                       continue;
-
-               /* connect to the server to get its version
-                * and test its feature along the tests */
-               $_c = new Connection($server['host'],
-                       $server['port'],
-                       $server['sslmode'],
-                       $super_user[$server['desc']],
-                       $super_pass[$server['desc']],
-                       $server['defaultdb']
-               );
-
-               $_type = $data = null;
-               if (! $_c->conn->isConnected())
-                       die ("Connection to {$server['desc']} failed !\n");
-               else {
-                       if (($_type = $_c->getDriver($platform)) === null) {
-                               die( printf($lang['strpostgresqlversionnotsupported'], $postgresqlMinVer));
-                       }
-                       /* create the database handler we are going to use in the tests creator scripts */
-                       include_once('./classes/database/' . $_type . '.php');
-                       $data = new $_type($_c->conn);
-                       $data->platform = $_c->platform;
-               }
-
-               fprintf(STDERR, "Connected to %s...\n", $server['desc']);
-
-               if (!is_dir("{$test_static_dir}/{$server['desc']}"))
-                       mkdir("{$test_static_dir}/{$server['desc']}");
-
-               $fd = opendir($test_src_dir);
-               $files = array();
-               while ($file = readdir($fd))
-                       if (($file != '.') && ($file != '..'))
-                               $files[] = $file;
-               sort($files);
-               /* include the tests creator scripts here
-                * in the order you want them executed.
-                * Each script append itself to the TestSuite.html file.
-                **/
-               foreach ($files as $testgroupfile)
-                       require("{$test_src_dir}/{$testgroupfile}");
-       }
-
-       /* close the TestSuite.html file */
-       $fd = fopen($testsuite_file, 'a');
-       fprintf($fd, "</table>");
-       fclose($fd);
-
-       /* Tests ready to be runned on all your configured servers !!!! */
-?>
index c2b2969bd744f07ec293f6432b5aa8fecc411e35..7f5c039730137379daef9ee35718b511f42ae431 100755 (executable)
--- a/intro.php
+++ b/intro.php
@@ -62,7 +62,7 @@
        <li><a href="<?php echo $lang['strpgsqlhome_url'] ?>"><?php echo $lang['strpgsqlhome'] ?></a></li>
        <li><a href="http://sourceforge.net/tracker/?group_id=37132&amp;atid=418980"><?php echo $lang['strreportbug'] ?></a></li>
        <li><a href="<?php echo $lang['strviewfaq_url'] ?>"><?php echo $lang['strviewfaq'] ?></a></li>
-       <li><a target="_top" href="tests/selenium/selenium-lib/core/TestRunner.html?test=..%2F..%2Fstatic%2FTestSuite.html&resultsUrl=..%2FpostResults">Selenium tests</a></li>
+       <li><a target="_top" href="tests/selenium/selenium-lib/core/TestRunner.html?test=..%2F..%2FTestSuite.php&resultsUrl=..%2FpostResults">Selenium tests</a></li>
 </ul>
 
 <?php
index fd9420be3721245159f0f03f61cb0efa0a3b79c6..11e93b2bbde8da2998e99ab3edc48f26e9ebc580 100644 (file)
@@ -6,7 +6,8 @@
  * $Id: errorhandler.inc.php,v 1.20 2005/11/13 08:39:49 chriskl Exp $
  */
 
-define('ADODB_ERROR_HANDLER','Error_Handler');
+if (! defined('ADODB_ERROR_HANDLER'))
+       define('ADODB_ERROR_HANDLER','Error_Handler');
 
 /**
  * Default Error Handler. This will be called with the following params
index 3125e38cd59192145e230f141b08a488a30b1687..a01d5d466d28496980f3a48cf16c0befaaa1ea0b 100644 (file)
@@ -1,27 +1,25 @@
-HowTo run the tests follow these steps :
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+HowTo run the tests
+~~~~~~~~~~~~~~~~~~~
 
 1. Create & configure your ./tests/selenium/config.test.php (See sample one in ./tests/selenium/config.inc.php-dist).
-2. Run the ./build_tests.php script
-       This script builds the TestSuite.html file and all the related html tests files in ./tests/selenium/static/.
-       It builds one directory for each server selected to run the tests in your ./tests/selenium/config.inc.php
-       and creates the static selenium html test files for each of them.
-3. Open your browser and go to http://$webUrl/
-       Where $webUrl is the value set in your ./tests/selenium/config.inc.php
-4. Click on "Selenium tests" on the PPA intro page & run the tests using the "Selenium TestRunner" buttons in the top-right frame.
+2. Open your browser and go to http://$webUrl/
+Where $webUrl is the value set in your ./tests/selenium/config.inc.php
+3. Click on "Selenium tests" on the PPA intro page & run the tests using the "Selenium TestRunner" buttons in the top-right frame.
 
 Enjoy the tests.
 
 
-HowTo write new tests:
+HowTo write new tests
 ~~~~~~~~~~~~~~~~~~~~~
-The selenium's HTML tests files cannot behave differently in regard to the PG backend where the tests are run on. In order to address
-this issue we are using "test-builder" scripts to create these static HTML files. These scripts are connected to each backends using
-the PPA database classes and allow you to use their methods, and especialy the $data->has*() ones,  throught the $data variable like 
-in any other ppa script.
 
-1. how build_tests is working and why
-The build_tests.php script is processing the test-builders scripts from ./tests/selenium/src in alphanumeric order. That's why each
+Normaly, the selenium's statis HTML tests files cannot behave differently in regard to the PG backend where the tests are run on. In order to address
+this issue we are using PHP scripts that connect to each backends using the PPA database classes and allow you to use their methods,
+and especialy the $data->has*() ones,  throught the $data variable like in any other ppa script.
+
+TestSuite.php is the test suite script that build the list of tests groups (top left frame).
+
+1. how TestSuite.php is working and why
+TestSuite.php script is processing the test-builders scripts from ./tests/selenium/src in alphanumeric order. That's why each
 test-builder's name should follow these rules: begin with 2numeric number, then -, then the script name (ex. 01-test1.php or 46-test46.php).
 
 It allows to enforce the order the scripts will be run during the testSuite. This way, column's tests could be run *after* the table's tests
@@ -29,30 +27,21 @@ in the test suite and use the previous created tables.
 
 2. how test-builder are working
 
-These scripts are included and executed in the build_tests.php in alphanumeric order.
-They should:
-- begin with the declaration of the global values $testsuite_file and $test_static_dir which holds the paths to the TestSuite file
-and the static folder where the HTML tests files are created
+These scripts are included and executed in TestSuite.php in alphanumeric order. See comments in file ./tests/selenium/src/skeleton.php-dist
+which is a template of test-builder.
+When executed from TestSuite.php, test-builders should:
 - create a "TestBuilder" intance which gonna helps write HTML tests quickly. 
        The constructor takes the following arguments:
-       - server's label (from your config.inc.php)
        - HTML title of the page
        - Test description (appears on top of the tests table)
 
-       $t = new TestBuilder($server['desc'],
-               'Index tests',
+       $t = new TestBuilder('Index tests',
                'Create/Drop an unique Index'
        );
 
 - once the TestBuilder instance is created, you can use it to write our tests.
-       - In particular, you should use the login($username, $pass) and logout() methods to create appropriate steps to login/logout to the current
+       - You should use the login($username, $pass) and logout() methods to create appropriate steps to login/logout to the current
        server.
        - Each selenium actions are mapped (or should be) as methods. As instance, if you want to use the clickAndWait action, you should call the
        clickAndWait($locator) method. For the assertText, assertText($selector, $value), etc...
        - Use the addComment method to show comments anywhere in the tests page. Usefull to explain whatthe next tests are going to do.
-
-- finish whith calling the TestBuilder's "writeTests" method which will create the selenium HTML test file in the static dir and append this
-new test file to the testSuite file.
-
-       $t->writeTests("{$test_static_dir}/{$server['desc']}/view.html", $testsuite_file);
-
diff --git a/tests/selenium/TestSuite.php b/tests/selenium/TestSuite.php
new file mode 100755 (executable)
index 0000000..0943503
--- /dev/null
@@ -0,0 +1,52 @@
+<?php
+       /**
+        * Build the test files for each servers in config.test.php
+        */
+
+       chdir('../..'); /* go back to root so we can include scripts */
+
+       function oops($dbms, $fn, $errno, $errmsg, $p1=false, $p2=false) {
+               echo "</table><div>{$errmsg}</div>\n";
+               exit;
+       }
+       
+       $_no_db_connection = true; /* load lib.inc.php without trying to connect */
+
+       require_once('./libraries/lib.inc.php');
+       require('./tests/selenium/config.test.php');
+       require_once('./classes/database/Connection.php');
+
+       $test_dir = './tests/selenium';
+       $test_src_dir = "{$test_dir}/src";
+
+       echo "<table border=\"1\">
+               <tr>
+                       <th>Test suite for PPA</th>
+               </tr>\n";
+
+       $servers = $misc->getServers();
+
+       /* Loop on the servers given in the conf/config.inc.conf file */
+       foreach ($servers as $server) {
+               // Is this server in our list of configured servers?
+               if (!in_array($server['desc'], $test_servers))
+                       continue;
+
+               $fd = opendir($test_src_dir);
+               $files = array();
+               while ($file = readdir($fd))
+                       if (preg_match('@[0-9]+.*\.php$@', $file))
+                               $files[] = $file;
+               closedir($fd);
+               sort($files);
+               /* include the tests creator scripts here
+                * in the order you want them executed.
+                * Each script append itself to the TestSuite.html file.
+                **/
+               foreach ($files as $testgroupfile) {
+                       require("{$test_src_dir}/{$testgroupfile}");
+                       echo "<tr><td><a href=\"{$webUrl}/{$test_src_dir}/{$testgroupfile}?server={$server['id']}&amp;run=1\">[{$server['desc']}] {$test_title}</a></td></tr>\n";
+               }
+       }
+       echo "</table>";
+?>
index cb1bb10f16440528ab779e4667e0a715894dadce..e15f1897ea8a943ad72e13e5d55979e3b90a871e 100644 (file)
 <?php
-       global $testsuite_file, $test_static_dir;
+       $test_title = 'Roles, Users and Groups tests';
 
-       /*
-        * 1/ login as superuser
-        * 2/ create admin_user role/user with wrong pass conf -> fail
-        * 3/ create admin_user
-        * 4/ logout & login as admin_user
-        * 5/ create user role/user with altered name, pass and props
-        * 6/ alter user back to the normal value
-        * NB: droping role tests are in the cleantests.php tests
-        */
-       $t = new TestBuilder($server['desc'],
-               'Roles, Users and Groups tests',
-               'Create test admin role, test user role and tests Roles (or user/groups) features.'
-       );
+       if (isset($_GET['run'])) {
+               global $lang;
+               require('../config.test.php');
+               require('../testBuilder.class.php');
+               /*
+                * 1/ login as superuser
+                * 2/ create admin_user role/user with wrong pass conf -> fail
+                * 3/ create admin_user
+                * 4/ logout & login as admin_user
+                * 5/ create user role/user with altered name, pass and props
+                * 6/ alter user back to the normal value
+                * NB: droping role tests are in the cleantests.php tests
+                */
+               $t = new TestBuilder($test_title,
+                       'Create test admin role, test user role and tests Roles (or user/groups) features.'
+               );
 
-       /* 1 */
-       $t->addComment('1. login as superuser');
-       $t->login($super_user[$server['desc']], $super_pass[$server['desc']]);
+               /* 1 */
+               $t->addComment('1. login as superuser');
+               $t->login($super_user[$t->server['desc']], $super_pass[$t->server['desc']]);
 
-       /* 2 */
-       $t->addComment('2. create admin_user role/user with wrong pass conf -> fail');
-       if ($data->hasRoles()) {
-               $t->clickAndWait("link={$lang['strroles']}");
-               $t->clickAndWait("link={$lang['strcreaterole']}");
-               $t->type('formRolename', $admin_user);
-               $t->click('formCreateRole');
-               $t->click('formInherits');
-               $t->click('formCanLogin');
-       } else {
-               $t->clickAndWait("link={$lang['strusers']}");
-               $t->clickAndWait("link={$lang['strcreateuser']}");
-               $t->type('formUsername', $admin_user);
-       }
-       $t->type('formPassword', "{$admin_user_pass}bad");
-       $t->type('formConfirm', $admin_user_pass);
-       $t->click('formSuper');
-       $t->click('formCreateDB');
-       $t->clickAndWait('create');
-       $t->assertText("//p[@class='message']", $lang['strpasswordconfirm']);
+               /* 2 */
+               $t->addComment('2. create admin_user role/user with wrong pass conf -> fail');
+               if ($t->data->hasRoles()) {
+                       $t->clickAndWait("link={$lang['strroles']}");
+                       $t->clickAndWait("link={$lang['strcreaterole']}");
+                       $t->type('formRolename', $admin_user);
+                       $t->click('formCreateRole');
+                       $t->click('formInherits');
+                       $t->click('formCanLogin');
+               } else {
+                       $t->clickAndWait("link={$lang['strusers']}");
+                       $t->clickAndWait("link={$lang['strcreateuser']}");
+                       $t->type('formUsername', $admin_user);
+               }
+               $t->type('formPassword', "{$admin_user_pass}bad");
+               $t->type('formConfirm', $admin_user_pass);
+               $t->click('formSuper');
+               $t->click('formCreateDB');
+               $t->clickAndWait('create');
+               $t->assertText("//p[@class='message']", $lang['strpasswordconfirm']);
 
-       /* 3 */
-       $t->addComment('3. create admin_user');
-       $t->type('formPassword', $admin_user_pass);
-       $t->type('formConfirm', $admin_user_pass);
-       $t->clickAndWait('create');
-       if ($data->hasRoles())
-               $t->assertText("//p[@class='message']", $lang['strrolecreated']);
-       else
-               $t->assertText("//p[@class='message']", $lang['strusercreated']);
+               /* 3 */
+               $t->addComment('3. create admin_user');
+               $t->type('formPassword', $admin_user_pass);
+               $t->type('formConfirm', $admin_user_pass);
+               $t->clickAndWait('create');
+               if ($t->data->hasRoles())
+                       $t->assertText("//p[@class='message']", $lang['strrolecreated']);
+               else
+                       $t->assertText("//p[@class='message']", $lang['strusercreated']);
 
-       /* 4 */
-       $t->addComment('4. logout & login as admin_user');
-       $t->logout();
-       $t->login($admin_user, $admin_user_pass);
+               /* 4 */
+               $t->addComment('4. logout & login as admin_user');
+               $t->logout();
+               $t->login($admin_user, $admin_user_pass);
 
 
-       /* 5 */
-       $current_user="{$user}toalter";
-       $t->addComment('5. create user role/user with altered name, pass and props');
-       if ($data->hasRoles()) {
-               $t->clickAndWait("link={$lang['strroles']}");
-               $t->clickAndWait("link={$lang['strcreaterole']}");
-               $t->type('formRolename', "{$user}toalter");
-               $t->check('formCanLogin');
-               $t->check('formCreateRole'); // will be revert
-               $t->check('formInherits'); // will be revert
-       } else {
-               $t->clickAndWait("link={$lang['strusers']}");
-               $t->clickAndWait("link={$lang['strcreateuser']}");
-               if ($data->hasUserRename())
-                       $t->type('formUsername', "{$user}toalter");
+               /* 5 */
+               $current_user="{$user}toalter";
+               $t->addComment('5. create user role/user with altered name, pass and props');
+               if ($t->data->hasRoles()) {
+                       $t->clickAndWait("link={$lang['strroles']}");
+                       $t->clickAndWait("link={$lang['strcreaterole']}");
+                       $t->type('formRolename', "{$user}toalter");
+                       $t->check('formCanLogin');
+                       $t->check('formCreateRole'); // will be revert
+                       $t->check('formInherits'); // will be revert
+               } else {
+                       $t->clickAndWait("link={$lang['strusers']}");
+                       $t->clickAndWait("link={$lang['strcreateuser']}");
+                       if ($t->data->hasUserRename())
+                               $t->type('formUsername', "{$user}toalter");
+                       else {
+                               $t->type('formUsername', $user);
+                               $current_user=$user;
+                       }
+               }
+               $t->check('formSuper'); // will be revert
+               $t->check('formCreateDB'); // will be revert
+               $t->type('formPassword', "{$user_pass}toalter");
+               $t->type('formConfirm', "{$user_pass}toalter");
+               $t->clickAndWait('create');
+               if ($t->data->hasRoles()) {
+                       $t->assertText("//p[@class='message']", $lang['strrolecreated']);
+                       $t->assertText("//tr/td/a[text()='{$user}toalter']", "{$user}toalter");
+                       $t->assertText("//tr/td/a[text()='{$user}toalter']/../../td[2]", $lang['stryes']);//super user ?
+                       $t->assertText("//tr/td/a[text()='{$user}toalter']/../../td[3]", $lang['stryes']);//create db ?
+                       $t->assertText("//tr/td/a[text()='{$user}toalter']/../../td[4]", $lang['stryes']); //create role
+                       $t->assertText("//tr/td/a[text()='{$user}toalter']/../../td[5]", $lang['stryes']); //inherit
+                       $t->assertText("//tr/td/a[text()='{$user}toalter']/../../td[6]", $lang['stryes']); //can login
+               }
                else {
-                       $t->type('formUsername', $user);
-                       $current_user=$user;
+                       $t->assertText("//p[@class='message']", $lang['strusercreated']);
+                       $t->assertText("//tr/td[text()='{$current_user}']", $current_user);
+                       $t->assertText("//tr/td[text()='{$current_user}']/../td[2]", $lang['stryes']);//super user ?
+                       $t->assertText("//tr/td[text()='{$current_user}']/../td[3]", $lang['stryes']);//create db ?
                }
-       }
-       $t->check('formSuper'); // will be revert
-       $t->check('formCreateDB'); // will be revert
-       $t->type('formPassword', "{$user_pass}toalter");
-       $t->type('formConfirm', "{$user_pass}toalter");
-       $t->clickAndWait('create');
-       if ($data->hasRoles()) {
-               $t->assertText("//p[@class='message']", $lang['strrolecreated']);
-               $t->assertText("//tr/td/a[text()='{$user}toalter']", "{$user}toalter");
-               $t->assertText("//tr/td/a[text()='{$user}toalter']/../../td[2]", $lang['stryes']);//super user ?
-               $t->assertText("//tr/td/a[text()='{$user}toalter']/../../td[3]", $lang['stryes']);//create db ?
-               $t->assertText("//tr/td/a[text()='{$user}toalter']/../../td[4]", $lang['stryes']); //create role
-               $t->assertText("//tr/td/a[text()='{$user}toalter']/../../td[5]", $lang['stryes']); //inherit
-               $t->assertText("//tr/td/a[text()='{$user}toalter']/../../td[6]", $lang['stryes']); //can login
-       }
-       else {
-               $t->assertText("//p[@class='message']", $lang['strusercreated']);
-               $t->assertText("//tr/td[text()='{$current_user}']", $current_user);
-               $t->assertText("//tr/td[text()='{$current_user}']/../td[2]", $lang['stryes']);//super user ?
-               $t->assertText("//tr/td[text()='{$current_user}']/../td[3]", $lang['stryes']);//create db ?
-       }
 
-       /* 6 */
-       $t->addComment('6. alter user back to the normal value');
-       if ($data->hasRoles()) {
-               $t->clickAndWait("link={$lang['strroles']}");
-               $t->clickAndWait("link={$user}toalter");
-               $t->clickAndWait("link={$lang['stralter']}");
-               $t->type('formNewRoleName', $user);
-               $t->uncheck('formCreateRole'); // revert
-               $t->uncheck('formInherits'); // revert
-       } else {
-               $t->clickAndWait("link={$lang['strusers']}");
-               if ($data->hasUserRename()) {
-                       $t->clickAndWait("//tr/td[text()='{$user}toalter']/../td/a[text()='{$lang['stralter']}']");
-                       $t->type('newname', $user);
+               /* 6 */
+               $t->addComment('6. alter user back to the normal value');
+               if ($t->data->hasRoles()) {
+                       $t->clickAndWait("link={$lang['strroles']}");
+                       $t->clickAndWait("link={$user}toalter");
+                       $t->clickAndWait("link={$lang['stralter']}");
+                       $t->type('formNewRoleName', $user);
+                       $t->uncheck('formCreateRole'); // revert
+                       $t->uncheck('formInherits'); // revert
+               } else {
+                       $t->clickAndWait("link={$lang['strusers']}");
+                       if ($t->data->hasUserRename()) {
+                               $t->clickAndWait("//tr/td[text()='{$user}toalter']/../td/a[text()='{$lang['stralter']}']");
+                               $t->type('newname', $user);
+                       }
+                       else
+                               $t->clickAndWait("//tr/td[text()='{$user}']/../td/a[text()='{$lang['stralter']}']");
+               }
+               $t->uncheck('formSuper'); // revert
+               $t->uncheck('formCreateDB'); // revert
+               $t->type('formPassword', $user_pass);
+               $t->type('formConfirm', $user_pass);
+               $t->clickAndWait('alter');
+               if ($t->data->hasRoles()) {
+                       $t->assertText("//p[@class='message']", $lang['strrolealtered']);
+                       $t->assertText("//tr/td/a[text()='{$user}']", $user);
+                       $t->assertText("//tr/td/a[text()='{$user}']/../../td[2]", $lang['strno']);//super user ?
+                       $t->assertText("//tr/td/a[text()='{$user}']/../../td[3]", $lang['strno']);//create db ?
+                       $t->assertText("//tr/td/a[text()='{$user}']/../../td[4]", $lang['strno']); //create role
+                       $t->assertText("//tr/td/a[text()='{$user}']/../../td[5]", $lang['strno']); //inherit
+                       $t->assertText("//tr/td/a[text()='{$user}']/../../td[6]", $lang['stryes']); //can login
+               }
+               else {
+                       $t->assertText("//p[@class='message']", $lang['struserupdated']);
+                       $t->assertText("//tr/td[text()='{$user}']/../td[2]", $lang['strno']);//super user ?
+                       $t->assertText("//tr/td[text()='{$user}']/../td[3]", $lang['strno']);//create db ?
+                       $t->assertText("//p[@class='message']", $lang['struserupdated']);
                }
-               else
-                       $t->clickAndWait("//tr/td[text()='{$user}']/../td/a[text()='{$lang['stralter']}']");
-       }
-       $t->uncheck('formSuper'); // revert
-       $t->uncheck('formCreateDB'); // revert
-       $t->type('formPassword', $user_pass);
-       $t->type('formConfirm', $user_pass);
-       $t->clickAndWait('alter');
-       if ($data->hasRoles()) {
-               $t->assertText("//p[@class='message']", $lang['strrolealtered']);
-               $t->assertText("//tr/td/a[text()='{$user}']", $user);
-               $t->assertText("//tr/td/a[text()='{$user}']/../../td[2]", $lang['strno']);//super user ?
-               $t->assertText("//tr/td/a[text()='{$user}']/../../td[3]", $lang['strno']);//create db ?
-               $t->assertText("//tr/td/a[text()='{$user}']/../../td[4]", $lang['strno']); //create role
-               $t->assertText("//tr/td/a[text()='{$user}']/../../td[5]", $lang['strno']); //inherit
-               $t->assertText("//tr/td/a[text()='{$user}']/../../td[6]", $lang['stryes']); //can login
-       }
-       else {
-               $t->assertText("//p[@class='message']", $lang['struserupdated']);
-               $t->assertText("//tr/td[text()='{$user}']/../td[2]", $lang['strno']);//super user ?
-               $t->assertText("//tr/td[text()='{$user}']/../td[3]", $lang['strno']);//create db ?
-               $t->assertText("//p[@class='message']", $lang['struserupdated']);
-       }
-
-       $t->logout();
-       
-       $t->writeTests("{$test_static_dir}/{$server['desc']}/roles.html", $testsuite_file);
 
-       unset($t);
+               $t->logout();
+               unset($t);
+       }
 ?>
index ad156bbc807be9aeeeb15d1f595b9c486d09fde9..0b1fe8f33915bada078525ef1004e6829ad49fc5 100644 (file)
@@ -1,72 +1,75 @@
 <?php
-       global $testsuite_file, $test_static_dir;
+       $test_title = 'Database tests';
 
-       /*
-        * 1/ create test database with altered name and owner
-        * 2/ alter its owner
-        * 3/ alter its name, owner and comment back to normal
-        * NB: droping database is in the cleantests.php tests
-        */
-       $t = new TestBuilder($server['desc'],
-               'Database tests',
-               'Create and Alter database.'
-       );
+       if (isset($_GET['run'])) {
+               global $lang;
+               require('../config.test.php');
+               require('../testBuilder.class.php');
+               /*
+                * 1/ create test database with altered name and owner
+                * 2/ alter its owner
+                * 3/ alter its name, owner and comment back to normal
+                * NB: droping database is in the cleantests.php tests
+                */
+               $t = new TestBuilder($test_title,
+                       'Create and Alter database.'
+               );
 
-       $t->login($admin_user, $admin_user_pass);
+               $t->login($admin_user, $admin_user_pass);
 
-/** 1 **/
-       $t->addComment('1. create test database with altered name and owner');
-       $t->clickAndWait("link={$lang['strdatabases']}");
-       $t->clickAndWait("link={$lang['strcreatedatabase']}");
+       /** 1 **/
+               $t->addComment('1. create test database with altered name and owner');
+               $t->clickAndWait("link={$lang['strdatabases']}");
+               $t->clickAndWait("link={$lang['strcreatedatabase']}");
 
-       /* db name */
-       if ($data->hasAlterDatabaseRename())
-               $t->type('formName', "{$testdb}toalter");
-       else $t->type('formName', $testdb);
-       /* template */
-       $t->select('formTemplate', 'template0');
-       /* encoding*/
-       $t->select('formEncoding', 'SQL_ASCII');
-       /* comment*/
-       if ($data->hasSharedComments())
-               $t->type('formComment', "database comment to alter");
-       /* create */
-       $t->clickAndWait("//input[@value='{$lang['strcreate']}']");
-       $t->assertText("//p[@class='message']", $lang['strdatabasecreated']);
+               /* db name */
+               if ($t->data->hasAlterDatabaseRename())
+                       $t->type('formName', "{$testdb}toalter");
+               else $t->type('formName', $testdb);
+               /* template */
+               $t->select('formTemplate', 'template0');
+               /* encoding*/
+               $t->select('formEncoding', 'SQL_ASCII');
+               /* comment*/
+               if ($t->data->hasSharedComments())
+                       $t->type('formComment', "database comment to alter");
+               /* create */
+               $t->clickAndWait("//input[@value='{$lang['strcreate']}']");
+               $t->assertText("//p[@class='message']", $lang['strdatabasecreated']);
 
-/** 2 **/
-       $t->addComment('2. alter DB\'s owner');
-       if ($data->hasAlterDatabaseOwner()) {
-               $t->clickAndWait("link={$lang['strdatabases']}");
-               /* we don't need to check if hasAlterDatabaseRename here because
-                * hasAlterDatabase is actually calling it */
-               $t->clickAndWait("//tr/td/a[text()='{$testdb}toalter']/../../td/a[text()='{$lang['stralter']}']");
-               if ($data->hasAlterDatabaseOwner())
-                       $t->select('owner', $super_user[$server['desc']]);
-               $t->clickAndWait('alter');
-               $t->assertText("//p[@class='message']", $lang['strdatabasealtered']);
-       }
+       /** 2 **/
+               $t->addComment('2. alter DB\'s owner');
+               if ($t->data->hasAlterDatabaseOwner()) {
+                       $t->clickAndWait("link={$lang['strdatabases']}");
+                       /* we don't need to check if hasAlterDatabaseRename here because
+                        * hasAlterDatabase is actually calling it */
+                       $t->clickAndWait("//tr/td/a[text()='{$testdb}toalter']/../../td/a[text()='{$lang['stralter']}']");
+                       if ($t->data->hasAlterDatabaseOwner())
+                               $t->select('owner', $super_user[$t->server['desc']]);
+                       $t->clickAndWait('alter');
+                       $t->assertText("//p[@class='message']", $lang['strdatabasealtered']);
+               }
 
-/** 3 **/
-       $t->addComment('3. alter DB\'s name, owner and comment back to normal');
-       if ($data->hasAlterDatabase()) {
-               $t->clickAndWait("link={$lang['strdatabases']}");
-               /* we don't need to check if hasAlterDatabaseRename here because
-                * hasAlterDatabase is actually calling it */
-               $t->clickAndWait("//tr/td/a[text()='{$testdb}toalter']/../../td/a[text()='{$lang['stralter']}']");
-               $t->type('newname', $testdb);
-               /* owner */
-               if ($data->hasAlterDatabaseOwner())
-                       $t->select('owner', $admin_user);
-               /* comment */
-               if ($data->hasSharedComments())
-                       $t->type('dbcomment', "database comment");
-               /* alter */
-               $t->clickAndWait('alter');
-               $t->assertText("//p[@class='message']", $lang['strdatabasealtered']);
-       }
+       /** 3 **/
+               $t->addComment('3. alter DB\'s name, owner and comment back to normal');
+               if ($t->data->hasAlterDatabase()) {
+                       $t->clickAndWait("link={$lang['strdatabases']}");
+                       /* we don't need to check if hasAlterDatabaseRename here because
+                        * hasAlterDatabase is actually calling it */
+                       $t->clickAndWait("//tr/td/a[text()='{$testdb}toalter']/../../td/a[text()='{$lang['stralter']}']");
+                       $t->type('newname', $testdb);
+                       /* owner */
+                       if ($t->data->hasAlterDatabaseOwner())
+                               $t->select('owner', $admin_user);
+                       /* comment */
+                       if ($t->data->hasSharedComments())
+                               $t->type('dbcomment', "database comment");
+                       /* alter */
+                       $t->clickAndWait('alter');
+                       $t->assertText("//p[@class='message']", $lang['strdatabasealtered']);
+               }
 
-       $t->logout();
-       $t->writeTests("{$test_static_dir}/{$server['desc']}/database.html", $testsuite_file);
-       unset($t);
+               $t->logout();
+               unset($t);
+       }
 ?>
index c92fc848d9ebfddbfae392b0c76e3f15a8926635..de161625395dabc2913bf339064e46b1abd18f7c 100644 (file)
@@ -1,52 +1,55 @@
 <?php
-       global $testsuite_file, $test_static_dir;
+       $test_title = 'Schema tests';
 
-       /*
-        * 1/ create test schema
-        * 2/ alter its name, owner and comment
-        * NB: droping the schema is in the cleantests.php tests
-        */
-       $t = new TestBuilder($server['desc'],
-               'Schema tests',
-               'Create and Alter schema.'
-       );
+       if (isset($_GET['run'])) {
+               global $lang;
+               require('../config.test.php');
+               require('../testBuilder.class.php');
+               /*
+                * 1/ create test schema
+                * 2/ alter its name, owner and comment
+                * NB: droping the schema is in the cleantests.php tests
+                */
+               $t = new TestBuilder($test_title,
+                       'Create and Alter schema.'
+               );
 
-       $t->login($admin_user, $admin_user_pass);
+               $t->login($admin_user, $admin_user_pass);
 
-/** 1 **/
-       $t->addComment('1. create test schema');
-       $t->clickAndWait("link={$lang['strdatabases']}");
-       $t->clickAndWait("link={$testdb}");
-       $t->clickAndWait("link={$lang['strschemas']}");
-       $t->clickAndWait("link={$lang['strcreateschema']}");
-       if ($data->hasAlterSchema()) {
-               $t->type('formName', 'test_schema_toalter');
-               if ($data->hasAlterSchemaOwner())
-                       $t->select('formAuth', $super_user[$server['desc']]);
-               else $t->select('formAuth', $admin_user);
-               $t->type('formComment', 'test schema comment to alter');
-       }
-       else {
-               $t->type('formName', 'test_schema');
-               $t->type('formComment', 'test schema comment');
-       }
-       $t->clickAndWait('create');
-       $t->assertText('//p[@class=\'message\']', $lang['strschemacreated']);
-
-/** 2 **/
-       $t->addComment('2. alter schema\'s name, owner and comment');
-       if ($data->hasAlterSchema()) {
+       /** 1 **/
+               $t->addComment('1. create test schema');
+               $t->clickAndWait("link={$lang['strdatabases']}");
+               $t->clickAndWait("link={$testdb}");
                $t->clickAndWait("link={$lang['strschemas']}");
-               $t->clickAndWait("//tr/td/a[text()='test_schema_toalter']/../../td/a[text()='{$lang['stralter']}']");
-               $t->type('name', 'test_schema');
-               if ($data->hasAlterSchemaOwner())
-                       $t->select('owner', $admin_user);
-               $t->type('comment', 'test schema');
-               $t->clickAndWait('alter');
-               $t->assertText('//p[@class=\'message\']', $lang['strschemaaltered']);
+               $t->clickAndWait("link={$lang['strcreateschema']}");
+               if ($t->data->hasAlterSchema()) {
+                       $t->type('formName', 'test_schema_toalter');
+                       if ($t->data->hasAlterSchemaOwner())
+                               $t->select('formAuth', $super_user[$t->server['desc']]);
+                       else $t->select('formAuth', $admin_user);
+                       $t->type('formComment', 'test schema comment to alter');
+               }
+               else {
+                       $t->type('formName', 'test_schema');
+                       $t->type('formComment', 'test schema comment');
+               }
+               $t->clickAndWait('create');
+               $t->assertText('//p[@class=\'message\']', $lang['strschemacreated']);
+
+       /** 2 **/
+               $t->addComment('2. alter schema\'s name, owner and comment');
+               if ($t->data->hasAlterSchema()) {
+                       $t->clickAndWait("link={$lang['strschemas']}");
+                       $t->clickAndWait("//tr/td/a[text()='test_schema_toalter']/../../td/a[text()='{$lang['stralter']}']");
+                       $t->type('name', 'test_schema');
+                       if ($t->data->hasAlterSchemaOwner())
+                               $t->select('owner', $admin_user);
+                       $t->type('comment', 'test schema');
+                       $t->clickAndWait('alter');
+                       $t->assertText('//p[@class=\'message\']', $lang['strschemaaltered']);
+               }
+
+               $t->logout();
+               unset($t);
        }
-       
-       $t->logout();
-       $t->writeTests("{$test_static_dir}/{$server['desc']}/schema.html", $testsuite_file);
-       unset($t);
 ?>
index 9f197abb63ed2b334eba17b9bdfd3ee1b8cdd6a8..5d9a65fed2243b01f2eeb8c346e56ad9f28a2358 100644 (file)
 <?php
-       global $testsuite_file, $test_static_dir;
+       $test_title = 'Domain tests';
 
-       /*
-        * 1/ create domain
-        * 2/ add unwanted domain constraint
-        * 3/ drop unwanted check constraint on domain
-        * 4/ alter domain giving owner to super_user
-        * 5/ alter back the owner to admin_user
-        * NB: droping domain is in the cleantests.php tests
-        */
-       $t = new TestBuilder($server['desc'],
-               'Domain tests',
-               'Create and Alter a domain.'
-       );
+       if (isset($_GET['run'])) {
+               global $lang;
+               require('../config.test.php');
+               require('../testBuilder.class.php');
+               /*
+                * 1/ create domain
+                * 2/ add unwanted domain constraint
+                * 3/ drop unwanted check constraint on domain
+                * 4/ alter domain giving owner to super_user
+                * 5/ alter back the owner to admin_user
+                * NB: droping domain is in the cleantests.php tests
+                */
+               $t = new TestBuilder($test_title,
+                       'Create and Alter a domain.'
+               );
 
-       $t->login($admin_user, $admin_user_pass);
+               $t->login($admin_user, $admin_user_pass);
 
-/** 1 **/
-       $t->addComment('1. create domain');
-       $t->clickAndWait("link={$lang['strdatabases']}");
-       $t->clickAndWait("link={$testdb}");
-       $t->clickAndWait("link={$lang['strschemas']}");
-       $t->clickAndWait("link=test_schema");
-       $t->clickAndWait("link={$lang['strdomains']}");
-       $t->clickAndWait("link={$lang['strcreatedomain']}");
-       $t->type('domname', 'year');
-       $t->select('domtype', 'label=integer');
-       if ($data->hasAlterDomains()) {
-               $t->type('domdefault', '1900');
-               $t->click('domnotnull');
-       }
-       else
-               $t->type('domdefault', 'extract(year from current_date)');
-       
-       if ($data->hasDomainConstraints()) 
-               $t->type('domcheck', 'VALUE &gt;= 1901 AND VALUE &lt;= 2155');
-       $t->clickAndWait("//input[@value='{$lang['strcreate']}']");
-       $t->assertText("//p[@class='message']", $lang['strdomaincreated']);
-       $t->assertText("//tr/td/a[text()='year']", 'year');
-       $t->assertText("//tr/td/a[text()='year']/../../td[2]", 'integer');
-       if ($data->hasAlterDomains()) {
-               $t->assertText("//tr/td/a[text()='year']/../../td[3]/div", 'NOT NULL');
-               $t->assertText("//tr/td/a[text()='year']/../../td[4]", '1900');
-               
-       }
-       /* we doesn't test default as Postgres change it with internal methods */
-       //else
-       //      $t->assertText("//tr/td/a[text()='year']/../../td[4]", 'extract(year from current_date)');
-       $t->assertText("//tr/td/a[text()='year']/../../td[5]", $admin_user);
-       if ($data->hasDomainConstraints()) {
-               $t->clickAndWait("link=year");
-               if ($data->major_version == '7.4')
-                       $t->assertText("//tr/td[text()='$1']/../td[2]", 'CHECK (VALUE >= 1901 AND VALUE <= 2155)');
-               else
-                       $t->assertText("//tr/td[text()='year_check']/../td[2]", 'CHECK (VALUE >= 1901 AND VALUE <= 2155)');
-       }
-       
-/** 2 **/
-       $t->addComment('2. add unwanted domain constraint');
-       if ($data->hasDomainConstraints()) {
-               $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label' and text()='test_schema']");
+       /** 1 **/
+               $t->addComment('1. create domain');
+               $t->clickAndWait("link={$lang['strdatabases']}");
+               $t->clickAndWait("link={$testdb}");
+               $t->clickAndWait("link={$lang['strschemas']}");
+               $t->clickAndWait("link=test_schema");
                $t->clickAndWait("link={$lang['strdomains']}");
-               $t->clickAndWait("link=year");
-               $t->clickAndWait("//a[text()='{$lang['straddcheck']}']");
-               $t->type('name', 'test_to_drop');
-               $t->type('definition', 'VALUE > 1900');
-               $t->clickAndWait('add');
-               $t->assertText("//p[@class='message']", $lang['strcheckadded']);
-               $t->assertText("//tr/td[text()='test_to_drop']/../td[2]", 'CHECK (VALUE > 1900)');
-       }
-
-/** 3 **/
-       $t->addComment('3. drop unwanted check constraint on domain');
-       if ($data->hasDomainConstraints()) {
-               $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label' and text()='test_schema']");
-               $t->clickAndWait("link={$lang['strdomains']}");
-               $t->clickAndWait("link=year");
-               $t->clickAndWait("//tr/td[text()='test_to_drop']/../td/a[text()='{$lang['strdrop']}']");
-               $str = sprintf($lang['strconfdropconstraint'], 'test_to_drop', 'year');
-               $t->assertText("//p[text()='$str']", sprintf($lang['strconfdropconstraint'], 'test_to_drop', 'year'));
-               $t->clickAndWait('drop');
-               $t->assertText("//p[@class='message']", $lang['strconstraintdropped']);
-       }
+               $t->clickAndWait("link={$lang['strcreatedomain']}");
+               $t->type('domname', 'year');
+               $t->select('domtype', 'label=integer');
+               if ($t->data->hasAlterDomains()) {
+                       $t->type('domdefault', '1900');
+                       $t->click('domnotnull');
+               }
+               else
+                       $t->type('domdefault', 'extract(year from current_date)');
 
-/** 4 **/
-       $t->addComment('4. alter domain giving owner to super_user');
-       if ($data->hasAlterDomains()) {
-               $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label' and text()='test_schema']");
-               $t->clickAndWait("link={$lang['strdomains']}");
-               $t->clickAndWait("//tr/td/a[text()='year']/../../td/a[text()='{$lang['stralter']}']");
-               $t->click('domnotnull');
-               $t->type('domdefault', 'extract(year from current_date)');
-               $t->select('domowner', $super_user[$server['desc']]);
-               $t->clickAndWait('alter');
-               $t->assertText("//p[@class='message']", $lang['strdomainaltered']);
-               $t->assertText("//tr/th[text()='{$lang['strnotnull']}']/../td", '');
+               if ($t->data->hasDomainConstraints())
+                       $t->type('domcheck', 'VALUE &gt;= 1901 AND VALUE &lt;= 2155');
+               $t->clickAndWait("//input[@value='{$lang['strcreate']}']");
+               $t->assertText("//p[@class='message']", $lang['strdomaincreated']);
+               $t->assertText("//tr/td/a[text()='year']", 'year');
+               $t->assertText("//tr/td/a[text()='year']/../../td[2]", 'integer');
+               if ($t->data->hasAlterDomains()) {
+                       $t->assertText("//tr/td/a[text()='year']/../../td[3]/div", 'NOT NULL');
+                       $t->assertText("//tr/td/a[text()='year']/../../td[4]", '1900');
+               }
                /* we doesn't test default as Postgres change it with internal methods */
-               //$t->assertText("//tr/th[text()='{$lang['strdefault']}']/../td", 'extract(year from current_date)');
-               $t->assertText("//tr/th[text()='{$lang['strowner']}']/../td", $super_user[$server['desc']]);
-       }
+               //else
+               //      $t->assertText("//tr/td/a[text()='year']/../../td[4]", 'extract(year from current_date)');
+               $t->assertText("//tr/td/a[text()='year']/../../td[5]", $admin_user);
+               if ($t->data->hasDomainConstraints()) {
+                       $t->clickAndWait("link=year");
+                       if ($t->data->major_version == '7.4')
+                               $t->assertText("//tr/td[text()='$1']/../td[2]", 'CHECK (VALUE >= 1901 AND VALUE <= 2155)');
+                       else
+                               $t->assertText("//tr/td[text()='year_check']/../td[2]", 'CHECK (VALUE >= 1901 AND VALUE <= 2155)');
+               }
 
-/** 5 **/
-       $t->addComment('5. alter back the owner to admin_user');
-       if ($data->hasAlterDomains()) {
-               $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label' and text()='test_schema']");
-               $t->clickAndWait("link={$lang['strdomains']}");
-               $t->clickAndWait("//tr/td/a[text()='year']/../../td/a[text()='{$lang['stralter']}']");
-               $t->select('domowner', $admin_user);
-               $t->clickAndWait('alter');
-               $t->assertText("//p[@class='message']", $lang['strdomainaltered']);
-               $t->assertText("//tr/th[text()='{$lang['strowner']}']/../td", $admin_user);
+       /** 2 **/
+               $t->addComment('2. add unwanted domain constraint');
+               if ($t->data->hasDomainConstraints()) {
+                       $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label' and text()='test_schema']");
+                       $t->clickAndWait("link={$lang['strdomains']}");
+                       $t->clickAndWait("link=year");
+                       $t->clickAndWait("//a[text()='{$lang['straddcheck']}']");
+                       $t->type('name', 'test_to_drop');
+                       $t->type('definition', 'VALUE > 1900');
+                       $t->clickAndWait('add');
+                       $t->assertText("//p[@class='message']", $lang['strcheckadded']);
+                       $t->assertText("//tr/td[text()='test_to_drop']/../td[2]", 'CHECK (VALUE > 1900)');
+               }
+
+       /** 3 **/
+               $t->addComment('3. drop unwanted check constraint on domain');
+               if ($t->data->hasDomainConstraints()) {
+                       $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label' and text()='test_schema']");
+                       $t->clickAndWait("link={$lang['strdomains']}");
+                       $t->clickAndWait("link=year");
+                       $t->clickAndWait("//tr/td[text()='test_to_drop']/../td/a[text()='{$lang['strdrop']}']");
+                       $str = sprintf($lang['strconfdropconstraint'], 'test_to_drop', 'year');
+                       $t->assertText("//p[text()='$str']", sprintf($lang['strconfdropconstraint'], 'test_to_drop', 'year'));
+                       $t->clickAndWait('drop');
+                       $t->assertText("//p[@class='message']", $lang['strconstraintdropped']);
+               }
+
+       /** 4 **/
+               $t->addComment('4. alter domain giving owner to super_user');
+               if ($t->data->hasAlterDomains()) {
+                       $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label' and text()='test_schema']");
+                       $t->clickAndWait("link={$lang['strdomains']}");
+                       $t->clickAndWait("//tr/td/a[text()='year']/../../td/a[text()='{$lang['stralter']}']");
+                       $t->click('domnotnull');
+                       $t->type('domdefault', 'extract(year from current_date)');
+                       $t->select('domowner', $super_user[$t->server['desc']]);
+                       $t->clickAndWait('alter');
+                       $t->assertText("//p[@class='message']", $lang['strdomainaltered']);
+                       $t->assertText("//tr/th[text()='{$lang['strnotnull']}']/../td", '');
+                       /* we doesn't test default as Postgres change it with internal methods */
+                       //$t->assertText("//tr/th[text()='{$lang['strdefault']}']/../td", 'extract(year from current_date)');
+                       $t->assertText("//tr/th[text()='{$lang['strowner']}']/../td", $super_user[$t->server['desc']]);
+               }
+
+       /** 5 **/
+               $t->addComment('5. alter back the owner to admin_user');
+               if ($t->data->hasAlterDomains()) {
+                       $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label' and text()='test_schema']");
+                       $t->clickAndWait("link={$lang['strdomains']}");
+                       $t->clickAndWait("//tr/td/a[text()='year']/../../td/a[text()='{$lang['stralter']}']");
+                       $t->select('domowner', $admin_user);
+                       $t->clickAndWait('alter');
+                       $t->assertText("//p[@class='message']", $lang['strdomainaltered']);
+                       $t->assertText("//tr/th[text()='{$lang['strowner']}']/../td", $admin_user);
+               }
+
+               $t->logout();
+               unset($t);
        }
-               
-       $t->logout();
-       $t->writeTests("{$test_static_dir}/{$server['desc']}/domain.html", $testsuite_file);
-       unset($t);
 ?>
index 37675bdb447d3853027c0cb86cd515c97fc65b74..dc680bfc1d59585e1be0213b300020629780dbcd 100644 (file)
 <?php
-       global $testsuite_file, $test_static_dir;
+       $test_title = 'Table tests';
 
-       /*
-        * 1/ create a table student in public
-        * 2/ create table promo in test_schema
-        * 3/ create table like student in test_schema
-        * 4/ alter each param one by one on test_toalter
-        * 5/ alter back test_toalter in one step
-        * NB: droping a table is in the cleantests.php tests
-        */
-       $t = new TestBuilder($server['desc'],
-               'Table tests',
-               'Create tables, make some alterations...'
-       );
+       if (isset($_GET['run'])) {
+               global $lang;
+               require('../config.test.php');
+               require('../testBuilder.class.php');
+               /*
+                * 1/ create a table student in public
+                * 2/ create table promo in test_schema
+                * 3/ create table like student in test_schema
+                * 4/ alter each param one by one on test_toalter
+                * 5/ alter back test_toalter in one step
+                * NB: droping a table is in the cleantests.php tests
+                */
+               $t = new TestBuilder($test_title,
+                       'Create tables, make some alterations...'
+               );
 
-       $t->login($admin_user, $admin_user_pass);
+               $t->login($admin_user, $admin_user_pass);
 
-/** 1 **/
-       $t->addComment('1. create a table student in public');
-       $t->clickAndWait("link={$lang['strdatabases']}");
-       $t->clickAndWait("link={$testdb}");
-       $t->clickAndWait("link={$lang['strschemas']}");
-       $t->clickAndWait("link=public");
-       $t->clickAndWait("link={$lang['strtables']}");
-       $t->clickAndWait("link={$lang['strcreatetable']}");
-       $t->type('name','student');
-       $t->type('fields', '5');
-       $t->type('tblcomment', 'student table');
-       $t->clickAndWait("//input[@value='{$lang['strnext']}']");
-       $t->type('field[0]', 'id');
-       $t->select('types0', 'label=SERIAL');
-       $t->click('primarykey[0]');
-       $t->type('field[1]', 'id_promo');
-       $t->select('types1', 'label=integer');
-       $t->type('field[2]', 'name');
-       $t->select('types2', 'label=character varying');
-       $t->type('lengths2', '20');
-       $t->click('notnull[2]');
-       $t->type('field[3]', 'birthday');
-       $t->select('types3', 'label=date');
-       $t->type('field[4]', 'resume');
-       $t->select('types4', 'label=text');
-       $t->clickAndWait("//input[@value='{$lang['strcreate']}']");
-       $t->assertText("//p[@class='message']", $lang['strtablecreated']);
-
-/** 2 **/
-       $t->addComment('2. create table promo in test_schema');
-       $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strdatabase']}']/span[@class='label' and text()='{$testdb}']");
-       $t->clickAndWait("link={$lang['strschemas']}");
-       $t->clickAndWait("link=test_schema");
-       $t->clickAndWait("link={$lang['strtables']}");
-       $t->clickAndWait("link={$lang['strcreatetable']}");
-       $t->type('name', 'promo');
-       $t->type('fields', '3');
-       $t->type('tblcomment', 'promotion\'s year & speciality');
-       $t->clickAndWait("//input[@value='Next &gt;']");
-       $t->type('field[0]', 'id');
-       $t->select('types0', 'label=SERIAL');
-       $t->click('primarykey[0]');
-       $t->type('field[1]', 'spe');
-       $t->select('types1', 'label=character varying');
-       $t->type('lengths1','20');
-       $t->click('notnull[1]');
-       $t->type('field[2]', 'year');
-       $t->select('types2', "label=regexp:\"?year\"?"); // 8.3 does not quote domains
-       $t->click('notnull[2]');
-       $t->clickAndWait("//input[@value='{$lang['strcreate']}']");
-       $t->assertText("//p[@class='message']", $lang['strtablecreated']);
-
-/** 3 **/
-       $t->addComment('3. create table like student in test_schema');
-       if ($data->hasCreateTableLike()) {
-               $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strdatabase']}']/span[@class='label' and text()='{$testdb}']");
+       /** 1 **/
+               $t->addComment('1. create a table student in public');
+               $t->clickAndWait("link={$lang['strdatabases']}");
+               $t->clickAndWait("link={$testdb}");
                $t->clickAndWait("link={$lang['strschemas']}");
-               $t->clickAndWait("link=test_schema");
+               $t->clickAndWait("link=public");
                $t->clickAndWait("link={$lang['strtables']}");
-               $t->clickAndWait("link={$lang['strcreatetablelike']}");
-               $t->type('name', 'test_toalter');
-               $t->select('like','label="public"."student"');
-               $t->click('withdefaults');
-               if ($data->hasCreateTableLikeWithConstraints())
-                       $t->click('withconstraints');
-               if ($data->hasCreateTableLikeWithIndexes())
-                       $t->click('withindexes');
+               $t->clickAndWait("link={$lang['strcreatetable']}");
+               $t->type('name','student');
+               $t->type('fields', '5');
+               $t->type('tblcomment', 'student table');
+               $t->clickAndWait("//input[@value='{$lang['strnext']}']");
+               $t->type('field[0]', 'id');
+               $t->select('types0', 'label=SERIAL');
+               $t->click('primarykey[0]');
+               $t->type('field[1]', 'id_promo');
+               $t->select('types1', 'label=integer');
+               $t->type('field[2]', 'name');
+               $t->select('types2', 'label=character varying');
+               $t->type('lengths2', '20');
+               $t->click('notnull[2]');
+               $t->type('field[3]', 'birthday');
+               $t->select('types3', 'label=date');
+               $t->type('field[4]', 'resume');
+               $t->select('types4', 'label=text');
                $t->clickAndWait("//input[@value='{$lang['strcreate']}']");
                $t->assertText("//p[@class='message']", $lang['strtablecreated']);
-       }
-       else {
-               /*no create like ? create it anyway for the next steps*/
+
+       /** 2 **/
+               $t->addComment('2. create table promo in test_schema');
                $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strdatabase']}']/span[@class='label' and text()='{$testdb}']");
                $t->clickAndWait("link={$lang['strschemas']}");
                $t->clickAndWait("link=test_schema");
                $t->clickAndWait("link={$lang['strtables']}");
                $t->clickAndWait("link={$lang['strcreatetable']}");
-               $t->type('name','test_toalter');
-               $t->type('fields', '1');
-               $t->type('tblcomment', 'test table');
-               $t->clickAndWait("//input[@value='{$lang['strnext']}']");
+               $t->type('name', 'promo');
+               $t->type('fields', '3');
+               $t->type('tblcomment', 'promotion\'s year & speciality');
+               $t->clickAndWait("//input[@value='Next &gt;']");
                $t->type('field[0]', 'id');
                $t->select('types0', 'label=SERIAL');
                $t->click('primarykey[0]');
+               $t->type('field[1]', 'spe');
+               $t->select('types1', 'label=character varying');
+               $t->type('lengths1','20');
+               $t->click('notnull[1]');
+               $t->type('field[2]', 'year');
+               $t->select('types2', "label=regexp:\"?year\"?"); // 8.3 does not quote domains
+               $t->click('notnull[2]');
                $t->clickAndWait("//input[@value='{$lang['strcreate']}']");
                $t->assertText("//p[@class='message']", $lang['strtablecreated']);
-       }
 
-/** 4 **/
-       $t->addComment('4. alter each param one by one on test_toalter');
-       /*table name*/
-       $t->addComment('4.1. alter table name');
-       $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strdatabase']}']/span[@class='label' and text()='{$testdb}']");
-       $t->clickAndWait("link={$lang['strschemas']}");
-       $t->clickAndWait("link=test_schema");
-       $t->clickAndWait("link={$lang['strtables']}");
-       $t->clickAndWait("link=test_toalter");
-       $t->clickAndWait("link={$lang['strcolumns']}"); /*alter using the link in the column page*/
-       $t->clickAndWait("//ul[@class='navlink']/li/a[text()='{$lang['stralter']}']");
-       $t->type('name', 'test_renamed');
-       $t->clickAndWait('alter');
-       $t->assertText("//p[@class='message']", $lang['strtablealtered']);
-       $t->assertText("//div[@class='trail']/descendant::a[@title='{$lang['strtable']}']/span[@class='label']", 'test_renamed');
+       /** 3 **/
+               $t->addComment('3. create table like student in test_schema');
+               if ($t->data->hasCreateTableLike()) {
+                       $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strdatabase']}']/span[@class='label' and text()='{$testdb}']");
+                       $t->clickAndWait("link={$lang['strschemas']}");
+                       $t->clickAndWait("link=test_schema");
+                       $t->clickAndWait("link={$lang['strtables']}");
+                       $t->clickAndWait("link={$lang['strcreatetablelike']}");
+                       $t->type('name', 'test_toalter');
+                       $t->select('like','label="public"."student"');
+                       $t->click('withdefaults');
+                       if ($t->data->hasCreateTableLikeWithConstraints())
+                               $t->click('withconstraints');
+                       if ($t->data->hasCreateTableLikeWithIndexes())
+                               $t->click('withindexes');
+                       $t->clickAndWait("//input[@value='{$lang['strcreate']}']");
+                       $t->assertText("//p[@class='message']", $lang['strtablecreated']);
+               }
+               else {
+                       /*no create like ? create it anyway for the next steps*/
+                       $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strdatabase']}']/span[@class='label' and text()='{$testdb}']");
+                       $t->clickAndWait("link={$lang['strschemas']}");
+                       $t->clickAndWait("link=test_schema");
+                       $t->clickAndWait("link={$lang['strtables']}");
+                       $t->clickAndWait("link={$lang['strcreatetable']}");
+                       $t->type('name','test_toalter');
+                       $t->type('fields', '1');
+                       $t->type('tblcomment', 'test table');
+                       $t->clickAndWait("//input[@value='{$lang['strnext']}']");
+                       $t->type('field[0]', 'id');
+                       $t->select('types0', 'label=SERIAL');
+                       $t->click('primarykey[0]');
+                       $t->clickAndWait("//input[@value='{$lang['strcreate']}']");
+                       $t->assertText("//p[@class='message']", $lang['strtablecreated']);
+               }
 
-       /*table comment*/
-       $t->addComment('4.2. alter table comment');
-       $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strdatabase']}']/span[@class='label' and text()='{$testdb}']");
-       $t->clickAndWait("link={$lang['strschemas']}");
-       $t->clickAndWait("link=test_schema");
-       $t->clickAndWait("link={$lang['strtables']}");
-       $t->clickAndWait("link=test_renamed");
-       $t->clickAndWait("link={$lang['strcolumns']}"); /*alter using the link in the column page*/
-       $t->clickAndWait("//ul[@class='navlink']/li/a[text()='{$lang['stralter']}']");
-       $t->type('comment', 'altered comment');
-       $t->clickAndWait('alter');
-       $t->assertText("//p[@class='message']", $lang['strtablealtered']);
-       $t->assertText("//p[@class='comment']", 'altered comment');
-       
-       /*table owner*/
-       $t->addComment('4.3. alter table owner');
-       $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strdatabase']}']/span[@class='label' and text()='{$testdb}']");
-       $t->clickAndWait("link={$lang['strschemas']}");
-       $t->clickAndWait("link=test_schema");
-       $t->clickAndWait("link={$lang['strtables']}");
-       $t->clickAndWait("//tr/td/a[text()='test_renamed']/../../td/a[text()='{$lang['stralter']}']"); /*alter using the link in the table list page*/
-       $t->select('owner', "label={$user}");
-       $t->clickAndWait('alter');
-       $t->assertText("//p[@class='message']", $lang['strtablealtered']);
-       $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label' and text()='test_schema']");
-       $t->clickAndWait("link={$lang['strtables']}");
-       $t->assertText("//tr/td[2]/a[text()='test_renamed']/../../td[3]", $user);
-       
-       /*alter schema*/
-       if ($data->hasAlterTableSchema()) {
-               $t->addComment('4.4. alter table schema');
+       /** 4 **/
+               $t->addComment('4. alter each param one by one on test_toalter');
+               /*table name*/
+               $t->addComment('4.1. alter table name');
                $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strdatabase']}']/span[@class='label' and text()='{$testdb}']");
                $t->clickAndWait("link={$lang['strschemas']}");
                $t->clickAndWait("link=test_schema");
                $t->clickAndWait("link={$lang['strtables']}");
-               $t->clickAndWait("//tr/td/a[text()='test_renamed']/../../td/a[text()='{$lang['stralter']}']"); /*alter using the link in the table list page*/
-               $t->select('newschema', 'label=public');
+               $t->clickAndWait("link=test_toalter");
+               $t->clickAndWait("link={$lang['strcolumns']}"); /*alter using the link in the column page*/
+               $t->clickAndWait("//ul[@class='navlink']/li/a[text()='{$lang['stralter']}']");
+               $t->type('name', 'test_renamed');
                $t->clickAndWait('alter');
                $t->assertText("//p[@class='message']", $lang['strtablealtered']);
-               $t->assertText("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label']", 'public');
-       }
+               $t->assertText("//div[@class='trail']/descendant::a[@title='{$lang['strtable']}']/span[@class='label']", 'test_renamed');
 
-/** 5 **/
-       $t->addComment('5. alter back test_toalter in one step');
-       $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strdatabase']}']/span[@class='label' and text()='{$testdb}']");
-       $t->clickAndWait("link={$lang['strschemas']}");
-       if ($data->hasAlterTableSchema())
-               $t->clickAndWait("link=public");
-       else
+               /*table comment*/
+               $t->addComment('4.2. alter table comment');
+               $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strdatabase']}']/span[@class='label' and text()='{$testdb}']");
+               $t->clickAndWait("link={$lang['strschemas']}");
                $t->clickAndWait("link=test_schema");
-       $t->clickAndWait("link={$lang['strtables']}");
-       $t->clickAndWait("link=test_renamed");
-       $t->clickAndWait("link={$lang['strcolumns']}");
-       $t->clickAndWait("//ul[@class='navlink']/li/a[text()='{$lang['stralter']}']");
-       $t->type('name', 'test');
-       
-       $t->type('comment', 'normal comment');
-       if ($data->hasAlterTableSchema())
-               $t->select('newschema', 'label=test_schema');
-       $t->select('owner', "label={$admin_user}");
-       $t->clickAndWait('alter');
-       $t->assertText("//p[@class='message']", $lang['strtablealtered']);
-       $t->assertText("//div[@class='trail']/descendant::a[@title='{$lang['strtable']}']/span[@class='label']", 'test');
-       $t->assertText("//p[@class='comment']", 'normal comment');
-       $t->assertText("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label']", 'test_schema');
-       $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label' and text()='test_schema']");
-       $t->clickAndWait("link={$lang['strtables']}");
-       $t->assertText("//tr/td[2]/a[text()='test']/../../td[3]", $admin_user);
+               $t->clickAndWait("link={$lang['strtables']}");
+               $t->clickAndWait("link=test_renamed");
+               $t->clickAndWait("link={$lang['strcolumns']}"); /*alter using the link in the column page*/
+               $t->clickAndWait("//ul[@class='navlink']/li/a[text()='{$lang['stralter']}']");
+               $t->type('comment', 'altered comment');
+               $t->clickAndWait('alter');
+               $t->assertText("//p[@class='message']", $lang['strtablealtered']);
+               $t->assertText("//p[@class='comment']", 'altered comment');
+
+               /*table owner*/
+               $t->addComment('4.3. alter table owner');
+               $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strdatabase']}']/span[@class='label' and text()='{$testdb}']");
+               $t->clickAndWait("link={$lang['strschemas']}");
+               $t->clickAndWait("link=test_schema");
+               $t->clickAndWait("link={$lang['strtables']}");
+               $t->clickAndWait("//tr/td/a[text()='test_renamed']/../../td/a[text()='{$lang['stralter']}']"); /*alter using the link in the table list page*/
+               $t->select('owner', "label={$user}");
+               $t->clickAndWait('alter');
+               $t->assertText("//p[@class='message']", $lang['strtablealtered']);
+               $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label' and text()='test_schema']");
+               $t->clickAndWait("link={$lang['strtables']}");
+               $t->assertText("//tr/td[2]/a[text()='test_renamed']/../../td[3]", $user);
 
-       $t->logout();
-       $t->writeTests("{$test_static_dir}/{$server['desc']}/table.html", $testsuite_file);
-       unset($t);
+               /*alter schema*/
+               if ($t->data->hasAlterTableSchema()) {
+                       $t->addComment('4.4. alter table schema');
+                       $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strdatabase']}']/span[@class='label' and text()='{$testdb}']");
+                       $t->clickAndWait("link={$lang['strschemas']}");
+                       $t->clickAndWait("link=test_schema");
+                       $t->clickAndWait("link={$lang['strtables']}");
+                       $t->clickAndWait("//tr/td/a[text()='test_renamed']/../../td/a[text()='{$lang['stralter']}']"); /*alter using the link in the table list page*/
+                       $t->select('newschema', 'label=public');
+                       $t->clickAndWait('alter');
+                       $t->assertText("//p[@class='message']", $lang['strtablealtered']);
+                       $t->assertText("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label']", 'public');
+               }
+
+       /** 5 **/
+               $t->addComment('5. alter back test_toalter in one step');
+               $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strdatabase']}']/span[@class='label' and text()='{$testdb}']");
+               $t->clickAndWait("link={$lang['strschemas']}");
+               if ($t->data->hasAlterTableSchema())
+                       $t->clickAndWait("link=public");
+               else
+                       $t->clickAndWait("link=test_schema");
+               $t->clickAndWait("link={$lang['strtables']}");
+               $t->clickAndWait("link=test_renamed");
+               $t->clickAndWait("link={$lang['strcolumns']}");
+               $t->clickAndWait("//ul[@class='navlink']/li/a[text()='{$lang['stralter']}']");
+               $t->type('name', 'test');
+
+               $t->type('comment', 'normal comment');
+               if ($t->data->hasAlterTableSchema())
+                       $t->select('newschema', 'label=test_schema');
+               $t->select('owner', "label={$admin_user}");
+               $t->clickAndWait('alter');
+               $t->assertText("//p[@class='message']", $lang['strtablealtered']);
+               $t->assertText("//div[@class='trail']/descendant::a[@title='{$lang['strtable']}']/span[@class='label']", 'test');
+               $t->assertText("//p[@class='comment']", 'normal comment');
+               $t->assertText("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label']", 'test_schema');
+               $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label' and text()='test_schema']");
+               $t->clickAndWait("link={$lang['strtables']}");
+               $t->assertText("//tr/td[2]/a[text()='test']/../../td[3]", $admin_user);
+
+               $t->logout();
+               unset($t);
+       }
 ?>
index 731bd21f7d2c58d664b349b273078fd5e9b99961..63cf70b25ae0ef57ccbcb6e9e68a2fcb9fad3b85 100644 (file)
 <?php
-       global $testsuite_file, $test_static_dir;
+       $test_title = 'Sequence tests';
 
-       /*
-        * 1/ Create a sequence
-        * 2/ increment, reset sequence qnd set value
-        * 3/ alter sequence
-        * 4/ drop sequence
-        */
-       $t = new TestBuilder($server['desc'],
-               'Sequence tests',
-               'Create alter and drop sequence...'
-       );
+       if (isset($_GET['run'])) {
+               global $lang;
+               require('../config.test.php');
+               require('../testBuilder.class.php');
+               /*
+                * 1/ Create a sequence
+                * 2/ increment, reset sequence qnd set value
+                * 3/ alter sequence
+                * 4/ drop sequence
+                */
+               $t = new TestBuilder($test_title,
+                       'Create alter and drop sequence...'
+               );
 
-       $t->login($admin_user, $admin_user_pass);
+               $t->login($admin_user, $admin_user_pass);
 
-/** 1 **/
-       $t->addComment('1. Create a sequence');
-       $t->clickAndWait("link={$lang['strdatabases']}");
-       $t->clickAndWait("link={$testdb}");
-       $t->clickAndWait("link={$lang['strschemas']}");
-       $t->clickAndWait('link=public');
-       $t->clickAndWait("link={$lang['strsequences']}");
-       $t->clickAndWait("link={$lang['strcreatesequence']}");
-       $t->type('formSequenceName', 'testcase_seq');
-       $t->type('formIncrement', '2');
-       $t->type('formMinValue', '1');
-       $t->type('formMaxValue', '100');
-       $t->type('formStartValue', '1');
-       $t->type('formCacheValue', '1');
-       $t->click('formCycledValue');
-       $t->clickAndWait('create');
-       $t->assertText("//p[@class='message']", $lang['strsequencecreated']);
-       $t->clickAndWait('link=testcase_seq');
-       $t->assertText("//tr/th[text()='{$lang['strname']}' and @class='data']/../../tr/td[1]", 'testcase_seq');
-       $i=2;
-       $t->assertText("//tr/td[text()='testcase_seq']/../td[". $i++ ."]", '1');
-       if ($data->hasAlterSequenceStart())
+       /** 1 **/
+               $t->addComment('1. Create a sequence');
+               $t->clickAndWait("link={$lang['strdatabases']}");
+               $t->clickAndWait("link={$testdb}");
+               $t->clickAndWait("link={$lang['strschemas']}");
+               $t->clickAndWait('link=public');
+               $t->clickAndWait("link={$lang['strsequences']}");
+               $t->clickAndWait("link={$lang['strcreatesequence']}");
+               $t->type('formSequenceName', 'testcase_seq');
+               $t->type('formIncrement', '2');
+               $t->type('formMinValue', '1');
+               $t->type('formMaxValue', '100');
+               $t->type('formStartValue', '1');
+               $t->type('formCacheValue', '1');
+               $t->click('formCycledValue');
+               $t->clickAndWait('create');
+               $t->assertText("//p[@class='message']", $lang['strsequencecreated']);
+               $t->clickAndWait('link=testcase_seq');
+               $t->assertText("//tr/th[text()='{$lang['strname']}' and @class='data']/../../tr/td[1]", 'testcase_seq');
+               $i=2;
                $t->assertText("//tr/td[text()='testcase_seq']/../td[". $i++ ."]", '1');
-       $t->assertText("//tr/td[text()='testcase_seq']/../td[". $i++ ."]", '2');
-       $t->assertText("//tr/td[text()='testcase_seq']/../td[". $i++ ."]", '100');
-       $t->assertText("//tr/td[text()='testcase_seq']/../td[". $i++ ."]", '1');
-       $t->assertText("//tr/td[text()='testcase_seq']/../td[". $i++ ."]", '1');
-       $i++; // we ignore log_count
-       $t->assertText("//tr/td[text()='testcase_seq']/../td[". $i ."]", $lang['stryes']);
+               if ($t->data->hasAlterSequenceStart())
+                       $t->assertText("//tr/td[text()='testcase_seq']/../td[". $i++ ."]", '1');
+               $t->assertText("//tr/td[text()='testcase_seq']/../td[". $i++ ."]", '2');
+               $t->assertText("//tr/td[text()='testcase_seq']/../td[". $i++ ."]", '100');
+               $t->assertText("//tr/td[text()='testcase_seq']/../td[". $i++ ."]", '1');
+               $t->assertText("//tr/td[text()='testcase_seq']/../td[". $i++ ."]", '1');
+               $i++; // we ignore log_count
+               $t->assertText("//tr/td[text()='testcase_seq']/../td[". $i ."]", $lang['stryes']);
 
-/** 2 **/
-       $t->addComment('2. increment, reset sequence and set value');
-       $t->clickAndWait("link={$lang['strsetval']}");
-       $t->type('nextvalue', '2');
-       $t->clickAndWait('setval');
-       $t->assertText("//p[@class='message']", $lang['strsequencesetval']);
-       if ($data->hasAlterSequenceStart()) $i = 3;
-       else $i = 2;
-       $t->assertText("//tr/td[text()='testcase_seq']/../td[$i]", '2');
-       $t->clickAndWait("link={$lang['strnextval']}");
-       $t->assertText("//p[@class='message']", $lang['strsequencenextval']);
-       $t->assertText("//tr/td[text()='testcase_seq']/../td[$i]", '4');
-       $t->clickAndWait("link={$lang['strreset']}");
-       $t->assertText("//p[@class='message']", $lang['strsequencereset']);
-       $t->assertText("//tr/td[text()='testcase_seq']/../td[$i]", '1');
+       /** 2 **/
+               $t->addComment('2. increment, reset sequence and set value');
+               $t->clickAndWait("link={$lang['strsetval']}");
+               $t->type('nextvalue', '2');
+               $t->clickAndWait('setval');
+               $t->assertText("//p[@class='message']", $lang['strsequencesetval']);
+               if ($t->data->hasAlterSequenceStart()) $i = 3;
+               else $i = 2;
+               $t->assertText("//tr/td[text()='testcase_seq']/../td[$i]", '2');
+               $t->clickAndWait("link={$lang['strnextval']}");
+               $t->assertText("//p[@class='message']", $lang['strsequencenextval']);
+               $t->assertText("//tr/td[text()='testcase_seq']/../td[$i]", '4');
+               $t->clickAndWait("link={$lang['strreset']}");
+               $t->assertText("//p[@class='message']", $lang['strsequencereset']);
+               $t->assertText("//tr/td[text()='testcase_seq']/../td[$i]", '1');
 
-/** 3 **/
-       $t->addComment('3. alter sequence');
-       $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strdatabase']}']/span[@class='label' and text()='{$testdb}']");
-       $t->clickAndWait("link={$lang['strschemas']}");
-       $t->clickAndWait('link=public');
-       $t->clickAndWait("link={$lang['strsequences']}");
-       $t->clickAndWait('link=testcase_seq');
-       $t->clickAndWait("link={$lang['stralter']}");
-       $t->type('name', 'testcase_renamed_seq');
-       $t->select('owner', "label={$user}");
-       if ($data->hasAlterSequenceSchema())
-               $t->select('newschema', 'label=test_schema');
-       $t->type('comment', 'test comment on testcase_renamed_seq');
-       if ($data->hasAlterSequenceStart())
-               $t->type('formStartValue', 10);
-       $t->type('formRestartValue', 20);
-       $t->type('formIncrement', 3);
-       $t->type('formMaxValue', 104);
-       $t->type('formMinValue', 5);
-       $t->type('formCacheValue', 6);
-       $t->uncheck('formCycledValue');
-       $t->clickAndWait('alter');
-       $t->assertText("//p[@class='message']", $lang['strsequencealtered']);
-       if ($data->hasAlterSequenceSchema())
-               $t->assertText("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label']", 'test_schema');
-       $t->assertText("//p[@class='comment']", 'test comment on testcase_renamed_seq');
-       $t->assertText("//tr/th[text()='{$lang['strname']}' and @class='data']/../../tr/td[1]", 'testcase_renamed_seq');
-       $i = 2;
-       if ($data->hasAlterSequenceStart())
-               $t->assertText("//tr/td[text()='testcase_renamed_seq']/../td[". $i++ ."]", '10');
-       $t->assertText("//tr/td[text()='testcase_renamed_seq']/../td[". $i++ ."]", '20');
-       $t->assertText("//tr/td[text()='testcase_renamed_seq']/../td[". $i++ ."]", '3');
-       $t->assertText("//tr/td[text()='testcase_renamed_seq']/../td[". $i++ ."]", '104');
-       $t->assertText("//tr/td[text()='testcase_renamed_seq']/../td[". $i++ ."]", '5');
-       $t->assertText("//tr/td[text()='testcase_renamed_seq']/../td[". $i++ ."]", '6');
-       $i++; // we ignore log_count
-       $t->assertText("//tr/td[text()='testcase_renamed_seq']/../td[". $i++ ."]", $lang['strno']);
+       /** 3 **/
+               $t->addComment('3. alter sequence');
+               $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strdatabase']}']/span[@class='label' and text()='{$testdb}']");
+               $t->clickAndWait("link={$lang['strschemas']}");
+               $t->clickAndWait('link=public');
+               $t->clickAndWait("link={$lang['strsequences']}");
+               $t->clickAndWait('link=testcase_seq');
+               $t->clickAndWait("link={$lang['stralter']}");
+               $t->type('name', 'testcase_renamed_seq');
+               $t->select('owner', "label={$user}");
+               if ($t->data->hasAlterSequenceSchema())
+                       $t->select('newschema', 'label=test_schema');
+               $t->type('comment', 'test comment on testcase_renamed_seq');
+               if ($t->data->hasAlterSequenceStart())
+                       $t->type('formStartValue', 10);
+               $t->type('formRestartValue', 20);
+               $t->type('formIncrement', 3);
+               $t->type('formMaxValue', 104);
+               $t->type('formMinValue', 5);
+               $t->type('formCacheValue', 6);
+               $t->uncheck('formCycledValue');
+               $t->clickAndWait('alter');
+               $t->assertText("//p[@class='message']", $lang['strsequencealtered']);
+               if ($t->data->hasAlterSequenceSchema())
+                       $t->assertText("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label']", 'test_schema');
+               $t->assertText("//p[@class='comment']", 'test comment on testcase_renamed_seq');
+               $t->assertText("//tr/th[text()='{$lang['strname']}' and @class='data']/../../tr/td[1]", 'testcase_renamed_seq');
+               $i = 2;
+               if ($t->data->hasAlterSequenceStart())
+                       $t->assertText("//tr/td[text()='testcase_renamed_seq']/../td[". $i++ ."]", '10');
+               $t->assertText("//tr/td[text()='testcase_renamed_seq']/../td[". $i++ ."]", '20');
+               $t->assertText("//tr/td[text()='testcase_renamed_seq']/../td[". $i++ ."]", '3');
+               $t->assertText("//tr/td[text()='testcase_renamed_seq']/../td[". $i++ ."]", '104');
+               $t->assertText("//tr/td[text()='testcase_renamed_seq']/../td[". $i++ ."]", '5');
+               $t->assertText("//tr/td[text()='testcase_renamed_seq']/../td[". $i++ ."]", '6');
+               $i++; // we ignore log_count
+               $t->assertText("//tr/td[text()='testcase_renamed_seq']/../td[". $i++ ."]", $lang['strno']);
 
-       if ($data->hasAlterSequenceSchema())
-               $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label' and text()='test_schema']");
-       else
-               $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label' and text()='public']");
-       $t->clickAndWait("link={$lang['strsequences']}");
-       $t->assertText("//tr/td[2]/a[text()='testcase_renamed_seq']/../../td[3]", $user);
+               if ($t->data->hasAlterSequenceSchema())
+                       $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label' and text()='test_schema']");
+               else
+                       $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label' and text()='public']");
+               $t->clickAndWait("link={$lang['strsequences']}");
+               $t->assertText("//tr/td[2]/a[text()='testcase_renamed_seq']/../../td[3]", $user);
 
-/** 4 **/
-       $t->addComment('4. drop sequence');
-       $t->clickAndWait("link={$lang['strsequences']}");
-       $t->clickAndWait("//tr/td/a[text()='testcase_renamed_seq']/../../td/a[text()='{$lang['strdrop']}']");
-       $t->click('cascade');
-       $t->clickAndWait('drop');
-       $t->assertText("//p[@class='message']", $lang['strsequencedropped']);
+       /** 4 **/
+               $t->addComment('4. drop sequence');
+               $t->clickAndWait("link={$lang['strsequences']}");
+               $t->clickAndWait("//tr/td/a[text()='testcase_renamed_seq']/../../td/a[text()='{$lang['strdrop']}']");
+               $t->click('cascade');
+               $t->clickAndWait('drop');
+               $t->assertText("//p[@class='message']", $lang['strsequencedropped']);
 
-       $t->logout();
-       $t->writeTests("{$test_static_dir}/{$server['desc']}/sequence.html", $testsuite_file);
-       unset($t);
+               $t->logout();
+               unset($t);
+       }
 ?>
index f72225c69922de7330ee97fd88b86b7f495a8f00..8fded5b1be2bc3ac05c167ca60240736e6c7c7e7 100644 (file)
 <?php
-       global $testsuite_file, $test_static_dir;
+       $test_title = 'Constraint tests';
 
-       /*
-        * 1/ Add 2 Foreign Keys
-        * 2/ Add check constraint
-        * 3/ Add unique key
-        * 4/ Drop PK before creating it again
-        * 5/ Add primary key
-        * 6/ Drop FK
-        * 7/ Drop unique
-        * 8/ Drop check
-        */
-       $t = new TestBuilder($server['desc'],
-               'Constraint tests',
-               'Create and drop constraints...'
-       );
+       if (isset($_GET['run'])) {
+               global $lang;
+               require('../config.test.php');
+               require('../testBuilder.class.php');
+               /*
+                * 1/ Add 2 Foreign Keys
+                * 2/ Add check constraint
+                * 3/ Add unique key
+                * 4/ Drop PK before creating it again
+                * 5/ Add primary key
+                * 6/ Drop FK
+                * 7/ Drop unique
+                * 8/ Drop check
+                */
+               $t = new TestBuilder($test_title,
+                       'Create and drop constraints...'
+               );
 
-       $t->login($admin_user, $admin_user_pass);
+               $t->login($admin_user, $admin_user_pass);
 
-       /** 1 **/
-       $t->addComment('1. Add 2 Foreign Keys');
-       $t->addComment('1.1. Add 1st Foreign Keys');
-       $t->clickAndWait("link={$lang['strdatabases']}");
-       $t->clickAndWait("link={$testdb}");
-       $t->clickAndWait("link={$lang['strschemas']}");
-       $t->clickAndWait('link=public');
-       $t->clickAndWait("link={$lang['strtables']}");
-       $t->clickAndWait('link=student');
-       $t->clickAndWait("link={$lang['strconstraints']}");
-       $t->clickAndWait("link={$lang['straddfk']}");
-       $t->type('name', 'student_id_promo_fk');
-       $t->addSelection('TableColumnList','label=id_promo');
-       $t->click('add');
-       $t->select('target', 'label=test_schema.promo');
-       $t->clickAndWait("//input[@value='Add']");
-       $t->addSelection('TableColumnList', 'label=id');
-       $t->click('add');
-       $t->select('upd_action', 'label=CASCADE');
-       $t->select('del_action', 'label=RESTRICT');
-       $t->clickAndWait("//input[@value='Add']");
-       $t->assertText("//p[@class='message']", $lang['strfkadded']);
+               /** 1 **/
+               $t->addComment('1. Add 2 Foreign Keys');
+               $t->addComment('1.1. Add 1st Foreign Keys');
+               $t->clickAndWait("link={$lang['strdatabases']}");
+               $t->clickAndWait("link={$testdb}");
+               $t->clickAndWait("link={$lang['strschemas']}");
+               $t->clickAndWait('link=public');
+               $t->clickAndWait("link={$lang['strtables']}");
+               $t->clickAndWait('link=student');
+               $t->clickAndWait("link={$lang['strconstraints']}");
+               $t->clickAndWait("link={$lang['straddfk']}");
+               $t->type('name', 'student_id_promo_fk');
+               $t->addSelection('TableColumnList','label=id_promo');
+               $t->click('add');
+               $t->select('target', 'label=test_schema.promo');
+               $t->clickAndWait("//input[@value='Add']");
+               $t->addSelection('TableColumnList', 'label=id');
+               $t->click('add');
+               $t->select('upd_action', 'label=CASCADE');
+               $t->select('del_action', 'label=RESTRICT');
+               $t->clickAndWait("//input[@value='Add']");
+               $t->assertText("//p[@class='message']", $lang['strfkadded']);
 
-       /** 1' **/
-       $t->addComment('1.2. Add 2nd Foreign Keys');
-       $t->clickAndWait("link={$lang['straddfk']}");
-       $t->type('name', 'fk_to_drop');
-       $t->addSelection('TableColumnList', 'label=id_promo');
-       $t->click('add');
-       $t->select('target','label=test_schema.promo');
-       $t->clickAndWait("//input[@value='Add']");
-       $t->addSelection('TableColumnList', 'label=id');
-       $t->click('add');
-       $t->select('upd_action', 'label=CASCADE');
-       $t->select('del_action', 'label=RESTRICT');
-       $t->clickAndWait("//input[@value='Add']");
-       $t->assertText("//p[@class='message']", $lang['strfkadded']);
+               /** 1' **/
+               $t->addComment('1.2. Add 2nd Foreign Keys');
+               $t->clickAndWait("link={$lang['straddfk']}");
+               $t->type('name', 'fk_to_drop');
+               $t->addSelection('TableColumnList', 'label=id_promo');
+               $t->click('add');
+               $t->select('target','label=test_schema.promo');
+               $t->clickAndWait("//input[@value='Add']");
+               $t->addSelection('TableColumnList', 'label=id');
+               $t->click('add');
+               $t->select('upd_action', 'label=CASCADE');
+               $t->select('del_action', 'label=RESTRICT');
+               $t->clickAndWait("//input[@value='Add']");
+               $t->assertText("//p[@class='message']", $lang['strfkadded']);
 
-       /* 2 */
-       $t->addComment('2. Add check constraint');
-       $t->clickAndWait("link={$lang['straddcheck']}");
-       $t->type('name', 'check_to_drop');
-       $t->type('definition', 'extract(year from birthday) &lt; 2000');
-       $t->clickAndWait('ok');
-       $t->assertText("//p[@class='message']", $lang['strcheckadded']);
+               /* 2 */
+               $t->addComment('2. Add check constraint');
+               $t->clickAndWait("link={$lang['straddcheck']}");
+               $t->type('name', 'check_to_drop');
+               $t->type('definition', 'extract(year from birthday) &lt; 2000');
+               $t->clickAndWait('ok');
+               $t->assertText("//p[@class='message']", $lang['strcheckadded']);
 
-       /* 3 */
-       $t->addComment('3. Add unique key');
-       $t->clickAndWait("link={$lang['stradduniq']}");
-       $t->type('name', 'unique_to_drop');
-       $t->addSelection('TableColumnList', 'label=name');
-       $t->click('add');
-       $t->clickAndWait("//input[@value='{$lang['stradd']}']");
-       $t->assertText("//p[@class='message']", $lang['struniqadded']);
+               /* 3 */
+               $t->addComment('3. Add unique key');
+               $t->clickAndWait("link={$lang['stradduniq']}");
+               $t->type('name', 'unique_to_drop');
+               $t->addSelection('TableColumnList', 'label=name');
+               $t->click('add');
+               $t->clickAndWait("//input[@value='{$lang['stradd']}']");
+               $t->assertText("//p[@class='message']", $lang['struniqadded']);
 
-       /* 4 */
-       $t->addComment('4. Drop PK before creating it again');
-       $t->clickAndWait("//tr/td/pre[text()='PRIMARY KEY (id)']/../../td/a[text()='{$lang['strdrop']}']");
-       $t->clickAndWait('drop');
-       $t->assertText("//p[@class='message']", $lang['strconstraintdropped']);
+               /* 4 */
+               $t->addComment('4. Drop PK before creating it again');
+               $t->clickAndWait("//tr/td/pre[text()='PRIMARY KEY (id)']/../../td/a[text()='{$lang['strdrop']}']");
+               $t->clickAndWait('drop');
+               $t->assertText("//p[@class='message']", $lang['strconstraintdropped']);
 
-       /* 5 */
-       $t->addComment('5. Add primary key');
-       $t->clickAndWait("link={$lang['straddpk']}");
-       $t->type('name', 'student_pk');
-       $t->addSelection('TableColumnList', 'label=id');
-       $t->click('add');
-       $t->clickAndWait("//input[@value='Add']");
-       $t->assertText("//p[@class='message']", $lang['strpkadded']);
+               /* 5 */
+               $t->addComment('5. Add primary key');
+               $t->clickAndWait("link={$lang['straddpk']}");
+               $t->type('name', 'student_pk');
+               $t->addSelection('TableColumnList', 'label=id');
+               $t->click('add');
+               $t->clickAndWait("//input[@value='Add']");
+               $t->assertText("//p[@class='message']", $lang['strpkadded']);
 
-       /* 6 */
-       $t->addComment('6. Drop FK');
-       $t->clickAndWait("//tr/td[text()='fk_to_drop']/../td/a[text()='{$lang['strdrop']}']");
-       $t->clickAndWait('drop');
-       $t->assertText("//p[@class='message']", $lang['strconstraintdropped']);
+               /* 6 */
+               $t->addComment('6. Drop FK');
+               $t->clickAndWait("//tr/td[text()='fk_to_drop']/../td/a[text()='{$lang['strdrop']}']");
+               $t->clickAndWait('drop');
+               $t->assertText("//p[@class='message']", $lang['strconstraintdropped']);
 
-       /* 7 */
-       $t->addComment('7. Drop unique');
-       $t->clickAndWait("//tr/td[text()='unique_to_drop']/../td/a[text()='{$lang['strdrop']}']");
-       $t->clickAndWait('drop');
-       $t->assertText("//p[@class='message']", $lang['strconstraintdropped']);
+               /* 7 */
+               $t->addComment('7. Drop unique');
+               $t->clickAndWait("//tr/td[text()='unique_to_drop']/../td/a[text()='{$lang['strdrop']}']");
+               $t->clickAndWait('drop');
+               $t->assertText("//p[@class='message']", $lang['strconstraintdropped']);
 
-       /* 8 */
-       $t->addComment('8. Drop check');
-       $t->clickAndWait("//tr/td[text()='check_to_drop']/../td/a[text()='{$lang['strdrop']}']");
-       $t->clickAndWait('drop');
-       $t->assertText("//p[@class='message']", $lang['strconstraintdropped']);
+               /* 8 */
+               $t->addComment('8. Drop check');
+               $t->clickAndWait("//tr/td[text()='check_to_drop']/../td/a[text()='{$lang['strdrop']}']");
+               $t->clickAndWait('drop');
+               $t->assertText("//p[@class='message']", $lang['strconstraintdropped']);
 
-       $t->logout();
-       $t->writeTests("{$test_static_dir}/{$server['desc']}/constraint.html", $testsuite_file);
-       unset($t);
+               $t->logout();
+               unset($t);
+       }
 ?>
\ No newline at end of file
index 2896797bc6b4e3fccf8bba1332f00469111782bc..9db6f1b6154070ae9dbbe390fe89ab88a8511fd5 100644 (file)
@@ -1,94 +1,97 @@
 <?php
-global $testsuite_file, $test_static_dir;
+       $test_title = 'Column tests';
 
-/**
- * 1/ Add column
- * 2/ Alter column
- * 3/ Alter column bad
- * 4/ Drop column
- **/
-$t = new TestBuilder($server['desc'],
-       'Column tests',
-       'Add/Alter/Drop a column'
-);
+       if (isset($_GET['run'])) {
+               global $lang;
+               require('../config.test.php');
+               require('../testBuilder.class.php');
+               /**
+                * 1/ Add column
+                * 2/ Alter column
+                * 3/ Alter column bad
+                * 4/ Drop column
+                **/
+               $t = new TestBuilder($test_title,
+                       'Add/Alter/Drop a column'
+               );
 
-$t->login($admin_user, $admin_user_pass);
+               $t->login($admin_user, $admin_user_pass);
 
-/** 1 **/
-$t->addComment('1. add column');
-$t->clickAndWait("link={$lang['strdatabases']}");
-$t->clickAndWait("link={$testdb}");
-$t->clickAndWait("link={$lang['strschemas']}");
-$t->clickAndWait('link=public');
-$t->clickAndWait("link={$lang['strtables']}");
-$t->clickAndWait('link=student');
-$t->clickAndWait("link={$lang['strcolumns']}");
-$t->clickAndWait("link={$lang['straddcolumn']}");
-$t->type('field', 'new_col');
-$t->select('type', 'label=integer');
-$t->type('default', 0);
-$t->type('comment', 'test col to drop');
-$t->clickAndWait("//input[@value='Add']");
-$t->assertText("//p[@class='message']", $lang['strcolumnadded']);
-$t->assertText("//tr/td/a[text()='new_col']", 'new_col');
-$t->assertText("//tr/td/a[text()='new_col']/../../td[2]", 'integer');
-if ($data->hasCreateFieldWithConstraints()) {
-       $t->assertText("//tr/td/a[text()='new_col']/../../td[3]", '');
-       $t->assertText("//tr/td/a[text()='new_col']/../../td[4]", '0');
-}
-$t->assertText("//tr/td/a[text()='new_col']/../../td[10]", 'test col to drop');
+               /** 1 **/
+               $t->addComment('1. add column');
+               $t->clickAndWait("link={$lang['strdatabases']}");
+               $t->clickAndWait("link={$testdb}");
+               $t->clickAndWait("link={$lang['strschemas']}");
+               $t->clickAndWait('link=public');
+               $t->clickAndWait("link={$lang['strtables']}");
+               $t->clickAndWait('link=student');
+               $t->clickAndWait("link={$lang['strcolumns']}");
+               $t->clickAndWait("link={$lang['straddcolumn']}");
+               $t->type('field', 'new_col');
+               $t->select('type', 'label=integer');
+               $t->type('default', 0);
+               $t->type('comment', 'test col to drop');
+               $t->clickAndWait("//input[@value='Add']");
+               $t->assertText("//p[@class='message']", $lang['strcolumnadded']);
+               $t->assertText("//tr/td/a[text()='new_col']", 'new_col');
+               $t->assertText("//tr/td/a[text()='new_col']/../../td[2]", 'integer');
+               if ($t->data->hasCreateFieldWithConstraints()) {
+                       $t->assertText("//tr/td/a[text()='new_col']/../../td[3]", '');
+                       $t->assertText("//tr/td/a[text()='new_col']/../../td[4]", '0');
+               }
+               $t->assertText("//tr/td/a[text()='new_col']/../../td[10]", 'test col to drop');
 
-/** 2 **/
-$t->addComment('2. alter column');
-$t->clickAndWait("link={$lang['strcolumns']}");
-$t->clickAndWait('link=new_col');
-$t->clickAndWait("link={$lang['stralter']}");
-$t->type('field', 'altered_col');
-$current_type='integer';
-$current_default='1';
-if ($data->hasAlterColumnType()) {
-       $t->select('type', 'label=character');
-       $t->type('length', 1);
-       $t->type('default', "'-'");
-       $current_type='character(1)';
-       $current_default="'-'";
-}
-else {
-       $t->type('default', '2');
-       $current_default='2';
-}
-$t->check('notnull');
-$t->type('comment', 'altered col to drop');
-$t->clickAndWait("//input[@value='Alter']");
-$t->assertText("//p[@class='message']", $lang['strcolumnaltered']);
-$t->assertText("//p[@class='comment']", 'altered col to drop');
-$t->assertText("//tr/th[text()='{$lang['strcolumn']}']/../../tr[2]/td[1]", 'altered_col');
-$t->assertText("//tr/td[1 and text()='altered_col']/../td[2]", $current_type);
-$t->assertText("//tr/td[1 and text()='altered_col']/../td[3]", 'NOT NULL');
-$t->assertText("//tr/td[1 and text()='altered_col']/../td[4]", "{$current_default}*");
+               /** 2 **/
+               $t->addComment('2. alter column');
+               $t->clickAndWait("link={$lang['strcolumns']}");
+               $t->clickAndWait('link=new_col');
+               $t->clickAndWait("link={$lang['stralter']}");
+               $t->type('field', 'altered_col');
+               $current_type='integer';
+               $current_default='1';
+               if ($t->data->hasAlterColumnType()) {
+                       $t->select('type', 'label=character');
+                       $t->type('length', 1);
+                       $t->type('default', "'-'");
+                       $current_type='character(1)';
+                       $current_default="'-'";
+               }
+               else {
+                       $t->type('default', '2');
+                       $current_default='2';
+               }
+               $t->check('notnull');
+               $t->type('comment', 'altered col to drop');
+               $t->clickAndWait("//input[@value='Alter']");
+               $t->assertText("//p[@class='message']", $lang['strcolumnaltered']);
+               $t->assertText("//p[@class='comment']", 'altered col to drop');
+               $t->assertText("//tr/th[text()='{$lang['strcolumn']}']/../../tr[2]/td[1]", 'altered_col');
+               $t->assertText("//tr/td[1 and text()='altered_col']/../td[2]", $current_type);
+               $t->assertText("//tr/td[1 and text()='altered_col']/../td[3]", 'NOT NULL');
+               $t->assertText("//tr/td[1 and text()='altered_col']/../td[4]", "{$current_default}*");
 
-/** 3 **/
-$t->addComment('3. alter column fail');
-$t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strtable']}']/span[@class='label' and text()='student']");
-$t->clickAndWait('link=name');
-$t->clickAndWait("link={$lang['stralter']}");
-$t->type('default', 'Bad default value');
-$t->clickAndWait("//input[@value='Alter']");
-$t->assertText("//p[@class='message']", $lang['strcolumnalteredbad']);
-$t->clickAndWait('cancel');
+               /** 3 **/
+               $t->addComment('3. alter column fail');
+               $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strtable']}']/span[@class='label' and text()='student']");
+               $t->clickAndWait('link=name');
+               $t->clickAndWait("link={$lang['stralter']}");
+               $t->type('default', 'Bad default value');
+               $t->clickAndWait("//input[@value='Alter']");
+               $t->assertText("//p[@class='message']", $lang['strcolumnalteredbad']);
+               $t->clickAndWait('cancel');
 
-/** 4 **/
-$t->addComment('4. drop column');
-$t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strtable']}']/span[@class='label' and text()='student']");
-$t->clickAndWait('link=altered_col');
-$t->clickAndWait("link={$lang['strdrop']}");
-$t->click('cascade');
-$t->clickAndWait('drop');
-$t->assertText("//p[@class='message']", $lang['strcolumndropped']);
-$t->assertErrorOnNext("Element //tr/td/a[text()='altered_col'] not found");
-$t->clickAndWait("//tr/td/a[text()='altered_col']"); //fail
+               /** 4 **/
+               $t->addComment('4. drop column');
+               $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strtable']}']/span[@class='label' and text()='student']");
+               $t->clickAndWait('link=altered_col');
+               $t->clickAndWait("link={$lang['strdrop']}");
+               $t->click('cascade');
+               $t->clickAndWait('drop');
+               $t->assertText("//p[@class='message']", $lang['strcolumndropped']);
+               $t->assertErrorOnNext("Element //tr/td/a[text()='altered_col'] not found");
+               $t->clickAndWait("//tr/td/a[text()='altered_col']"); //fail
 
-$t->logout();
-$t->writeTests("{$test_static_dir}/{$server['desc']}/column.html", $testsuite_file);
-unset($t);
+               $t->logout();
+               unset($t);
+       }
 ?>
index b5ec22f456fecba2b6e31391a0869b0f2034a8e5..d54706c2987dd5f799aace75b1985f0aa22fc6cd 100644 (file)
 <?php
-global $testsuite_file, $test_static_dir;
+       $test_title = 'View tests';
 
-/**
- * 1/ Create a view
- * 2/ Alter a view
- * 3/ Drop a view
- **/
-$t = new TestBuilder($server['desc'],
-       'View tests',
-       'Add/Alter/Drop a view'
-);
+       if (isset($_GET['run'])) {
+               global $lang;
+               require('../config.test.php');
+               require('../testBuilder.class.php');
+               /**
+                * 1/ Create a view
+                * 2/ Alter a view
+                * 3/ Drop a view
+                **/
+               $t = new TestBuilder($test_title,
+                       'Add/Alter/Drop a view'
+               );
 
-$t->login($admin_user, $admin_user_pass);
+               $t->login($admin_user, $admin_user_pass);
 
-/** 1 **/
-$t->addComment('1. Create the view');
-$t->clickAndWait("link={$lang['strdatabases']}");
-$t->clickAndWait("link={$testdb}");
-$t->clickAndWait("link={$lang['strschemas']}");
-$t->clickAndWait('link=public');
-$t->clickAndWait("link={$lang['strviews']}");
-$t->clickAndWait("link={$lang['strcreateview']}");
-$t->type('formView', 'student_promo');
-$t->type('formDefinition', 'SELECT s.id, name, birthday, resume, spe, year
-       FROM student AS s
-       JOIN test_schema.promo AS p ON (s.id_promo=p.id)');
-$t->type('formComment', 'students and their promotion');
-$t->clickAndWait("//input[@value='Create']");
-$t->assertText("//p[@class='message']", "{$lang['strviewcreated']}");
-$t->assertText("//tr/td[2]/a[text()='student_promo']/../../td[2]", 'student_promo');
-$t->assertText("//tr/td[2]/a[text()='student_promo']/../../td[3]", $admin_user);
-$t->assertText("//tr/td[2]/a[text()='student_promo']/../../td[8]", 'students and their promotion');
-$t->assertText("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label']", 'public');
+               /** 1 **/
+               $t->addComment('1. Create the view');
+               $t->clickAndWait("link={$lang['strdatabases']}");
+               $t->clickAndWait("link={$testdb}");
+               $t->clickAndWait("link={$lang['strschemas']}");
+               $t->clickAndWait('link=public');
+               $t->clickAndWait("link={$lang['strviews']}");
+               $t->clickAndWait("link={$lang['strcreateview']}");
+               $t->type('formView', 'student_promo');
+               $t->type('formDefinition', 'SELECT s.id, name, birthday, resume, spe, year
+                       FROM student AS s
+                       JOIN test_schema.promo AS p ON (s.id_promo=p.id)');
+               $t->type('formComment', 'students and their promotion');
+               $t->clickAndWait("//input[@value='Create']");
+               $t->assertText("//p[@class='message']", "{$lang['strviewcreated']}");
+               $t->assertText("//tr/td[2]/a[text()='student_promo']/../../td[2]", 'student_promo');
+               $t->assertText("//tr/td[2]/a[text()='student_promo']/../../td[3]", $admin_user);
+               $t->assertText("//tr/td[2]/a[text()='student_promo']/../../td[8]", 'students and their promotion');
+               $t->assertText("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label']", 'public');
 
-/** 2 **/
-$t->addComment('2. Alter the view');
-$t->clickAndWait("link={$lang['strviews']}");
-$t->clickAndWait('link=student_promo');
-$t->clickAndWait("//ul[@class='navlink']/li/a[text()='{$lang['stralter']}']");
-//Alter name
-$t->addComment('2.1. Alter view\'s name');
-$t->type('name', 'student_promo_renamed');
-$t->clickAndWait('alter');
-$t->assertText("//p[@class='message']", $lang['strviewaltered']);
-$t->assertText("//div[@class='trail']/descendant::a[@title='{$lang['strview']}']/span[@class='label']", 'student_promo_renamed');
-//Alter comment
-$t->addComment('2.2. Alter view\'s comment');
-$t->clickAndWait("//ul[@class='navlink']/li/a[text()='{$lang['stralter']}']");
-$t->type('comment', 'students and their promotion (altered)');
-$t->clickAndWait('alter');
-$t->assertText("//p[@class='message']", $lang['strviewaltered']);
-$t->assertText("//p[@class='comment']", 'students and their promotion (altered)');
-// Alter schema
-$current_shema='public';
-if ($data->hasAlterTableSchema()) {
-       $t->addComment('2.3. Alter view\'s schema');
-       $t->clickAndWait("//ul[@class='navlink']/li/a[text()='{$lang['stralter']}']");
-       $t->select('newschema', 'label=test_schema');
-       $t->clickAndWait('alter');
-       $t->assertText("//p[@class='message']", $lang['strviewaltered']);
-       $t->assertText("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label']", 'test_schema');
-       $current_shema='test_schema';
-}
-// Alter owner
-$t->addComment('2.4. Alter view\'s owner');
-$t->clickAndWait("//ul[@class='navlink']/li/a[text()='{$lang['stralter']}']");
-$t->select('owner', "label={$user}");
-$t->clickAndWait('alter');
-$t->assertText("//p[@class='message']", $lang['strviewaltered']);
-$t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label' and text()='{$current_shema}']");
-$t->clickAndWait("link={$lang['strviews']}");
-$t->assertText("//tr/td[2]/a[text()='student_promo_renamed']/../../td[3]", $user);
-// Alter back everything
-$t->addComment('2.5. Alter back everything');
-$t->clickAndWait('link=student_promo_renamed');
-$t->clickAndWait("//ul[@class='navlink']/li/a[text()='{$lang['stralter']}']");
-$t->select('owner', "label={$admin_user}");
-$t->type('name', 'student_promo');
-if ($data->hasAlterTableSchema()) {
-       $t->select('newschema', 'label=public');
-}
-$t->type('comment', 'students and their promotion');
-$t->clickAndWait('alter');
-$t->assertText("//p[@class='message']", $lang['strviewaltered']);
-$t->assertText("//p[@class='comment']", 'students and their promotion');
-$t->assertText("//div[@class='trail']/descendant::a[@title='{$lang['strview']}']/span[@class='label']", 'student_promo');
-$t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label' and text()='public']");
-$t->clickAndWait("link={$lang['strviews']}");
-$t->assertText("//tr/td[2]/a[text()='student_promo']/../../td[3]", $admin_user);
+               /** 2 **/
+               $t->addComment('2. Alter the view');
+               $t->clickAndWait("link={$lang['strviews']}");
+               $t->clickAndWait('link=student_promo');
+               $t->clickAndWait("//ul[@class='navlink']/li/a[text()='{$lang['stralter']}']");
+               //Alter name
+               $t->addComment('2.1. Alter view\'s name');
+               $t->type('name', 'student_promo_renamed');
+               $t->clickAndWait('alter');
+               $t->assertText("//p[@class='message']", $lang['strviewaltered']);
+               $t->assertText("//div[@class='trail']/descendant::a[@title='{$lang['strview']}']/span[@class='label']", 'student_promo_renamed');
+               //Alter comment
+               $t->addComment('2.2. Alter view\'s comment');
+               $t->clickAndWait("//ul[@class='navlink']/li/a[text()='{$lang['stralter']}']");
+               $t->type('comment', 'students and their promotion (altered)');
+               $t->clickAndWait('alter');
+               $t->assertText("//p[@class='message']", $lang['strviewaltered']);
+               $t->assertText("//p[@class='comment']", 'students and their promotion (altered)');
+               // Alter schema
+               $current_shema='public';
+               if ($t->data->hasAlterTableSchema()) {
+                       $t->addComment('2.3. Alter view\'s schema');
+                       $t->clickAndWait("//ul[@class='navlink']/li/a[text()='{$lang['stralter']}']");
+                       $t->select('newschema', 'label=test_schema');
+                       $t->clickAndWait('alter');
+                       $t->assertText("//p[@class='message']", $lang['strviewaltered']);
+                       $t->assertText("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label']", 'test_schema');
+                       $current_shema='test_schema';
+               }
+               // Alter owner
+               $t->addComment('2.4. Alter view\'s owner');
+               $t->clickAndWait("//ul[@class='navlink']/li/a[text()='{$lang['stralter']}']");
+               $t->select('owner', "label={$user}");
+               $t->clickAndWait('alter');
+               $t->assertText("//p[@class='message']", $lang['strviewaltered']);
+               $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label' and text()='{$current_shema}']");
+               $t->clickAndWait("link={$lang['strviews']}");
+               $t->assertText("//tr/td[2]/a[text()='student_promo_renamed']/../../td[3]", $user);
+               // Alter back everything
+               $t->addComment('2.5. Alter back everything');
+               $t->clickAndWait('link=student_promo_renamed');
+               $t->clickAndWait("//ul[@class='navlink']/li/a[text()='{$lang['stralter']}']");
+               $t->select('owner', "label={$admin_user}");
+               $t->type('name', 'student_promo');
+               if ($t->data->hasAlterTableSchema()) {
+                       $t->select('newschema', 'label=public');
+               }
+               $t->type('comment', 'students and their promotion');
+               $t->clickAndWait('alter');
+               $t->assertText("//p[@class='message']", $lang['strviewaltered']);
+               $t->assertText("//p[@class='comment']", 'students and their promotion');
+               $t->assertText("//div[@class='trail']/descendant::a[@title='{$lang['strview']}']/span[@class='label']", 'student_promo');
+               $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label' and text()='public']");
+               $t->clickAndWait("link={$lang['strviews']}");
+               $t->assertText("//tr/td[2]/a[text()='student_promo']/../../td[3]", $admin_user);
 
-/** 3 **/
-$t->addComment('3. Drop the view');
-$t->clickAndWait("//tr/td/a[text()='student_promo']/../../td/a[text()='{$lang['strdrop']}']");
-$t->clickAndWait('drop');
-$t->assertText("//p[@class='message']", $lang['strviewdropped']);
-$t->assertErrorOnNext("Element //tr/td/a[text()='student_promo'] not found");
-$t->clickAndWait("//tr/td/a[text()='student_promo']"); //fail
+               /** 3 **/
+               $t->addComment('3. Drop the view');
+               $t->clickAndWait("//tr/td/a[text()='student_promo']/../../td/a[text()='{$lang['strdrop']}']");
+               $t->clickAndWait('drop');
+               $t->assertText("//p[@class='message']", $lang['strviewdropped']);
+               $t->assertErrorOnNext("Element //tr/td/a[text()='student_promo'] not found");
+               $t->clickAndWait("//tr/td/a[text()='student_promo']"); //fail
 
-$t->logout();
-$t->writeTests("{$test_static_dir}/{$server['desc']}/view.html", $testsuite_file);
-unset($t);
+               $t->logout();
+               unset($t);
+       }
 ?>
\ No newline at end of file
index d17568cae90f9d18eefc7fb76a0a1e23511d0bb0..bc2e6eda07fc2ac0292a2086f51d44de0b820314 100644 (file)
@@ -1,49 +1,52 @@
 <?php
-global $testsuite_file, $test_static_dir;
+       $test_title = 'Index tests';
 
-/**
- * 1/ Create the unique index
- * 2/ Drop the index
- **/
-$t = new TestBuilder($server['desc'],
-       'Index tests',
-       'Create/Drop an unique Index'
-);
+       if (isset($_GET['run'])) {
+               global $lang;
+               require('../config.test.php');
+               require('../testBuilder.class.php');
+               /**
+                * 1/ Create the unique index
+                * 2/ Drop the index
+                **/
+               $t = new TestBuilder($test_title,
+                       'Create/Drop an unique Index'
+               );
 
-$t->login($admin_user, $admin_user_pass);
+               $t->login($admin_user, $admin_user_pass);
 
-/** 1 **/
-$t->addComment('1. Create the unique index');
-$t->clickAndWait("link={$lang['strdatabases']}");
-$t->clickAndWait("link={$testdb}");
-$t->clickAndWait("link={$lang['strschemas']}");
-$t->clickAndWait('link=public');
-$t->clickAndWait("link={$lang['strtables']}");
-$t->clickAndWait('link=student');
-$t->clickAndWait("link={$lang['strindexes']}");
-$t->clickAndWait("link={$lang['strcreateindex']}");
-$t->type('formIndexName', 'name_unique');
-$t->addSelection('TableColumnList', 'label=name');
-$t->click('add');
-$t->clickAndWait("//input[@value='{$lang['strcreate']}']");
-$t->assertText("//p[@class='message']", $lang['strindexcreated']);
+               /** 1 **/
+               $t->addComment('1. Create the unique index');
+               $t->clickAndWait("link={$lang['strdatabases']}");
+               $t->clickAndWait("link={$testdb}");
+               $t->clickAndWait("link={$lang['strschemas']}");
+               $t->clickAndWait('link=public');
+               $t->clickAndWait("link={$lang['strtables']}");
+               $t->clickAndWait('link=student');
+               $t->clickAndWait("link={$lang['strindexes']}");
+               $t->clickAndWait("link={$lang['strcreateindex']}");
+               $t->type('formIndexName', 'name_unique');
+               $t->addSelection('TableColumnList', 'label=name');
+               $t->click('add');
+               $t->clickAndWait("//input[@value='{$lang['strcreate']}']");
+               $t->assertText("//p[@class='message']", $lang['strindexcreated']);
 
-/** 2 **/
-$t->addComment('2. Cluster on the index');
-$t->clickAndWait("link={$lang['strindexes']}");
-$t->clickAndWait("//tr/td[text()='name_unique']/../td/a[text()='Cluster']");
-$t->clickAndWait('cluster');
-$t->assertText("//p[@class='message']", $lang['strclusteredgood'] . ' ' . $lang['stranalyzegood']);
+               /** 2 **/
+               $t->addComment('2. Cluster on the index');
+               $t->clickAndWait("link={$lang['strindexes']}");
+               $t->clickAndWait("//tr/td[text()='name_unique']/../td/a[text()='Cluster']");
+               $t->clickAndWait('cluster');
+               $t->assertText("//p[@class='message']", $lang['strclusteredgood'] . ' ' . $lang['stranalyzegood']);
 
-/** 3 **/
-$t->addComment('3. Drop the index');
-$t->clickAndWait("link={$lang['strindexes']}");
-$t->clickAndWait("//tr/td[text()='name_unique']/../td/a[text()='Drop']");
-$t->click('cascade');
-$t->clickAndWait('drop');
-$t->assertText("//p[@class='message']", $lang['strindexdropped']);
+               /** 3 **/
+               $t->addComment('3. Drop the index');
+               $t->clickAndWait("link={$lang['strindexes']}");
+               $t->clickAndWait("//tr/td[text()='name_unique']/../td/a[text()='Drop']");
+               $t->click('cascade');
+               $t->clickAndWait('drop');
+               $t->assertText("//p[@class='message']", $lang['strindexdropped']);
 
-$t->logout();
-$t->writeTests("{$test_static_dir}/{$server['desc']}/index.html", $testsuite_file);
-unset($t);
+               $t->logout();
+               unset($t);
+       }
 ?>
index aaa99b718ff7c0303c3623b864d3c1d2571485c7..a23b5a4272119da35a43237cdace313ca165eb97 100644 (file)
 <?php
-       global $testsuite_file, $test_static_dir;
+       $test_title = 'Cleaner tests';
 
-       /*
-        * 1/ login as user and try to drop database -> fail
-        * 2/ logout / login as admin_user and drop user role/user
-        * 3/ try to drop himself -> fail
-        * 4/ drop domain -> fail table promo depend on it
-        * 5/ drop domain with cascade, test if promo.year disapeared
-        * 6/ drop table student with cascade using the action button
-        * 7/ drop table promo using the button from tblproperties
-        * 8/ drop test database
-        * 9/ logout & login as superuser and drop admin_user
-        */
-       $t = new TestBuilder($server['desc'],
-               'Cleaner tests',
-               'Clean every created stuff for test.'
-       );
+       if (isset($_GET['run'])) {
+               global $lang;
+               require('../config.test.php');
+               require('../testBuilder.class.php');
+               /*
+                * 1/ login as user and try to drop database -> fail
+                * 2/ logout / login as admin_user and drop user role/user
+                * 3/ try to drop himself -> fail
+                * 4/ drop domain -> fail table promo depend on it
+                * 5/ drop domain with cascade, test if promo.year disapeared
+                * 6/ drop table student with cascade using the action button
+                * 7/ drop table promo using the button from tblproperties
+                * 8/ drop test database
+                * 9/ logout & login as superuser and drop admin_user
+                */
+               $t = new TestBuilder($test_title,
+                       'Clean every created stuff for test.'
+               );
 
-/** 1 **/
-       $t->addComment('1. login as user and try to drop database -> fail');
-       $t->login($user, $user_pass);
-       $t->clickAndWait("link={$lang['strdatabases']}");
-       $t->clickAndWait("//tr/td/a[text()='{$testdb}']/../../td/a[text()='{$lang['strdrop']}']");
-       $t->clickAndWait('drop');
-       $t->assertText('//p[@class=\'message\']', $lang['strdatabasedroppedbad']);
-
-/** 2 **/
-       $t->addComment('2. logout / login as admin_user and drop user role/user');
-       $t->logout();
-       $t->login($admin_user, $admin_user_pass);
-       if ($data->hasRoles()) {
-               $t->clickAndWait("link={$lang['strroles']}");
-               $t->clickAndWait("//tr/td/a[text()='{$user}']/../../td/a[text()='{$lang['strdrop']}']");
-               $t->clickAndWait('drop');
-               $t->assertText('//p[@class=\'message\']', $lang['strroledropped']);
-       } else {
-               $t->clickAndWait("link={$lang['strusers']}");
-               $t->clickAndWait("//tr/td[text()='{$user}']/../td/a[text()='{$lang['strdrop']}']");
+       /** 1 **/
+               $t->addComment('1. login as user and try to drop database -> fail');
+               $t->login($user, $user_pass);
+               $t->clickAndWait("link={$lang['strdatabases']}");
+               $t->clickAndWait("//tr/td/a[text()='{$testdb}']/../../td/a[text()='{$lang['strdrop']}']");
                $t->clickAndWait('drop');
-               $t->assertText('//p[@class=\'message\']', $lang['struserdropped']);
-       }
+               $t->assertText('//p[@class=\'message\']', $lang['strdatabasedroppedbad']);
+
+       /** 2 **/
+               $t->addComment('2. logout / login as admin_user and drop user role/user');
+               $t->logout();
+               $t->login($admin_user, $admin_user_pass);
+               if ($t->data->hasRoles()) {
+                       $t->clickAndWait("link={$lang['strroles']}");
+                       $t->clickAndWait("//tr/td/a[text()='{$user}']/../../td/a[text()='{$lang['strdrop']}']");
+                       $t->clickAndWait('drop');
+                       $t->assertText('//p[@class=\'message\']', $lang['strroledropped']);
+               } else {
+                       $t->clickAndWait("link={$lang['strusers']}");
+                       $t->clickAndWait("//tr/td[text()='{$user}']/../td/a[text()='{$lang['strdrop']}']");
+                       $t->clickAndWait('drop');
+                       $t->assertText('//p[@class=\'message\']', $lang['struserdropped']);
+               }
 
-/** 3 **/
-       $t->addComment('3. try to drop himself -> fail');
-       if ($data->hasRoles()) {
-               $t->clickAndWait("link={$lang['strroles']}");
-               $t->clickAndWait("link={$admin_user}");
-               $t->assertText("//div[@class='trail']/descendant::a[@title='{$lang['strrole']}']/span[@class='label']", $admin_user);
-               $t->clickAndWait("link={$lang['strdrop']}");
+       /** 3 **/
+               $t->addComment('3. try to drop himself -> fail');
+               if ($t->data->hasRoles()) {
+                       $t->clickAndWait("link={$lang['strroles']}");
+                       $t->clickAndWait("link={$admin_user}");
+                       $t->assertText("//div[@class='trail']/descendant::a[@title='{$lang['strrole']}']/span[@class='label']", $admin_user);
+                       $t->clickAndWait("link={$lang['strdrop']}");
+                       $t->clickAndWait('drop');
+                       $t->assertText('//p[@class=\'message\']', $lang['strroledroppedbad']);
+               } else {
+                       $t->clickAndWait("link={$lang['strusers']}");
+                       $t->clickAndWait("//tr/td[text()='{$admin_user}']/../td/a[text()='{$lang['strdrop']}']");
+                       $t->clickAndWait('drop');
+                       $t->assertText('//p[@class=\'message\']', $lang['struserdroppedbad']);
+               }
+
+       /** 4 **/
+               $t->addComment('4. drop domain -> fail table promo depend on it');
+               $t->clickAndWait("link={$lang['strdatabases']}");
+               $t->clickAndWait("link={$testdb}");
+               $t->clickAndWait("link={$lang['strschemas']}");
+               $t->clickAndWait("link=test_schema");
+               $t->clickAndWait("link={$lang['strdomains']}");
+               $t->clickAndWait("//tr/td/a[text()='year']/../../td/a[text()='{$lang['strdrop']}']");
                $t->clickAndWait('drop');
-               $t->assertText('//p[@class=\'message\']', $lang['strroledroppedbad']);
-       } else {
-               $t->clickAndWait("link={$lang['strusers']}");
-               $t->clickAndWait("//tr/td[text()='{$admin_user}']/../td/a[text()='{$lang['strdrop']}']");
+               $t->assertText('//p[@class=\'message\']', $lang['strdomaindroppedbad']);
+
+       /** 5 **/
+               $t->addComment('5. drop domain with cascade, test if promo.year disapeared');
+               $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strdatabase']}']/span[@class='label' and text()='{$testdb}']");
+               $t->clickAndWait("link={$lang['strschemas']}");
+               $t->clickAndWait("link=test_schema");
+               $t->clickAndWait("link={$lang['strdomains']}");
+               $t->clickAndWait("//tr/td/a[text()='year']/../../td/a[text()='{$lang['strdrop']}']");
+               $t->check('cascade');
                $t->clickAndWait('drop');
-               $t->assertText('//p[@class=\'message\']', $lang['struserdroppedbad']);
-       }
+               $t->assertText('//p[@class=\'message\']', $lang['strdomaindropped']);
+               $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label' and text()='test_schema']");
+               $t->clickAndWait("link={$lang['strtables']}");
+               $t->clickAndWait("link=promo");
+               $t->clickAndWait("link={$lang['strcolumns']}");
+               $t->assertErrorOnNext('Element link=year not found');
+               $t->clickAndWait("link=year");
 
-/** 4 **/
-       $t->addComment('4. drop domain -> fail table promo depend on it');
-       $t->clickAndWait("link={$lang['strdatabases']}");
-       $t->clickAndWait("link={$testdb}");
-       $t->clickAndWait("link={$lang['strschemas']}");
-       $t->clickAndWait("link=test_schema");
-       $t->clickAndWait("link={$lang['strdomains']}");
-       $t->clickAndWait("//tr/td/a[text()='year']/../../td/a[text()='{$lang['strdrop']}']");
-       $t->clickAndWait('drop');
-       $t->assertText('//p[@class=\'message\']', $lang['strdomaindroppedbad']);
+       /** 6 **/
+               $t->addComment('6. drop table student with cascade using the action button');
+               $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strserver']}']/span[@class='label' and text()='{$t->server['desc']}']");
+               $t->clickAndWait("link={$lang['strdatabases']}");
+               $t->clickAndWait("link={$testdb}");
+               $t->clickAndWait("link={$lang['strschemas']}");
+               $t->clickAndWait("link=public");
+               $t->clickAndWait("//tr/td/a[text()='student']/../../td/a[text()='{$lang['strdrop']}']");
+               $t->check('cascade');
+               $t->clickAndWait('drop');
+               $t->assertText('//p[@class=\'message\']', $lang['strtabledropped']);
 
-/** 5 **/
-       $t->addComment('5. drop domain with cascade, test if promo.year disapeared');
-       $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strdatabase']}']/span[@class='label' and text()='{$testdb}']");
-       $t->clickAndWait("link={$lang['strschemas']}");
-       $t->clickAndWait("link=test_schema");
-       $t->clickAndWait("link={$lang['strdomains']}");
-       $t->clickAndWait("//tr/td/a[text()='year']/../../td/a[text()='{$lang['strdrop']}']");
-       $t->check('cascade');
-       $t->clickAndWait('drop');
-       $t->assertText('//p[@class=\'message\']', $lang['strdomaindropped']);
-       $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strschema']}']/span[@class='label' and text()='test_schema']");
-       $t->clickAndWait("link={$lang['strtables']}");
-       $t->clickAndWait("link=promo");
-       $t->clickAndWait("link={$lang['strcolumns']}");
-       $t->assertErrorOnNext('Element link=year not found');
-       $t->clickAndWait("link=year");
+       /** 7 **/
+               $t->addComment('7. drop table promo using the button from tblproperties');
+               $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strserver']}']/span[@class='label' and text()='{$t->server['desc']}']");
+               $t->clickAndWait("link={$lang['strdatabases']}");
+               $t->clickAndWait("link={$testdb}");
+               $t->clickAndWait("link={$lang['strschemas']}");
+               $t->clickAndWait("link=test_schema");
+               $t->clickAndWait("link={$lang['strtables']}");
+               $t->clickAndWait("link=promo");
+               $t->clickAndWait("//ul[@class='navlink']/li/a[text()='{$lang['strdrop']}']");
+               $t->clickAndWait('drop');
+               $t->assertText('//p[@class=\'message\']', $lang['strtabledropped']);
 
-/** 6 **/
-       $t->addComment('6. drop table student with cascade using the action button');
-       $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strserver']}']/span[@class='label' and text()='{$server['desc']}']");
-       $t->clickAndWait("link={$lang['strdatabases']}");
-       $t->clickAndWait("link={$testdb}");
-       $t->clickAndWait("link={$lang['strschemas']}");
-       $t->clickAndWait("link=public");
-       $t->clickAndWait("//tr/td/a[text()='student']/../../td/a[text()='{$lang['strdrop']}']");
-       $t->check('cascade');
-       $t->clickAndWait('drop');
-       $t->assertText('//p[@class=\'message\']', $lang['strtabledropped']);
+       /** 8 **/
+               $t->addComment('8. drop test database');
+               $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strserver']}']/span[@class='label' and text()='{$t->server['desc']}']");
+               $t->clickAndWait("link={$lang['strdatabases']}");
+               $t->clickAndWait("//tr/td/a[text()='{$testdb}']/../../td/a[text()='{$lang['strdrop']}']");
+               $t->clickAndWait('drop');
+               $t->assertText('//p[@class=\'message\']', $lang['strdatabasedropped']);
 
-/** 7 **/
-       $t->addComment('7. drop table promo using the button from tblproperties');
-       $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strserver']}']/span[@class='label' and text()='{$server['desc']}']");
-       $t->clickAndWait("link={$lang['strdatabases']}");
-       $t->clickAndWait("link={$testdb}");
-       $t->clickAndWait("link={$lang['strschemas']}");
-       $t->clickAndWait("link=test_schema");
-       $t->clickAndWait("link={$lang['strtables']}");
-       $t->clickAndWait("link=promo");
-       $t->clickAndWait("//ul[@class='navlink']/li/a[text()='{$lang['strdrop']}']");
-       $t->clickAndWait('drop');
-       $t->assertText('//p[@class=\'message\']', $lang['strtabledropped']);
-       
-/** 8 **/
-       $t->addComment('8. drop test database');
-       $t->clickAndWait("//div[@class='trail']/descendant::a[@title='{$lang['strserver']}']/span[@class='label' and text()='{$server['desc']}']");
-       $t->clickAndWait("link={$lang['strdatabases']}");
-       $t->clickAndWait("//tr/td/a[text()='{$testdb}']/../../td/a[text()='{$lang['strdrop']}']");
-       $t->clickAndWait('drop');
-       $t->assertText('//p[@class=\'message\']', $lang['strdatabasedropped']);
+       /** 9 **/
+               $t->addComment('9. logout & login as superuser and drop admin_user');
+               $t->logout();
+               $t->login($super_user[$t->server['desc']], $super_pass[$t->server['desc']]);
 
-/** 9 **/
-       $t->addComment('9. logout & login as superuser and drop admin_user');
-       $t->logout();
-       $t->login($super_user[$server['desc']], $super_pass[$server['desc']]);
+               if ($t->data->hasRoles()) {
+                       /* drop adminuser */
+                       $t->clickAndWait("link={$lang['strroles']}");
+                       $t->clickAndWait("//tr/td/a[text()='{$admin_user}']/../../td/a[text()='{$lang['strdrop']}']");
+                       $t->clickAndWait('drop');
+                       $t->assertText('//p[@class=\'message\']', $lang['strroledropped']);
+               } else {
+                       $t->clickAndWait("link={$lang['strusers']}");
+                       $t->clickAndWait("//tr/td[text()='{$admin_user}']/../td/a[text()='{$lang['strdrop']}']");
+                       $t->clickAndWait('drop');
+                       $t->assertText('//p[@class=\'message\']', $lang['struserdropped']);
+               }
 
-       if ($data->hasRoles()) {
-               /* drop adminuser */
-               $t->clickAndWait("link={$lang['strroles']}");
-               $t->clickAndWait("//tr/td/a[text()='{$admin_user}']/../../td/a[text()='{$lang['strdrop']}']");
-               $t->clickAndWait('drop');
-               $t->assertText('//p[@class=\'message\']', $lang['strroledropped']);
-       } else {
-               $t->clickAndWait("link={$lang['strusers']}");
-               $t->clickAndWait("//tr/td[text()='{$admin_user}']/../td/a[text()='{$lang['strdrop']}']");
-               $t->clickAndWait('drop');
-               $t->assertText('//p[@class=\'message\']', $lang['struserdropped']);
+               $t->logout();
+               unset($t);
        }
-
-       $t->logout();
-       $t->writeTests("{$test_static_dir}/{$server['desc']}/cleantests.html", $testsuite_file);
-    unset($t);
 ?>
diff --git a/tests/selenium/src/skeleton.php-dist b/tests/selenium/src/skeleton.php-dist
new file mode 100644 (file)
index 0000000..7e3b43f
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+       /**
+        * This part is read by the test suite builder (TestSuite.php)
+        * to print the title of each test group
+        **/
+       $test_title = 'Test group title';
+
+       /**
+        * When GET'ed by the test suite builder, it pass two parameters:
+        *   * run: to dynamically create the test group according to the backend PostgreSQL version
+        *   * server: the server id to connect to
+        **/
+       if (isset($_GET['run'])) {
+               /* load the english $lang array */
+               global $lang;
+               /* this file contains logins/passwords and parameters for tests users and database */
+               require('../config.test.php');
+               /* the test builder class */
+               require('../testBuilder.class.php');
+               
+               $t = new TestBuilder($test_title,
+                       'Title for the test group page.'
+               );
+
+               /* tests here...
+               
+               $t->addComment('this is a comment');
+
+               // login
+               $t->login($super_user[$t->server['desc']], $super_pass[$t->server['desc']]);
+
+               // Testing backend capability
+               if ($t->data->hasXXXXX()) {
+                       ...
+               }
+
+               // Filling a field
+               $t->type('formFieldName', "a value");
+
+               // etc...
+               */
+
+               /**
+                * When finished, destry the class instance.
+                **/
+               unset($t);
+       }
+?>
index 95402505e0e4e2d4ceeefe29ba1e4cec4a1e0aa0..b4c22f21d7293cb0188dd8b6f867ef2235b3ef0b 100644 (file)
@@ -1,33 +1,48 @@
 <?php
-/*
- * This class help building a selenium HTML test file for PPA.
-**/
-       class TestBuilder {
-               private $code;
+       function connection_failed($dbms, $fn, $errno, $errmsg, $p1=false, $p2=false) {
+               echo "<div>{$errmsg}</div>\n";
+               exit;
+       }
+
+       $_no_db_connection = true; /* load lib.inc.php without trying to connect */
+       $_REQUEST['language'] = 'english';
+       define('ADODB_ERROR_HANDLER','connection_failed');
+       chdir(dirname(__FILE__). '/../..');
+       require_once('./libraries/lib.inc.php');
 
+       /*
+        * This class help building a selenium HTML test file for PPA.
+       **/
+       class TestBuilder {
                /**
                 * Constructor
                 * @param $serverDesc The server['desc'] conf param to which we are writing this test file for.
                 * @param $title The title of the HTML test page
                 * @param $desc The top description on the HTML test page
                 */
-               public function __construct($serverDesc, $title, $desc) {
+               public function __construct($title, $desc) {
+                       global $misc;
                        $this->title = $title;
-                       $this->servDesc = $serverDesc;
 
-                       /*$this->fd = fopen($this->file, 'w');
+                       $serverid = $_GET['server'];
 
-                       fprintf($this->fd, '%s', "<html>\n<head>
-                               <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">
-                               <title>$title</title>
-                               </head>
-                               <body>
-                               <table cellpadding=\"1\" cellspacing=\"1\" border=\"1\">
-                               <thead>
-                               <tr><td rowspan=\"1\" colspan=\"3\">$desc</td></tr>
-                               </thead><tbody>"
-                       );*/
-                       $this->code =  "<html>\n<head>
+                       require('./tests/selenium/config.test.php');
+                       require_once('./classes/database/Connection.php');
+
+                       $this->webUrl = $webUrl;
+                       $_REQUEST['server'] = $serverid;
+
+                       $server = $misc->getServerInfo($serverid);
+                       $server['username'] = $super_user[$server['desc']];
+                       $server['password'] = $super_pass[$server['desc']];
+
+                       $misc->setServerInfo(null, $server, $serverid);
+
+                       $this->server = $server;
+
+                       $this->data = $misc->getDatabaseAccessor($server['defaultdb']);
+
+                       echo "<html>\n<head>
                                <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">
                                <title>$title</title>
                                </head>
                 * @param $testfile The path to the test file to create
                 * @param $testsuite_file The path to the TestSuite.html file
                 */
-               public function writeTests($testfile, $testsuite_file) {
-                       file_put_contents($testfile, $this->code);
-
-                       $str = "<tr>\n<td><a href=\"{$this->servDesc}/".
-                               basename($testfile) ."\">[{$this->servDesc}] {$this->title}</a></td>\n</tr>\n";
-                       file_put_contents($testsuite_file, $str, FILE_APPEND);
+               public function writeTests() { //$testfile, $testsuite_file) {
+                       //echo $this->code;
+                       return;
                }
                
                /**
                 * @param $value (optional) the expected (or not) value (third column)
                 */
                public function test($action, $selector, $value='') {
-                       $this->code .= "<tr>\n<td>$action</td>\n<td>$selector</td>\n<td>$value</td>\n</tr>\n";
+                       echo "<tr>\n<td>$action</td>\n<td>$selector</td>\n<td>$value</td>\n</tr>\n";
                }
 
                public function addComment($c) {
-                       $this->code .= "<tr>\n<th colspan=\"3\">{$c}</th>\n</tr>\n";
+                       echo "<tr>\n<th colspan=\"3\">{$c}</th>\n</tr>\n";
                }
 
                /**
                 * @param $p The password to use
                 */
                public function login($u, $p) {
-                       global $webUrl, $data;
-                       $this->addComment("Login as {$u}");
-                       $this->test('open', "{$webUrl}/intro.php");
+                       $this->addComment("Login as {$this->server['username']}");
+                       $this->test('open', "{$this->webUrl}/intro.php");
                        $this->select('language', 'English');
-                       $this->test('open', "{$webUrl}/login.php?server={$data->conn->host}&subject=server");
+                       $this->test('open', "{$this->webUrl}/login.php?server={$this->data->conn->host}&subject=server");
                        $this->test('type', "//input[@name='loginUsername']", $u);
                        $this->test('type', "//input[@id='loginPassword']", $p);
                        $this->test('clickAndWait', 'loginSubmit');
                        $this->addComment("Logout");
                        $this->test('clickAndWait', "//div[@class='trail']/descendant::tr/td[1]/a/span[@class='label' and text()='phpPgAdmin']");
                        $this->test('clickAndWait', "link={$lang['strservers']}");
-                       $this->test('clickAndWait', "//tr/td/a[text()='{$this->servDesc}']/../../td/a[text()='{$lang['strlogout']}']");
+                       $this->test('clickAndWait', "//tr/td/a[text()='{$this->server['desc']}']/../../td/a[text()='{$lang['strlogout']}']");
 
                        $this->test('assertText', "//p[@class='message']",
-                               sprintf($lang['strlogoutmsg'], $this->servDesc)
+                               sprintf($lang['strlogoutmsg'], $this->server['desc'])
                        );
                }