From 6402564a97b6ef84fc14d918175837b8a7f15e69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Fern=C3=A1ndez=20de=20la=20Cigo=C3=B1a=20N=C3=B3vo?= =?UTF-8?q?a?= Date: Mon, 12 Sep 2011 11:31:15 +0200 Subject: [PATCH] Added new test file settings_test.sah in a new folder account new file: scripts/functional-tests/account/settings_test.sah FEA: ItEr75S24ResourcesTests --- .../account/settings_test.sah | 114 ++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 scripts/functional-tests/account/settings_test.sah diff --git a/scripts/functional-tests/account/settings_test.sah b/scripts/functional-tests/account/settings_test.sah new file mode 100644 index 000000000..a193617f3 --- /dev/null +++ b/scripts/functional-tests/account/settings_test.sah @@ -0,0 +1,114 @@ +/* + * 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 . + */ + +/* Included tests + * + * Create required elements + * Change settings to have all the charts espanded + * Check that the charts are expanded + * Change settings to have all the charts not expanded + * Check that the charts are not expanded + * Delete Required elements + * +*/ + +_include("../common_functions.sah"); + +function settingsCreateRequiredElements(){ + commonCreateProject($projectName); + commonCreateTask($projectName, $taskName, "100"); +} + +function settingsPressCheckboxes($list, $press){ + _click(_link("Settings")); + if ($press == "yes"){ + for (var $i = 0; $i < $list.length; $i++){ + if (_condition(_checkbox(0, _near(_label($list[$i]))).checked == false)){ + _click(_checkbox(0, _near(_label($list[$i])))); + } + } + } + else{ + for (var $i = 0; $i < $list.length; $i++){ + if (_condition(_checkbox(0, _near(_label($list[$i]))).checked == true)){ + _click(_checkbox(0, _near(_label($list[$i])))); + } + } + } + _click(_cell("Save")); +} + +function settingsCheckChartsExpanded($expanded){ + _click(_link("Projects Planning")); + if ($expanded == "yes"){ + settingCheckExists(); + } + else{ + settingCheckNotExists(); + } + _doubleClick(_div("box standard-task unassigned")); + if ($expanded == "yes"){ + settingCheckExists(); + } + else{ + settingCheckNotExists(); + } + _click(_cell("Resources Load")); + if ($expanded == "yes"){ + settingCheckExists(); + } + else{ + settingCheckNotExists(); + } +} + +function settingsDeleteRequiredElements(){ + commonDeleteProject($projectName); +} + +/* + * Validations + */ + +function settingCheckExists(){ + _assertExists(_div("Graphics")); + _assert(_isVisible(_div("Graphics"))); +} + +function settingCheckNotExists(){ + _assertExists(_div("Graphics")); + _assertNotTrue(_isVisible(_div("Graphics"))); +} + +/* test values */ +var $projectName = "projectForSettings"; +var $taskName = "taskForSettings"; +var $checkBoxes = ["Company view", "Project view", "Resource load view"]; + +/* test actions */ +commonLogin("admin", "admin"); + +settingsCreateRequiredElements(); +settingsPressCheckboxes($checkBoxes, "yes"); +settingsCheckChartsExpanded("yes"); +settingsPressCheckboxes($checkBoxes, "no"); +settingsCheckChartsExpanded("no"); +settingsDeleteRequiredElements(); + +commonLogout();