mirror of
https://github.com/moodle/moodle.git
synced 2025-03-22 00:20:37 +01:00
Merge branch 'MDL-76499-401' of https://github.com/andelacruz/moodle into MOODLE_401_STABLE
This commit is contained in:
commit
c3b36c6a34
@ -26,9 +26,8 @@ Feature: Add a new custom file type
|
||||
| Custom description | Moodle rules |
|
||||
And I press "Save changes"
|
||||
And I should see "application/x-moodle-rules"
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I am on the "Course 1" course page logged in as teacher1
|
||||
And I turn editing mode on
|
||||
When I add a "File" to section "1" and I fill the form with:
|
||||
| Name | Test file |
|
||||
| Select files | files/tests/fixtures/custom_filetype.mdlr |
|
||||
|
@ -16,34 +16,32 @@ Feature: Teacher can specify different display options for the resource
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And the following "activities" exist:
|
||||
| activity | course | name | defaultfilename | uploaded |
|
||||
| resource | C1 | Myfile | mod/resource/tests/fixtures/samplefile.txt | 1 |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
|
||||
@javascript
|
||||
Scenario: Specifying no additional display options for a file resource
|
||||
When I add a "File" to section "1"
|
||||
When I am on the "Myfile" "resource activity editing" page
|
||||
And I set the following fields to these values:
|
||||
| Name | Myfile |
|
||||
| Show size | 0 |
|
||||
| Show type | 0 |
|
||||
| Show upload/modified date | 0 |
|
||||
And I upload "mod/resource/tests/fixtures/samplefile.txt" file to "Select files" filemanager
|
||||
| Show upload/modified date | 0 |
|
||||
| showsize | 0 |
|
||||
| showtype | 0 |
|
||||
And I press "Save and display"
|
||||
Then ".resourcedetails" "css_element" should not exist
|
||||
And I am on "Course 1" course homepage
|
||||
And ".activity.resource .resourcelinkdetails" "css_element" should not exist
|
||||
And I log out
|
||||
|
||||
@javascript
|
||||
Scenario Outline: Specifying different display options for a file resource
|
||||
When I add a "File" to section "1"
|
||||
When I am on the "Myfile" "resource activity editing" page
|
||||
And I set the following fields to these values:
|
||||
| Name | Myfile |
|
||||
| Display | Open |
|
||||
| display | 5 |
|
||||
| Show size | <showsize> |
|
||||
| Show type | <showtype> |
|
||||
| Show upload/modified date | <showdate> |
|
||||
And I upload "mod/resource/tests/fixtures/samplefile.txt" file to "Select files" filemanager
|
||||
And I press "Save and display"
|
||||
Then I <seesize> see "6 bytes" in the ".resourcedetails" "css_element"
|
||||
And I <seetype> see "Text file" in the ".resourcedetails" "css_element"
|
||||
@ -52,7 +50,6 @@ Feature: Teacher can specify different display options for the resource
|
||||
And I <seesize> see "6 bytes" in the ".activity.resource .resourcelinkdetails" "css_element"
|
||||
And I <seetype> see "Text file" in the ".activity.resource .resourcelinkdetails" "css_element"
|
||||
And I <seedate> see "Uploaded" in the ".activity.resource .resourcelinkdetails" "css_element"
|
||||
And I log out
|
||||
|
||||
Examples:
|
||||
| showsize | showtype | showdate | seesize | seetype | seedate |
|
||||
|
@ -18,8 +18,7 @@ Feature: View activity completion information for file resources
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And the following config values are set as admin:
|
||||
| displayoptions | 0,1,2,3,4,5,6 | resource |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as teacher1
|
||||
And I navigate to "Settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
And I set the following fields to these values:
|
||||
@ -29,50 +28,40 @@ Feature: View activity completion information for file resources
|
||||
|
||||
@javascript
|
||||
Scenario Outline: The manual completion button will be shown on the course page for Open, In pop-up, New window and Force download display mode if Show activity completion conditions is set to No
|
||||
Given I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "File" to section "1"
|
||||
And I set the following fields to these values:
|
||||
| Name | Myfile |
|
||||
| id_display | <display> |
|
||||
| Show size | 0 |
|
||||
| Show type | 0 |
|
||||
| Show upload/modified date | 0 |
|
||||
| Completion tracking | Students can manually mark the activity as completed |
|
||||
And I upload "mod/resource/tests/fixtures/samplefile.txt" file to "Select files" filemanager
|
||||
And I press "Save and return to course"
|
||||
Given the following "activities" exist:
|
||||
| activity | course | name | display | showsize | showtype | showdate | completion | defaultfilename | popupwidth | popupheight | uploaded |
|
||||
| resource | C1 | Myfile | <display> | 0 | 0 | 0 | 1 | mod/resource/tests/fixtures/samplefile.txt | 620 | 450 | 1 |
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
# Teacher view.
|
||||
And the manual completion button for "Myfile" should exist
|
||||
And the manual completion button for "Myfile" should be disabled
|
||||
And I log out
|
||||
# Student view.
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
When I am on the "Course 1" course page logged in as student1
|
||||
Then the manual completion button for "Myfile" should exist
|
||||
And the manual completion button of "Myfile" is displayed as "Mark as done"
|
||||
And I toggle the manual completion state of "Myfile"
|
||||
And the manual completion button of "Myfile" is displayed as "Done"
|
||||
|
||||
Examples:
|
||||
| display |
|
||||
| Open |
|
||||
| In pop-up |
|
||||
| Force download |
|
||||
| New window |
|
||||
| display |
|
||||
| 5 |
|
||||
| 6 |
|
||||
| 4 |
|
||||
| 3 |
|
||||
|
||||
@javascript
|
||||
Scenario: The manual completion button will be shown on the activity page and course page if Show activity completion conditions is set to Yes
|
||||
Given I am on "Course 1" course homepage
|
||||
Given the following "activities" exist:
|
||||
| activity | course | name | display | defaultfilename | uploaded |
|
||||
| resource | C1 | Myfile | 1 | mod/resource/tests/fixtures/samplefile.txt | 1 |
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I navigate to "Settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
And I set the field "Show activity completion conditions" to "Yes"
|
||||
And I press "Save and display"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "File" to section "1"
|
||||
And I am on the "Myfile" "resource activity editing" page
|
||||
And I set the following fields to these values:
|
||||
| Name | Myfile |
|
||||
| id_display | Embed |
|
||||
| Completion tracking | Students can manually mark the activity as completed |
|
||||
And I upload "mod/resource/tests/fixtures/samplefile.txt" file to "Select files" filemanager
|
||||
And I click on "Save and return to course" "button"
|
||||
# Teacher view.
|
||||
And the manual completion button for "Myfile" should exist
|
||||
@ -80,10 +69,8 @@ Feature: View activity completion information for file resources
|
||||
And I am on the "Myfile" "resource activity" page
|
||||
And the manual completion button for "Myfile" should exist
|
||||
And the manual completion button for "Myfile" should be disabled
|
||||
And I log out
|
||||
# Student view.
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
When I am on the "Course 1" course page logged in as student1
|
||||
Then the manual completion button for "Myfile" should exist
|
||||
And I am on the "Myfile" "resource activity" page
|
||||
And the manual completion button of "Myfile" is displayed as "Mark as done"
|
||||
@ -92,26 +79,21 @@ Feature: View activity completion information for file resources
|
||||
|
||||
@javascript
|
||||
Scenario: View automatic completion items
|
||||
Given I navigate to "Settings" in current page administration
|
||||
Given the following "activities" exist:
|
||||
| activity | course | name | display | defaultfilename | uploaded |
|
||||
| resource | C1 | Myfile | 1 | mod/resource/tests/fixtures/samplefile.txt | 1 |
|
||||
And I navigate to "Settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
And I set the field "Show activity completion conditions" to "Yes"
|
||||
And I press "Save and display"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "File" to section "1"
|
||||
And I am on the "Myfile" "resource activity editing" page
|
||||
And I set the following fields to these values:
|
||||
| Name | Myfile |
|
||||
| id_display | Embed |
|
||||
| Completion tracking | Show activity as complete when conditions are met |
|
||||
| Require view | 1 |
|
||||
And I upload "mod/resource/tests/fixtures/samplefile.txt" file to "Select files" filemanager
|
||||
And I press "Save and display"
|
||||
And I am on "Course 1" course homepage
|
||||
# Teacher view.
|
||||
And I am on the "Myfile" "resource activity" page
|
||||
And "Myfile" should have the "View" completion condition
|
||||
And I log out
|
||||
# Student view.
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Myfile" "resource activity" page
|
||||
When I am on the "Myfile" "resource activity" page logged in as student1
|
||||
Then the "View" completion condition of "Myfile" is displayed as "done"
|
||||
|
@ -65,6 +65,9 @@ class mod_resource_generator extends testing_module_generator {
|
||||
if (!isset($record->showtype)) {
|
||||
$record->showtype = 0;
|
||||
}
|
||||
if (!isset($record->uploaded)) {
|
||||
$record->uploaded = 0;
|
||||
}
|
||||
|
||||
// The 'files' value corresponds to the draft file area ID. If not
|
||||
// specified, create a default file.
|
||||
@ -74,6 +77,8 @@ class mod_resource_generator extends testing_module_generator {
|
||||
}
|
||||
$usercontext = context_user::instance($USER->id);
|
||||
$filename = $record->defaultfilename ?? 'resource' . ($this->instancecount + 1) . '.txt';
|
||||
// Set filepath depending on filename.
|
||||
$filepath = (isset($record->defaultfilename)) ? $CFG->dirroot . '/' : '/';
|
||||
|
||||
// Pick a random context id for specified user.
|
||||
$record->files = file_get_unused_draft_itemid();
|
||||
@ -81,9 +86,15 @@ class mod_resource_generator extends testing_module_generator {
|
||||
// Add actual file there.
|
||||
$filerecord = ['component' => 'user', 'filearea' => 'draft',
|
||||
'contextid' => $usercontext->id, 'itemid' => $record->files,
|
||||
'filename' => $filename, 'filepath' => '/'];
|
||||
'filename' => basename($filename), 'filepath' => $filepath];
|
||||
$fs = get_file_storage();
|
||||
$fs->create_file_from_string($filerecord, 'Test resource ' . $filename . ' file');
|
||||
if ($record->uploaded == 1) {
|
||||
// Create file using pathname (defaultfilename) set.
|
||||
$fs->create_file_from_pathname($filerecord, $filepath . $filename);
|
||||
} else {
|
||||
// If defaultfilename is not set, create file from string "resource 1.txt".
|
||||
$fs->create_file_from_string($filerecord, 'Test resource ' . $filename . ' file');
|
||||
}
|
||||
}
|
||||
|
||||
// Do work to actually add the instance.
|
||||
|
Loading…
x
Reference in New Issue
Block a user