summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJehan-Guillaume (ioguix) de Rorthais2011-12-29 23:36:12 +0000
committerJehan-Guillaume (ioguix) de Rorthais2011-12-29 23:36:12 +0000
commit3c0c7c0da2e0c7fb6dd73106c396646f7dd1d3bc (patch)
treeea02b5597199a481b92dcb8f997db912e15582f8
parent8e88f393f406de460ba0706567c254c8d3a064bb (diff)
Make selenium tests full dynamics, no more build_tests.php required.
-rw-r--r--.gitignore2
-rwxr-xr-xbuild_tests.php107
-rwxr-xr-xintro.php2
-rw-r--r--libraries/errorhandler.inc.php3
-rw-r--r--tests/selenium/README49
-rwxr-xr-xtests/selenium/TestSuite.php52
-rw-r--r--tests/selenium/src/01-roles.php261
-rw-r--r--tests/selenium/src/04-database.php129
-rw-r--r--tests/selenium/src/06-schema.php93
-rw-r--r--tests/selenium/src/08-domaine.php218
-rw-r--r--tests/selenium/src/10-table.php333
-rw-r--r--tests/selenium/src/15-sequence.php219
-rw-r--r--tests/selenium/src/20-constraint.php199
-rw-r--r--tests/selenium/src/25-column.php173
-rw-r--r--tests/selenium/src/30-view.php193
-rw-r--r--tests/selenium/src/35-index.php85
-rw-r--r--tests/selenium/src/99-cleantests.php257
-rw-r--r--tests/selenium/src/skeleton.php-dist48
-rw-r--r--tests/selenium/testBuilder.class.php77
19 files changed, 1261 insertions, 1239 deletions
diff --git a/.gitignore b/.gitignore
index d753bfab..afa3529a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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
index d4de2960..00000000
--- a/build_tests.php
+++ /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 !!!! */
-?>
diff --git a/intro.php b/intro.php
index c2b2969b..7f5c0397 100755
--- 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
diff --git a/libraries/errorhandler.inc.php b/libraries/errorhandler.inc.php
index fd9420be..11e93b2b 100644
--- a/libraries/errorhandler.inc.php
+++ b/libraries/errorhandler.inc.php
@@ -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
diff --git a/tests/selenium/README b/tests/selenium/README
index 3125e38c..a01d5d46 100644
--- a/tests/selenium/README
+++ b/tests/selenium/README
@@ -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
index 00000000..0943503b
--- /dev/null
+++ b/tests/selenium/TestSuite.php
@@ -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>";
+?>
diff --git a/tests/selenium/src/01-roles.php b/tests/selenium/src/01-roles.php
index cb1bb10f..e15f1897 100644
--- a/tests/selenium/src/01-roles.php
+++ b/tests/selenium/src/01-roles.php
@@ -1,144 +1,145 @@
<?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);
+ }
?>
diff --git a/tests/selenium/src/04-database.php b/tests/selenium/src/04-database.php
index ad156bbc..0b1fe8f3 100644
--- a/tests/selenium/src/04-database.php
+++ b/tests/selenium/src/04-database.php
@@ -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);
+ }
?>
diff --git a/tests/selenium/src/06-schema.php b/tests/selenium/src/06-schema.php
index c92fc848..de161625 100644
--- a/tests/selenium/src/06-schema.php
+++ b/tests/selenium/src/06-schema.php
@@ -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);
?>
diff --git a/tests/selenium/src/08-domaine.php b/tests/selenium/src/08-domaine.php
index 9f197abb..5d9a65fe 100644
--- a/tests/selenium/src/08-domaine.php
+++ b/tests/selenium/src/08-domaine.php
@@ -1,118 +1,120 @@
<?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);
?>
diff --git a/tests/selenium/src/10-table.php b/tests/selenium/src/10-table.php
index 37675bdb..dc680bfc 100644
--- a/tests/selenium/src/10-table.php
+++ b/tests/selenium/src/10-table.php
@@ -1,195 +1,198 @@
<?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);
+ }
?>
diff --git a/tests/selenium/src/15-sequence.php b/tests/selenium/src/15-sequence.php
index 731bd21f..63cf70b2 100644
--- a/tests/selenium/src/15-sequence.php
+++ b/tests/selenium/src/15-sequence.php
@@ -1,119 +1,122 @@
<?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);
+ }
?>
diff --git a/tests/selenium/src/20-constraint.php b/tests/selenium/src/20-constraint.php
index f72225c6..8fded5b1 100644
--- a/tests/selenium/src/20-constraint.php
+++ b/tests/selenium/src/20-constraint.php
@@ -1,112 +1,115 @@
<?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
diff --git a/tests/selenium/src/25-column.php b/tests/selenium/src/25-column.php
index 2896797b..9db6f1b6 100644
--- a/tests/selenium/src/25-column.php
+++ b/tests/selenium/src/25-column.php
@@ -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);
+ }
?>
diff --git a/tests/selenium/src/30-view.php b/tests/selenium/src/30-view.php
index b5ec22f4..d54706c2 100644
--- a/tests/selenium/src/30-view.php
+++ b/tests/selenium/src/30-view.php
@@ -1,103 +1,106 @@
<?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
diff --git a/tests/selenium/src/35-index.php b/tests/selenium/src/35-index.php
index d17568ca..bc2e6eda 100644
--- a/tests/selenium/src/35-index.php
+++ b/tests/selenium/src/35-index.php
@@ -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);
+ }
?>
diff --git a/tests/selenium/src/99-cleantests.php b/tests/selenium/src/99-cleantests.php
index aaa99b71..a23b5a42 100644
--- a/tests/selenium/src/99-cleantests.php
+++ b/tests/selenium/src/99-cleantests.php
@@ -1,142 +1,145 @@
<?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
index 00000000..7e3b43fa
--- /dev/null
+++ b/tests/selenium/src/skeleton.php-dist
@@ -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);
+ }
+?>
diff --git a/tests/selenium/testBuilder.class.php b/tests/selenium/testBuilder.class.php
index 95402505..b4c22f21 100644
--- a/tests/selenium/testBuilder.class.php
+++ b/tests/selenium/testBuilder.class.php
@@ -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>
@@ -44,12 +59,9 @@
* @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;
}
/**
@@ -59,11 +71,11 @@
* @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";
}
/**
@@ -72,11 +84,10 @@
* @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');
@@ -92,10 +103,10 @@
$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'])
);
}