MDL-77271 behat: test to verify used licence cannot be deleted

This commit is contained in:
Simey Lameze 2023-02-20 19:15:49 +08:00
parent 3236bf8e11
commit d9d8a1ad36
2 changed files with 38 additions and 0 deletions

View file

@ -24,3 +24,26 @@ Feature: Delete custom licenses
And I navigate to "Licence > Licence manager" in site administration
Then I should see "Licence not specified" in the "unknown" "table_row"
And I should not see "Delete" in the "unknown" "table_row"
@javascript @_file_upload
Scenario: I cannot delete a custom license in use
Given I log in as "admin"
And I navigate to "Licence > Licence manager" in site administration
And I click on "Create licence" "link"
And I set the following fields to these values:
| shortname | Test licence |
| fullname | Test licence |
| source | https://opensource.org/licenses/MIT |
| Licence version | ##1 March 2019## |
And I press "Save changes"
And I follow "Private files" in the user menu
And I upload "lib/editor/atto/tests/fixtures/moodle-logo.png" file to "Files" filemanager
And I click on "moodle-logo.png" "link"
And I set the field "Choose licence" to "Test licence"
And I press "Update"
And I press "Save changes"
And I am on site homepage
And I navigate to "Licence > Licence manager" in site administration
And I click on "Delete" "icon" in the "Test licence" "table_row"
When I click on "Save changes" "button" in the "Delete licence" "dialogue"
Then I should see "Cannot delete a licence which is currently assigned to one or more files"

View file

@ -33,3 +33,18 @@ Feature: Licence manager
And "This is the site default licence" "icon" should exist in the "cc" "table_row"
And "Enable licence" "icon" should not exist in the "cc" "table_row"
And "This is the site default licence" "icon" should not exist in the "public" "table_row"
@javascript @_file_upload
Scenario: User default licence preference is remembered
Given I log in as "admin"
And I navigate to "Licence > Licence settings" in site administration
And I set the following fields to these values:
| Default site licence | cc |
| Remember user licence preference | 0 |
And I press "Save changes"
And I follow "Private files" in the user menu
And I follow "Add..."
And I follow "Upload a file"
#And the field "licence" matches value "cc"
#And the field with xpath "//select[@name='licence']" matches value "cc"
#Then the "data-initial-value" attribute of "[name='licence']" "css_element" should contain "cc"