Added new file password_test.sah
new file: scripts/functional-tests/account/password_test.sah FEA: ItEr75S24ResourcesTests
This commit is contained in:
parent
6402564a97
commit
f125150c38
1 changed files with 117 additions and 0 deletions
117
scripts/functional-tests/account/password_test.sah
Normal file
117
scripts/functional-tests/account/password_test.sah
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
* This file is part of NavalPlan
|
||||
*
|
||||
* Copyright (C) 2011 Igalia, S.L.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* Included tests
|
||||
*
|
||||
* 1 - Check password in a common user
|
||||
* 1.1 - Create a User
|
||||
* 1.2 - Check The user
|
||||
* 1.3 - Change his password
|
||||
* 1.4 - Check the password
|
||||
* 2 - Change the Admin password in both places
|
||||
* 2.1 - Change password in Users
|
||||
* 2.2 - Change password in My Account password
|
||||
* 2.3 - Check that the last past work is working
|
||||
* 3 - Delete the user
|
||||
* 4 - Put default values for the admin user
|
||||
*
|
||||
*/
|
||||
|
||||
_include("../common_functions.sah");
|
||||
|
||||
function passwordCheck($name, $password){
|
||||
commonLogout();
|
||||
commonLogin($name, $password);
|
||||
}
|
||||
|
||||
function passwordChange($oldPassword, $newPassword){
|
||||
_click(_link("Change Password"));
|
||||
passwordForm($oldPassword, $newPassword);
|
||||
}
|
||||
|
||||
function passwordForm($oldPassword, $newPassword){
|
||||
_setValue(_password(0, _near(_span("Current password:"))), $oldPassword);
|
||||
_setValue(_password(0, _near(_span("New password:"))), $newPassword);
|
||||
_setValue(_password(0, _near(_span("Password confirmation:"))), $newPassword);
|
||||
_click(_cell("Save"));
|
||||
}
|
||||
|
||||
function passwordEditBothPasswordsSameSesion($user, $oldPassword, $password2, $newPassword3){
|
||||
commonUserEdit($user, $password2);
|
||||
passwordChange($password2, $newPassword3);
|
||||
passwordCheck($user, $newPassword3);
|
||||
}
|
||||
|
||||
function passwordStandarUserValidation(){
|
||||
_assertExists(_cell("user: UserForAccountPass"));
|
||||
_assert(_isVisible(_cell("user: UserForAccountPass")));
|
||||
}
|
||||
|
||||
/*
|
||||
* User functions
|
||||
*/
|
||||
|
||||
function commonUserCreate($name, $password) {
|
||||
commonCreate("Accounts");
|
||||
commonUserForm($name, $password);
|
||||
commonSaveValidation("User", $name);
|
||||
_log("Create a new Account", "custom1");
|
||||
}
|
||||
|
||||
function commonUserForm($name, $password) {
|
||||
_setValue(_textbox(0, _near(_span("Login name:"))), $name);
|
||||
_setValue(_password(0, _near(_span("Password:"))), $password);
|
||||
_setValue(_password(0, _near(_span("Password confirmation:"))), $password);
|
||||
_click(_cell("Save"));
|
||||
}
|
||||
|
||||
function commonUserEdit($name, $password){
|
||||
_click(_link("Accounts"));
|
||||
commonEdit($name, 4);
|
||||
_setValue(_password(0, _near(_span("Password:"))), $password);
|
||||
_setValue(_password(0, _near(_span("Password confirmation:"))), $password);
|
||||
_click(_cell("Save"));
|
||||
commonSaveValidation("User", $name);
|
||||
}
|
||||
|
||||
function commonUserDelete($user){
|
||||
commonDelete("Accounts", $user, 4);
|
||||
commonDeleteValidation("User", $user);
|
||||
_log("Delete the user", "custom1");
|
||||
}
|
||||
|
||||
/* test values */
|
||||
var $userName = "UserForAccountPass";
|
||||
var $userPassword = "1234";
|
||||
var $newPassword = "4321";
|
||||
var $newPassword2 = "2222";
|
||||
/* test actions */
|
||||
commonLogin("admin", "admin");
|
||||
|
||||
commonUserCreate($userName, $userPassword);
|
||||
passwordCheck($userName, $userPassword);
|
||||
passwordChange($userPassword, $newPassword);
|
||||
passwordCheck($userName, $newPassword);
|
||||
passwordStandarUserValidation();
|
||||
passwordCheck("admin", "admin");
|
||||
passwordEditBothPasswordsSameSesion("admin", "admin", $newPassword, $newPassword2);
|
||||
passwordChange($newPassword2, "admin");
|
||||
commonUserDelete($userName);
|
||||
|
||||
commonLogout();
|
||||
Loading…
Add table
Reference in a new issue