// {{{ICINGA_LICENSE_HEADER}}} /** * This file is part of Icinga 2 Web. * * Icinga 2 Web - Head for multiple monitoring backends. * Copyright (C) 2013 Icinga Development Team * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * @copyright 2013 Icinga Development Team * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 * @author Icinga Development Team */ // {{{ICINGA_LICENSE_HEADER}}} /** * Configuration: Show message that changes were saved successfully * * As a user I want to see that configuration changes were successful. * * This test performs the following steps * * - Login using the provided credentials * - Open the configuration dialog and change the timezone * - Save and test for a success bubble to appear * - Open the authentication dialog * - Open the edit link of the first backend * - Hit save and test for a success bubble to apper * - Open the logging dialog, hit save and test for a success bubble to appear **/ /** * The icinga util object * * @type object */ var icinga = require('./icingawebtest'); /** * The casperjs object * * @type Casper */ var casper = icinga.getTestEnv(); /** * Login to the instance */ icinga.performLogin(); /** * Open the config dialog and test if the form exists */ casper.thenOpen('/config', function() { this.test.assertExists( '#form_config_general', 'Test whether the general settings dialog exists in the general form' ); this.test.assertExists( '#form_config_general select#timezone', 'Assert the timezone input to exist' ); }); /** * Change the timezone and submit */ casper.then(function() { this.test.assertDoesntExist( 'div.alert.alert-success', 'Assert no success notice existing when no changes have been done in the general form' ); this.echo("Changing the default timezone"); this.fill('#form_config_general', { 'timezone': 'Europe/Minsk' }); this.click('#form_config_general input#btn_submit'); }); /** * Check for the 'Successfully Update' information bubble */ casper.then(function() { this.echo("Clicked on save button of the general form, waiting for success"); this.waitForSelector('div.alert.alert-success', function() { this.test.assertSelectorHasText( 'div.alert.alert-success', 'Config Sucessfully Updated', 'Assert a success text to appear in the general form' ); }, function() { this.test.fail("No success text appeared in the general form"); }); }); /** * Open the config dialog and click on the first 'Edit This Authentication Backend' Link */ casper.thenOpen('/config/authentication', function() { var link = this.evaluate(function() { var links = document.querySelectorAll('#icingamain a'); for (var i=0; i