summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume (ioguix) de Rorthais2008-12-14 22:15:20 +0000
committerGuillaume (ioguix) de Rorthais2008-12-14 22:15:20 +0000
commit82ed178d04b6dcfe9724b00fd4977f46f1e6e917 (patch)
treeeaeb1fcd466fdc5b82c7628f0649f4764ef3a6e0
parent99b3160ab31cb0444ded2186506f6563d87eea54 (diff)
Update/Add selenium tests
- Add tests for constraints, columns, views and index - Add method addComment in testBuilder class to insert comment in the tests page - Add comments to all tests Sequence tests still fail for 8.4. We need to review all these tests to add some forgottent testcases and asserts
-rw-r--r--tests/selenium/README8
-rw-r--r--tests/selenium/selenium-lib/core/TestRunner.hta3
-rw-r--r--tests/selenium/selenium-lib/core/TestRunner.html3
-rw-r--r--tests/selenium/selenium-lib/core/scripts/selenium-testrunner.js6
-rw-r--r--tests/selenium/selenium-lib/core/selenium.css5
-rw-r--r--tests/selenium/src/01-roles.php6
-rw-r--r--tests/selenium/src/04-database.php3
-rw-r--r--tests/selenium/src/06-schema.php2
-rw-r--r--tests/selenium/src/08-domaine.php5
-rw-r--r--tests/selenium/src/10-table.php9
-rw-r--r--tests/selenium/src/15-sequence.php4
-rw-r--r--tests/selenium/src/20-constraint.php112
-rw-r--r--tests/selenium/src/25-column.php94
-rw-r--r--tests/selenium/src/30-view.php103
-rw-r--r--tests/selenium/src/35-index.php42
-rw-r--r--tests/selenium/src/99-cleantests.php9
-rw-r--r--tests/selenium/testBuilder.class.php6
17 files changed, 417 insertions, 3 deletions
diff --git a/tests/selenium/README b/tests/selenium/README
index 9f797ce8..3125e38c 100644
--- a/tests/selenium/README
+++ b/tests/selenium/README
@@ -45,9 +45,11 @@ and the static folder where the HTML tests files are created
);
- 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.
- 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...
+ - In particular, 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.
diff --git a/tests/selenium/selenium-lib/core/TestRunner.hta b/tests/selenium/selenium-lib/core/TestRunner.hta
index eb2e6261..f66958f8 100644
--- a/tests/selenium/selenium-lib/core/TestRunner.hta
+++ b/tests/selenium/selenium-lib/core/TestRunner.hta
@@ -89,6 +89,9 @@ to work-around a bug in IE on Win2K whereby the HTA application doesn't function
<button type="button" id="runSuite" onClick="htmlTestRunner.startTestSuite();"
title="Run All tests" accesskey="a">
</button>
+ <button type="button" id="runRemainTests" onClick="htmlTestRunner.runRemainTests();"
+ title="Run the tests from the selected" accesskey="f">
+ </button>
<button type="button" id="runSeleniumTest" onClick="htmlTestRunner.runSingleTest();"
title="Run the Selected test" accesskey="r">
</button>
diff --git a/tests/selenium/selenium-lib/core/TestRunner.html b/tests/selenium/selenium-lib/core/TestRunner.html
index eb2e6261..87a52245 100644
--- a/tests/selenium/selenium-lib/core/TestRunner.html
+++ b/tests/selenium/selenium-lib/core/TestRunner.html
@@ -89,6 +89,9 @@ to work-around a bug in IE on Win2K whereby the HTA application doesn't function
<button type="button" id="runSuite" onClick="htmlTestRunner.startTestSuite();"
title="Run All tests" accesskey="a">
</button>
+ <button type="button" id="runRemainTests" onClick="htmlTestRunner.runRemainTests();"
+ title="Run the tests from the selected" accesskey="f">
+ </button>
<button type="button" id="runSeleniumTest" onClick="htmlTestRunner.runSingleTest();"
title="Run the Selected test" accesskey="r">
</button>
diff --git a/tests/selenium/selenium-lib/core/scripts/selenium-testrunner.js b/tests/selenium/selenium-lib/core/scripts/selenium-testrunner.js
index c0aa069f..89cb80e9 100644
--- a/tests/selenium/selenium-lib/core/scripts/selenium-testrunner.js
+++ b/tests/selenium/selenium-lib/core/scripts/selenium-testrunner.js
@@ -144,6 +144,12 @@ objectExtend(HtmlTestRunner.prototype, {
this.currentTest.start();
},
+ runRemainTests:function() {
+ this.runAllTests = true;
+ this.metrics.resetMetrics();
+ this.startTest();
+ },
+
runSingleTest:function() {
this.runAllTests = false;
this.metrics.resetMetrics();
diff --git a/tests/selenium/selenium-lib/core/selenium.css b/tests/selenium/selenium-lib/core/selenium.css
index a717934a..04a194ac 100644
--- a/tests/selenium/selenium-lib/core/selenium.css
+++ b/tests/selenium/selenium-lib/core/selenium.css
@@ -109,6 +109,11 @@ body, html {
background-image: url("icons/selected.png");
}
+#controlPanel #runRemainTests {
+ width: 32px;
+ background-image: url("icons/remains.png");
+}
+
.cssPauseTest {
background-image: url("icons/pause.png");
}
diff --git a/tests/selenium/src/01-roles.php b/tests/selenium/src/01-roles.php
index b319b180..d39062fb 100644
--- a/tests/selenium/src/01-roles.php
+++ b/tests/selenium/src/01-roles.php
@@ -16,9 +16,11 @@
);
/* 1 */
+ $t->addComment('1. login as superuser');
$t->login($super_user[$server['desc']], $super_pass[$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']}");
@@ -39,6 +41,7 @@
$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');
@@ -48,11 +51,13 @@
$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);
/* 5 */
+ $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']}");
@@ -77,6 +82,7 @@
$t->assertText("//p[@class='message']", $lang['strusercreated']);
/* 6 */
+ $t->addComment('6. alter user back to the normal value');
if ($data->hasRoles()) {
$t->clickAndWait("link={$lang['strroles']}");
$t->clickAndWait("link={$user}toalter");
diff --git a/tests/selenium/src/04-database.php b/tests/selenium/src/04-database.php
index fd740972..fc64b96f 100644
--- a/tests/selenium/src/04-database.php
+++ b/tests/selenium/src/04-database.php
@@ -15,6 +15,7 @@
$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']}");
@@ -32,6 +33,7 @@
$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
@@ -44,6 +46,7 @@
}
/** 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
diff --git a/tests/selenium/src/06-schema.php b/tests/selenium/src/06-schema.php
index 8d4c6b67..c92fc848 100644
--- a/tests/selenium/src/06-schema.php
+++ b/tests/selenium/src/06-schema.php
@@ -14,6 +14,7 @@
$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']}");
@@ -33,6 +34,7 @@
$t->assertText('//p[@class=\'message\']', $lang['strschemacreated']);
/** 2 **/
+ $t->addComment('2. alter schema\'s name, owner and comment');
if ($data->hasAlterSchema()) {
$t->clickAndWait("link={$lang['strschemas']}");
$t->clickAndWait("//tr/td/a[text()='test_schema_toalter']/../../td/a[text()='{$lang['stralter']}']");
diff --git a/tests/selenium/src/08-domaine.php b/tests/selenium/src/08-domaine.php
index e40c49a9..9f197abb 100644
--- a/tests/selenium/src/08-domaine.php
+++ b/tests/selenium/src/08-domaine.php
@@ -17,6 +17,7 @@
$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']}");
@@ -56,6 +57,7 @@
}
/** 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']");
$t->clickAndWait("link={$lang['strdomains']}");
@@ -69,6 +71,7 @@
}
/** 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']}");
@@ -81,6 +84,7 @@
}
/** 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']}");
@@ -97,6 +101,7 @@
}
/** 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']}");
diff --git a/tests/selenium/src/10-table.php b/tests/selenium/src/10-table.php
index d6102ef2..7396bb88 100644
--- a/tests/selenium/src/10-table.php
+++ b/tests/selenium/src/10-table.php
@@ -17,6 +17,7 @@
$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']}");
@@ -44,6 +45,7 @@
$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");
@@ -67,6 +69,7 @@
$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}']");
$t->clickAndWait("link={$lang['strschemas']}");
@@ -102,7 +105,9 @@
}
/** 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");
@@ -116,6 +121,7 @@
$t->assertText("//div[@class='trail']/descendant::a[@title='{$lang['strtable']}']/span[@class='label']", 'test_renamed');
/*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");
@@ -130,6 +136,7 @@
/*table owner*/
if ($data->hasAlterTableOwner()) {
+ $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");
@@ -145,6 +152,7 @@
/*alter schema*/
if ($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");
@@ -157,6 +165,7 @@
}
/** 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())
diff --git a/tests/selenium/src/15-sequence.php b/tests/selenium/src/15-sequence.php
index af0831fb..918bcc30 100644
--- a/tests/selenium/src/15-sequence.php
+++ b/tests/selenium/src/15-sequence.php
@@ -15,6 +15,7 @@
$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']}");
@@ -40,6 +41,7 @@
$t->assertText("//tr/td[text()='testcase_seq']/../td[8]", $lang['stryes']);
/** 2 **/
+ $t->addComment('2. increment, reset sequence and set value');
$t->clickAndWait("link={$lang['strsetval']}");
$t->type('nextvalue', '2');
$t->clickAndWait('setval');
@@ -53,6 +55,7 @@
$t->assertText("//tr/td[text()='testcase_seq']/../td[2]", '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');
@@ -94,6 +97,7 @@
$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');
diff --git a/tests/selenium/src/20-constraint.php b/tests/selenium/src/20-constraint.php
new file mode 100644
index 00000000..f72225c6
--- /dev/null
+++ b/tests/selenium/src/20-constraint.php
@@ -0,0 +1,112 @@
+<?php
+ global $testsuite_file, $test_static_dir;
+
+ /*
+ * 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...'
+ );
+
+ $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.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']);
+
+ /* 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']);
+
+ /* 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']);
+
+ /* 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']);
+
+ $t->logout();
+ $t->writeTests("{$test_static_dir}/{$server['desc']}/constraint.html", $testsuite_file);
+ unset($t);
+?> \ No newline at end of file
diff --git a/tests/selenium/src/25-column.php b/tests/selenium/src/25-column.php
new file mode 100644
index 00000000..462b3c75
--- /dev/null
+++ b/tests/selenium/src/25-column.php
@@ -0,0 +1,94 @@
+<?php
+global $testsuite_file, $test_static_dir;
+
+/**
+ * 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'
+);
+
+$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[9]", '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/td[1 and @class='data1']/", 'altered_col');
+$t->assertText("//tr/td[text()='altered_col']/../td[2]", $current_type);
+$t->assertText("//tr/td[text()='altered_col']/../td[3]", 'NOT NULL');
+$t->assertText("//tr/td[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');
+
+/** 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);
+?> \ No newline at end of file
diff --git a/tests/selenium/src/30-view.php b/tests/selenium/src/30-view.php
new file mode 100644
index 00000000..b5ec22f4
--- /dev/null
+++ b/tests/selenium/src/30-view.php
@@ -0,0 +1,103 @@
+<?php
+global $testsuite_file, $test_static_dir;
+
+/**
+ * 1/ Create a view
+ * 2/ Alter a view
+ * 3/ Drop a view
+ **/
+$t = new TestBuilder($server['desc'],
+ 'View tests',
+ 'Add/Alter/Drop a view'
+);
+
+$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');
+
+/** 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);
+
+/** 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);
+?> \ No newline at end of file
diff --git a/tests/selenium/src/35-index.php b/tests/selenium/src/35-index.php
new file mode 100644
index 00000000..5b9c19bf
--- /dev/null
+++ b/tests/selenium/src/35-index.php
@@ -0,0 +1,42 @@
+<?php
+global $testsuite_file, $test_static_dir;
+
+/**
+ * 1/ Create the unique index
+ * 2/ Drop the index
+ **/
+$t = new TestBuilder($server['desc'],
+ 'Index tests',
+ 'Create/Drop an unique Index'
+);
+
+$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']);
+
+/** 2 **/
+$t->addComment('2. 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);
+?> \ No newline at end of file
diff --git a/tests/selenium/src/99-cleantests.php b/tests/selenium/src/99-cleantests.php
index ecb47d16..fa5f3b33 100644
--- a/tests/selenium/src/99-cleantests.php
+++ b/tests/selenium/src/99-cleantests.php
@@ -18,6 +18,7 @@
);
/** 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']}']");
@@ -25,6 +26,7 @@
$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_pass);
if ($data->hasRoles()) {
@@ -40,6 +42,7 @@
}
/** 3 **/
+ $t->addComment('3. try to drop himself -> fail');
if ($data->hasRoles()) {
$t->clickAndWait("link={$lang['strroles']}");
$t->clickAndWait("link={$admin_user}");
@@ -55,6 +58,7 @@
}
/** 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']}");
@@ -65,6 +69,7 @@
$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");
@@ -81,6 +86,7 @@
$t->clickAndWait("link=year");
/** 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}");
@@ -92,6 +98,7 @@
$t->assertText('//p[@class=\'message\']', $lang['strtabledropped']);
/** 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}");
@@ -104,6 +111,7 @@
$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']}']");
@@ -111,6 +119,7 @@
$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[$server['desc']], $super_pass[$server['desc']]);
diff --git a/tests/selenium/testBuilder.class.php b/tests/selenium/testBuilder.class.php
index 65a9423f..2cebffa1 100644
--- a/tests/selenium/testBuilder.class.php
+++ b/tests/selenium/testBuilder.class.php
@@ -62,6 +62,10 @@
$this->code .= "<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";
+ }
+
/**
* Add steps to login on PPA using the given credentials
* @param $u The username to use
@@ -69,6 +73,7 @@
*/
public function login($u, $p) {
global $webUrl, $data;
+ $this->addComment("Login as {$u}");
$this->test('open', "{$webUrl}/login.php?server={$data->conn->host}&subject=server");
$this->test('type', "//input[@name='loginUsername']", $u);
$this->test('type', "//input[@id='loginPassword']", $p);
@@ -82,6 +87,7 @@
public function logout() {
global $lang;
+ $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']}']");