Added tests for companies
new file: scripts/functional-tests/resources/companies_test.sah FEA: ItEr75S24ResourcesTests
This commit is contained in:
parent
0f689eba6a
commit
bd7f6453ea
1 changed files with 93 additions and 0 deletions
93
scripts/functional-tests/resources/companies_test.sah
Normal file
93
scripts/functional-tests/resources/companies_test.sah
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* 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 - Create a new Company
|
||||
* 2 - Create a Company with duplicate type (it should be a failure)
|
||||
* 3 - Create a Company with empty type (it should be a failure)
|
||||
* 4 - Create a Company with duplicate name (it should be a failure)
|
||||
* 5 - Edit a Company
|
||||
* 6 - Delete Company
|
||||
*
|
||||
*/
|
||||
|
||||
_include("../common_functions.sah");
|
||||
|
||||
function companyCreateDuplicateType($name, $ID) {
|
||||
commonCreate("Companies");
|
||||
commonCompanyForm($name, $ID);
|
||||
companyDuplicatedName();
|
||||
companyDuplicatedId();
|
||||
}
|
||||
|
||||
function companyCreateEmpty($name, $ID) {
|
||||
commonCreate("Companies");
|
||||
_click(_cell("Save"));
|
||||
companyEmptyField();
|
||||
_setValue(_textbox(0, _near(_span("Company name:"))), $name);
|
||||
_click(_cell("Save"));
|
||||
companyEmptyField();
|
||||
_setValue(_textbox(0, _near(_span("Company ID:"))), $ID);
|
||||
}
|
||||
|
||||
function companyEdit($oldName, $newName, $cell) {
|
||||
commonEdit($oldName, $cell);
|
||||
commonCompanyForm($newName);
|
||||
commonSaveValidation("Company", $newName);
|
||||
}
|
||||
|
||||
/*
|
||||
* Validations
|
||||
*/
|
||||
|
||||
function companyDuplicatedName(){
|
||||
_assertExists(_span("checkConstraintUniqueName: company name has to be unique. It is already used"));
|
||||
_assert(_isVisible(_span("checkConstraintUniqueName: company name has to be unique. It is already used")));
|
||||
}
|
||||
|
||||
function companyDuplicatedId(){
|
||||
_assertExists(_span("checkConstraintUniqueNif: Company ID already used. It has to be be unique"));
|
||||
_assert(_isVisible(_span("checkConstraintUniqueNif: Company ID already used. It has to be be unique")));
|
||||
}
|
||||
|
||||
function companyEmptyField(){
|
||||
_assertExists(_div("cannot be null or empty"));
|
||||
_assert(_isVisible(_div("cannot be null or empty")));
|
||||
}
|
||||
|
||||
/* test values */
|
||||
var $companyName = "subcompany";
|
||||
var $companyId = "SUbCOMPANY_CODE";
|
||||
var $companyNewName = "newest";
|
||||
|
||||
|
||||
/* test actions */
|
||||
commonLogin("admin", "admin");
|
||||
|
||||
commonCompanyCreate($companyName, $companyId);
|
||||
companyCreateDuplicateType($companyName, $companyId);
|
||||
companyCreateEmpty("", $companyId);
|
||||
|
||||
companyEdit($companyName, $companyNewName, 5);
|
||||
|
||||
commonDelete("Companies", $companyNewName, 5);
|
||||
commonDeleteValidation("Company", $companyNewName);
|
||||
|
||||
commonLogout();
|
||||
Loading…
Add table
Reference in a new issue