mirror of
https://github.com/moodle/moodle.git
synced 2025-08-03 08:09:47 +02:00

A new component has been created, core_adminpresets, and tables and some API methods from this tool have been moved there, so it can spread over other plugins. Currently, the tool_admin_presets plugin only provides the UI to interact with the core adminpresets stuff.
77 lines
3.6 KiB
Gherkin
77 lines
3.6 KiB
Gherkin
@tool @tool_admin_presets @_file_upload @javascript
|
|
Feature: I can upload a preset file
|
|
|
|
Background: Go to the Import settings page
|
|
Given I log in as "admin"
|
|
And I navigate to "Site admin presets" in site administration
|
|
And I click on "Import preset" "link_or_button"
|
|
|
|
Scenario: Import settings and plugins from a valid XML file
|
|
Given I should see "Import site admin preset"
|
|
And I click on "Import" "button"
|
|
And I should see "You must supply a value here"
|
|
And I upload "adminpresets/tests/fixtures/import_settings_plugins.xml" file to "Select file" filemanager
|
|
And I click on "Import" "button"
|
|
And I should see "Setting changes"
|
|
And I should see "Imported preset"
|
|
And I should see "Enable portfolios" in the "core" "table_row"
|
|
And I should see "900" in the "mod_lesson" "table_row"
|
|
When I click on "Apply" "button"
|
|
And I should see "Setting changes"
|
|
And I should see "Unchanged settings"
|
|
And I click on "Continue" "button"
|
|
Then I should see "Imported preset" in the "Site admin presets table" "table"
|
|
And I navigate to "Advanced features" in site administration
|
|
And the following fields match these values:
|
|
| Enable portfolios | 1 |
|
|
And I navigate to "Plugins > Activity modules > Lesson" in site administration
|
|
And the following fields match these values:
|
|
| Popup window width | 900 |
|
|
|
|
Scenario: Rename imported settings
|
|
Given I should see "Import site admin preset"
|
|
And I set the field "Name" to "Renamed preset"
|
|
And I upload "adminpresets/tests/fixtures/import_settings_plugins.xml" file to "Select file" filemanager
|
|
And I click on "Import" "button"
|
|
And I should not see "Imported preset"
|
|
And I should see "Renamed preset"
|
|
When I click on "Apply" "button"
|
|
And I click on "Continue" "button"
|
|
Then I should not see "Imported preset" in the "Site admin presets table" "table"
|
|
And I should see "Renamed preset" in the "Site admin presets table" "table"
|
|
|
|
Scenario: Import settings from an invalid XML file
|
|
Given I set the field "Name" to "Renamed preset"
|
|
And I upload "adminpresets/tests/fixtures/invalid_xml_file.xml" file to "Select file" filemanager
|
|
When I click on "Import" "button"
|
|
Then I should see "Wrong file"
|
|
And I should not see "Setting changes"
|
|
And I navigate to "Site admin presets" in site administration
|
|
And I should not see "Renamed preset"
|
|
|
|
Scenario: Import unexisting settings category
|
|
Given I set the field "Name" to "Renamed preset"
|
|
And I upload "adminpresets/tests/fixtures/unexisting_category.xml" file to "Select file" filemanager
|
|
When I click on "Import" "button"
|
|
Then I should see "No valid settings"
|
|
And I should not see "Setting changes"
|
|
And I navigate to "Site admin presets" in site administration
|
|
And I should not see "Renamed preset"
|
|
|
|
Scenario: Import one unexisting setting
|
|
Given the following config values are set as admin:
|
|
| debug | 0 |
|
|
| debugdisplay | 0 |
|
|
And I set the field "Name" to "Renamed preset"
|
|
And I upload "adminpresets/tests/fixtures/import_settings_with_unexisting_setting.xml" file to "Select file" filemanager
|
|
When I click on "Import" "button"
|
|
And I should see "Setting changes"
|
|
And I should see "Enable portfolios" in the "core" "table_row"
|
|
And I should not see "No valid settings"
|
|
And I click on "Apply" "button"
|
|
And I should see "Setting changes"
|
|
And I click on "Continue" "button"
|
|
Then I should see "Renamed preset" in the "Site admin presets table" "table"
|
|
And I navigate to "Advanced features" in site administration
|
|
And the following fields match these values:
|
|
| Enable portfolios | 1 |
|