MDL-77446 Behat: Add coverage for changing uploaded file details

This commit is contained in:
Angelia Dela Cruz 2023-03-01 17:35:20 +08:00
parent f49f934786
commit 602061bf21

View File

@ -0,0 +1,48 @@
@mod @mod_resource @_file_upload
Feature: Details of uploaded file in the resource can be changed
In order to change details of an uploaded file in a folder resource
As a teacher
I should be able to upload a file
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | t1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | course | name |
| folder | C1 | Folder1 |
@javascript
Scenario: Uploaded file details can be changed
Given I am on the "Folder1" "folder activity" page logged in as teacher1
And I click on "Edit" "button"
# Upload a file in folder resource
And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager
And I press "Save changes"
And I click on "Edit" "button"
And I click on "empty.txt" "link"
# Initially, file details are set to default values
And the following fields match these values:
| Name | empty.txt |
| Author | Teacher 1 |
| licence | Licence not specified |
# Update the file details for testing
When I set the following fields to these values:
| Name | empty_file.txt |
| Author | Teacher 1 |
| licence | All rights reserved |
And I press "Update"
And I press "Save changes"
# Confirm that file details have been updated correctly
And I click on "Edit" "button"
And I click on "empty_file.txt" "link"
Then the following fields match these values:
| Name | empty_file.txt |
| Author | Teacher 1 |
| licence | All rights reserved |