Added calendar test file
new file: scripts/functional-tests/administration-management/calendar_test.sah FEA: ItEr75S21AdministrationTests
This commit is contained in:
parent
c2795cd66a
commit
8867869ed7
1 changed files with 163 additions and 0 deletions
|
|
@ -0,0 +1,163 @@
|
|||
/*
|
||||
* 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 Calendar
|
||||
* 2 - Create a Calendar with duplicate type (it should be a failure)
|
||||
* 3 - Create a Calendar with empty type (it should be a failure)
|
||||
* 4 - Create a derived calendar
|
||||
* 5 - Edit the Calendar
|
||||
* 6 - Assign the child calendar
|
||||
* 6.1 - Create a worker with the assigned calendar
|
||||
* 6.2 - Try to delete the assigned calendar (it should be a failure)
|
||||
* 6.3 - Delete the worker
|
||||
* 6 - Try to delete the parent calendar (it should be a failure)
|
||||
* 7 - Delete the child calendar
|
||||
* 8 - Delete the parent Calendar
|
||||
*
|
||||
*/
|
||||
|
||||
_include("../common_functions.sah");
|
||||
|
||||
function calendarCreateDuplicateType($name) {
|
||||
commonCreate("Calendars");
|
||||
commonCalendarForm($name);
|
||||
calendarNotValid($name);
|
||||
_log("Do not allow create a calendar with duplicate name", "custom1");
|
||||
}
|
||||
|
||||
function calendarCreateEmpty() {
|
||||
commonCreate("Calendars");
|
||||
commonCalendarForm("");
|
||||
/* calendarNotEmptyNameValidation(); */
|
||||
_log("Do not allow create a calendar without name", "custom1");
|
||||
}
|
||||
|
||||
function calendarCreateChild($parentName, $sonName, $cell) {
|
||||
calendarGoToCreateChildForm($parentName, $cell);
|
||||
commonCalendarForm($sonName);
|
||||
commonSaveValidation("Base calendar", $sonName);
|
||||
_log("Create a son calendar", "custom1");
|
||||
}
|
||||
|
||||
function calendarEdit($oldName, $newName, $cell) {
|
||||
commonEdit($oldName, $cell);
|
||||
commonCalendarForm($newName);
|
||||
commonSaveValidation("Base calendar", $newName);
|
||||
_log("Edit the parent calendar", "custom1");
|
||||
}
|
||||
|
||||
function calendarGoToCreateChildForm($name, $cell) {
|
||||
_click(_link("Calendars"));
|
||||
_click(_image("ico_derived1.png", _in(_cell($cell, _near(_cell($name))))));
|
||||
}
|
||||
|
||||
function calendarTryDeleteParentWithSon($name, $cell) {
|
||||
_click(_link("Calendars"));
|
||||
_click(_image("ico_borrar1.png", _in(_cell($cell, _near(_cell($name))))));
|
||||
calendarNotAllowDeleteWithChildValidation();
|
||||
_log("Do not allow delete the parent calendar", "custom1");
|
||||
}
|
||||
|
||||
function calendarCheckCode($name){
|
||||
commonConfigurationChangeCheckboxMainPreferences("Calendar");
|
||||
calendarCreateWithoutCode($name);
|
||||
commonConfigurationChangeCheckboxMainPreferences("Calendar");
|
||||
_log("Check code label", "custom1");
|
||||
}
|
||||
|
||||
function calendarCreateWithoutCode($name){
|
||||
commonCreate("Calendars");
|
||||
calendarForm($name);
|
||||
commonEmptyCodeValidation();
|
||||
}
|
||||
|
||||
function calendarAssignWorker($name, $id, $calendar) {
|
||||
workerCreate($name, $id, $calendar);
|
||||
commonCalendarTryDeleteAssignedCalendar($calendar, 3);
|
||||
commonWorkerDelete($name);
|
||||
}
|
||||
|
||||
/*
|
||||
* Worker functions
|
||||
* */
|
||||
|
||||
function workerCreate($name, $id, $calendar) {
|
||||
commonCreate("Workers");
|
||||
workerForm($name, $id, $calendar);
|
||||
_assertExists(_span("Worker saved"));
|
||||
_assert(_isVisible(_span("Worker saved")));
|
||||
_log("Create a new worker", "custom1");
|
||||
}
|
||||
|
||||
function workerForm($name, $id, $calendar) {
|
||||
_setValue(_textbox(0, _near(_span("First name"))), $name);
|
||||
_setValue(_textbox(0, _near(_span("Last name"))), $name);
|
||||
_setValue(_textbox(0, _near(_span("ID"))), $id);
|
||||
_click(_span("Calendar"));
|
||||
_click(_italic(0, _near(_span("Select parent calendar"))));
|
||||
_click(_cell($calendar));
|
||||
_click(_cell("Save"));
|
||||
}
|
||||
|
||||
/*
|
||||
* Validations
|
||||
*/
|
||||
|
||||
/* Text will be changed pending of a bug
|
||||
|
||||
function calendarNotEmptyNameValidation(){
|
||||
_assertExists(_div("name: no debe ser nulo o vacío"));
|
||||
_assert(_isVisible(_div("name: no debe ser nulo o vacío")));
|
||||
}
|
||||
*/
|
||||
|
||||
function calendarNotValid($calendar){
|
||||
_assertExists(_div("name: "+$calendar+" already exists"));
|
||||
_assert(_isVisible(_div("name: "+$calendar+" already exists")));
|
||||
}
|
||||
|
||||
function calendarNotAllowDeleteWithChildValidation(){
|
||||
_assertExists(_span("Calendar cannot be removed because it still has children. Some other calendar is derived from this one."));
|
||||
_assert(_isVisible(_span("Calendar cannot be removed because it still has children. Some other calendar is derived from this one.")));
|
||||
}
|
||||
|
||||
/* test values */
|
||||
var $calendarName = "parent";
|
||||
var $calendarSonName = "Son calendar";
|
||||
var $calendarNewName = "newest";
|
||||
var $workerId = "36123456P";
|
||||
var $workerName = "worker1";
|
||||
|
||||
/* test actions */
|
||||
commonLogin("admin", "admin");
|
||||
|
||||
commonCalendarCreate($calendarName);
|
||||
calendarCreateDuplicateType($calendarName);
|
||||
calendarCreateEmpty();
|
||||
calendarCreateChild($calendarName, $calendarSonName, 3);
|
||||
calendarEdit($calendarName, $calendarNewName, 3);
|
||||
calendarAssignWorker($workerName, $workerId, $calendarSonName)
|
||||
calendarTryDeleteParentWithSon($calendarNewName, 3);
|
||||
/* calendarCheckCode($calendarName); PENDING OF A BUG */
|
||||
commonCalendarDelete($calendarSonName);
|
||||
commonCalendarDelete($calendarNewName);
|
||||
|
||||
commonLogout();
|
||||
Loading…
Add table
Reference in a new issue