Permalink
Browse files

Fix selenium login failed for user in 99-cleantests

  • Loading branch information...
1 parent b62ff9f commit 529655bda9cc83af0ed7e37ced38bbddc4d81082 @ioguix ioguix committed Dec 19, 2008
Showing with 59 additions and 22 deletions.
  1. +58 −21 tests/selenium/src/01-roles.php
  2. +1 −1 tests/selenium/src/99-cleantests.php
@@ -57,49 +57,86 @@
/* 5 */
+ $current_username="{$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->click('formCanLogin');
- $t->click('formCreateRole'); // will be revert
- $t->click('formInherits'); // will be revert
+ $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");
- else $t->type('formUsername', $user);
+ else {
+ $t->type('formUsername', $user);
+ $current_username=$user;
+ }
}
- $t->click('formSuper'); // will be revert
- $t->click('formCreateDB'); // will be revert
+ $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())
+ if ($data->hasRoles()) {
+ $t->assertText("//tr/td/a[text()='{$current_username}']", $current_username);
+ $t->assertText("//tr/td/a[text()='{$current_username}']/../../td[2]", $lang['stryes']);//super user ?
+ $t->assertText("//tr/td/a[text()='{$current_username}']/../../td[3]", $lang['stryes']);//create db ?
$t->assertText("//p[@class='message']", $lang['strrolecreated']);
- else
+ $t->assertText("//tr/td/a[text()='{$current_username}']/../../td[4]", $lang['stryes']); //create role
+ $t->assertText("//tr/td/a[text()='{$current_username}']/../../td[5]", $lang['stryes']); //inherit
+ $t->assertText("//tr/td/a[text()='{$current_username}']/../../td[6]", $lang['stryes']); //can login
+ }
+ else {
+ $t->assertText("//tr/td[text()='{$current_username}']", $current_username);
+ $t->assertText("//tr/td[text()='{$current_username}']/../td[2]", $lang['stryes']);//super user ?
+ $t->assertText("//tr/td[text()='{$current_username}']/../td[3]", $lang['stryes']);//create db ?
$t->assertText("//p[@class='message']", $lang['strusercreated']);
-
- /* 6 */
- $t->addComment('6. alter user back to the normal value');
+ }
+
+ /* 6.1 */
+ $t->addComment('6. alter user back to the normal values');
if ($data->hasRoles()) {
$t->clickAndWait("link={$lang['strroles']}");
- $t->clickAndWait("link={$user}toalter");
+ $t->clickAndWait("link={$current_username}");
$t->clickAndWait("link={$lang['stralter']}");
$t->type('formNewRoleName', $user);
- $t->click('formCreateRole'); // revert
- $t->click('formInherits'); // revert
+ $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);
- } else
- $t->clickAndWait("//tr/td[text()='{$user}']/../td/a[text()='{$lang['stralter']}']");
+ $t->clickAndWait("//tr/td[text()='{$current_username}']/../td/a[text()='{$lang['stralter']}']");
+ if ($data->hasUserRename()) $t->type('newname', $user);
+ }
+ $t->uncheck('formSuper'); // revert
+ $t->uncheck('formCreateDB'); // revert
+
+ $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("//tr/td[text()='{$user}']", $user);
+ $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']);
+ }
+
+ /* 6.2 */
+
+ if ($data->hasRoles()) {
+ $t->clickAndWait("//tr/td/a[text()='{$user}']");
+ $t->clickAndWait("link={$lang['stralter']}");
}
- $t->click('formSuper'); // revert
- $t->click('formCreateDB'); // revert
+ else $t->clickAndWait("//tr/td[text()='{$user}']/../td/a[text()='{$lang['stralter']}']");
$t->type('formPassword', $user_pass);
$t->type('formConfirm', $user_pass);
$t->clickAndWait('alter');
@@ -28,7 +28,7 @@
/** 2 **/
$t->addComment('2. logout / login as admin_user and drop user role/user');
$t->logout();
- $t->login($admin_user, $admin_pass);
+ $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']}']");

0 comments on commit 529655b

Please sign in to comment.