mirror of
https://github.com/catalyst/moodle-auth_outage.git
synced 2026-05-17 05:48:43 +02:00
Issue #46 - Implemented a basic behat test to check saving the default settings.
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
@auth @auth_outage @javascript
|
||||
Feature: Test outage plugin works as expected.
|
||||
In order to check if this plugin works
|
||||
As an admin
|
||||
I need to go through all configuration to ensure they can be changed and are consistent.
|
||||
|
||||
Background:
|
||||
Given I log in as "admin"
|
||||
|
||||
# Scenario: Check if I can navigate to the default settings.
|
||||
# Given I navigate to "Defaults" node in "Site administration > Plugins > Authentication > Outage"
|
||||
# Then I should see "Outage Defaults"
|
||||
|
||||
Scenario: Check if I can add a new outage.
|
||||
Given I navigate to "Manage" node in "Site administration > Plugins > Authentication > Outage"
|
||||
And I should see "Outages List"
|
||||
When I click on "Create Outage" "link"
|
||||
And I set the following fields to these values:
|
||||
| starttime[day] | 2 |
|
||||
| starttime[month] | January |
|
||||
| starttime[year] | 2016 |
|
||||
| starttime[hour] | 22 |
|
||||
| starttime[minute] | 00 |
|
||||
| stoptime[day] | 2 |
|
||||
| stoptime[month] | January |
|
||||
| stoptime[year] | 2016 |
|
||||
| stoptime[hour] | 23 |
|
||||
| stoptime[minute] | 30 |
|
||||
| warningduration[number] | 90 |
|
||||
| warningduration[timeunit] | minutes |
|
||||
| title | My New Outage |
|
||||
| description[text] | This is a test outage. |
|
||||
And I press "Save changes"
|
||||
Then I should see "My New Outage"
|
||||
And I should see "This is a test outage."
|
||||
39
tests/behat/behat_auth_outage.php
Normal file
39
tests/behat/behat_auth_outage.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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 Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Steps definitions related to auth_outage.
|
||||
*
|
||||
* @package auth_outage
|
||||
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
|
||||
* @copyright 2016 Catalyst IT
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
|
||||
|
||||
require_once(__DIR__ . '/../../../../lib/behat/behat_base.php');
|
||||
|
||||
class behat_auth_outage extends behat_base {
|
||||
/**
|
||||
* @Given /^The authentication plugin "([^"]*)" is enabled$/
|
||||
*/
|
||||
public function theAuthenticationPluginIsEnabled($auth) {
|
||||
set_config('auth', $auth);
|
||||
\core\session\manager::gc(); // Remove stale sessions.
|
||||
core_plugin_manager::reset_caches();
|
||||
}
|
||||
}
|
||||
23
tests/behat/default_settings.feature
Normal file
23
tests/behat/default_settings.feature
Normal file
@@ -0,0 +1,23 @@
|
||||
@auth @auth_outage @javascript
|
||||
Feature: Test changing the default settings.
|
||||
In order to check if I can set the default settings
|
||||
As an admin
|
||||
I need to go set the default values and check if they are using for new outages
|
||||
|
||||
Background: Always login as admin and enable the auth_outage plugin.
|
||||
Given The authentication plugin "outage" is enabled
|
||||
And I log in as "admin"
|
||||
|
||||
Scenario: Check if I can navigate to the default settings.
|
||||
Given I navigate to "Default Settings" node in "Site administration > Plugins > Authentication > Outage manager"
|
||||
When I set the following fields to these values:
|
||||
| s_auth_outage_default_autostart | bool |
|
||||
| s_auth_outage_default_duration | 123 |
|
||||
| s_auth_outage_default_warning_duration | 456 |
|
||||
| s_auth_outage_default_warning_title | My Behat Outage {{start}} |
|
||||
| s_auth_outage_default_warning_description | My outage <b>{{stop}}</b>. |
|
||||
| s_auth_outage_css | /* Some CSS. */ |
|
||||
And I press "Save changes"
|
||||
And I should see "Changes Saved"
|
||||
# And I wait "600" seconds
|
||||
# And I should see "This is a test outage."
|
||||
Reference in New Issue
Block a user