summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Treat2012-09-15 21:16:41 +0000
committerRobert Treat2012-09-15 21:16:41 +0000
commit6cf0df2174631b8f0351de9fb60c636d1a45ccfe (patch)
tree87ca76e183bc1b5e0d08b37a5d61e4ac7076cfb2
parentb733136a7d8d0233a01db1dad83e8939e780fa62 (diff)
Some minimal testing of the admin sections, with hopes for future better tests
-rwxr-xr-xdatabase.php2
-rw-r--r--tests/selenium/src/05-admin.php59
2 files changed, 60 insertions, 1 deletions
diff --git a/database.php b/database.php
index 03a3b7ca..2e2ac39c 100755
--- a/database.php
+++ b/database.php
@@ -582,7 +582,7 @@
}
echo "<p><input type=\"checkbox\" id=\"paginate\" name=\"paginate\"", (isset($_REQUEST['paginate']) ? ' checked="checked"' : ''), " /><label for=\"paginate\">{$lang['strpaginate']}</label></p>\n";
- echo "<p><input type=\"submit\" value=\"{$lang['strexecute']}\" />\n";
+ echo "<p><input type=\"submit\" name=\"execute\" value=\"{$lang['strexecute']}\" />\n";
echo $misc->form;
echo "<input type=\"reset\" value=\"{$lang['strreset']}\" /></p>\n";
echo "</form>\n";
diff --git a/tests/selenium/src/05-admin.php b/tests/selenium/src/05-admin.php
new file mode 100644
index 00000000..0a18e783
--- /dev/null
+++ b/tests/selenium/src/05-admin.php
@@ -0,0 +1,59 @@
+<?php
+ $test_title = 'Admin tests';
+
+ if (isset($_GET['run'])) {
+ global $lang;
+ require('../config.test.php');
+ require('../testBuilder.class.php');
+ /*
+ * 1/ swing through the admin panel
+ */
+ $t = new TestBuilder($test_title,
+ 'Test the admin interfaces.'
+ );
+
+ $t->login($admin_user, $admin_user_pass);
+
+ /** 1 **/
+ $t->addComment('1. Check Variables');
+ $t->clickAndWait("link={$lang['strdatabases']}");
+ $t->clickAndWait("link={$testdb}");
+ $t->clickAndWait("link={$lang['strvariables']}");
+ $t->assertText("//tr/th[text()='{$lang['strname']}' and @class='data']/../../tr/th[1]",$lang['strname']);
+ $t->assertText("//tr/th[text()='{$lang['strsetting']}' and @class='data']/../../tr/th[2]",$lang['strsetting']);
+
+ /** 2 **/
+ $t->addComment('2. Check Processes');
+ $t->clickAndWait("link={$lang['strprocesses']}");
+ $t->assertText('//h3', $lang['strpreparedxacts']);
+/**
+ $t->assertText('//h3', $lang['strprocesses']);
+ # this check is a bit fragile, since it relies on new line wrapping
+**/
+ $t->assertText('//pre[@class=\'data\']', 'SELECT * FROM pg_catalog.pg_stat_activity*WHERE datname=\'ppatests_db\' ORDER BY usename, procpid');
+
+
+
+ /** 3 **/
+ $t->addComment('3. Check Locks');
+ $t->clickAndWait("link={$lang['strlocks']}");
+ $t->assertText("//tr/th[text()='{$lang['strvirtualtransaction']}' and @class='data']/../../tr/th[3]",$lang['strvirtualtransaction']);
+ /*
+ Would like to assert for text pg_locks and AccessShareLock,
+ but since they can dynamically be written,
+ it doesn't seem Selenium can find them
+ */
+
+
+ /** 4 **/
+ $t->addComment('4. Admin Options');
+ $t->clickAndWait("link={$lang['stradmin']}");
+ $t->clickAndWait("//input[@value='Analyze']");
+ $t->clickAndWait("//input[@value='Analyze']");
+ $t->assertText('//p[@class=\'message\']', $lang['stranalyzegood']);
+
+ /** 5 **/
+ $t->logout();
+ unset($t);
+ }
+?>