/** * 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