Show
Setup scenario
The SRLogger class was extensively tested in MDL-79061 , so we only need to test the action change the SR Logger content. The easiest way is to make the element visible:
Login as admin and go to "Site administration > appearance > Themes"
Ensure you are using Boost.
Edit the Boost theme settings with the cog icon.
Go to the "Advanced settings" tab
In the "Raw SCSS" paste this code:
#sr-logger-feedback-container {
background-color: lightyellow;
position: fixed !important;
right: 0 ;
left: 0 ;
bottom: 0 ;
z-index: 1030 ;
width: initial !important;
height: initial !important;
padding: 2rem !important;
margin: initial !important;
overflow: initial !important;
clip: auto !important;
white-space: initial !important;
border: solid orange 5px !important
}
Ensure you have the debug mode on. Using mdk you can execute "mdk run mindev.php" or go to "Site administration > development > debuggon" and set debug messages to DEVELOPER.
Create a course with completion tracking. There should be two page activities, "Activity 1" and "Activity 2," with manual completion.
Enrol a student
Test 1: page course completion test
log in as the student, and go to the course page
Mark "Activity 1" as done. We need to do this to initiate the logger element for the first time.
Check if a yellow bottom bar appears on the page. This is the log message bar.
You need to stay alert during this step because the log message lasts only four seconds: While looking at the log message bar, mark "Activity 2" as done.
Check that the log message bar has been changed to "Activity 2 marked as completed."
Wait 5 seconds
Check that the log message bar is now empty.
In this step, you need to stay alert again. While looking at the log message bar, mark "Activity 2" as undone.
Check that the content of the log message bar has been changed to "Activity 2 marked as uncompleted."
Test 2: activity page
If you are not there already, log in as a student and go to the course page.
Access "Activity 2"
Stay alert in the lower part of your browser. Mark the activity as done using the completion button below the activity tabs.
Check that the yellow log message bottom bar appears and the content is "Activity 2 marked as completed"
Wait 5 seconds
Check that the log message bar is now empty.
In this step, you need to stay alert again. While looking at the log message bar, use the completion button to unmark the activity completion.
Check that the content of the log message bar has been changed to "Activity 2 marked as uncompleted."
Test 3 (only in main): activity overview page
If you are not there, log in as a student and go to the course page.
Go to the "Activities" tab.
Expand the "Resources" sections (if you create a type of activity that is not resource, open the section where the activities are)
Stay alert in the lower part of your browser. Use the button in the "completion status" column to mark "Activity 2" as done.
Check that the yellow log message bottom bar appears and the content is "Activity 2 marked as completed"
Wait 5 seconds
Check that the log message bar is now empty.
In this step, you need to stay alert again. While looking at the log message bar, click again the completion button to unmark "Activity 2" completion.
Check that the content of the log message bar has been changed to "Activity 2 marked as uncompleted."
Test 4: batch completion
This test only checks the batch notification strings. There is no batch manual completion edit in Moodle.
You need the IDs of each activity. You can take the ID from the "id=" parameter in the activity URL. Note down both IDs (we will call them YY and ZZ), you will need them later.
If you are not there, log in as a student and go to the course page.
Open the browser console and find some line like (the XX may change depending on the course ID):
Registering new reactive instance "M.reactive.CourseEditorXX"
Execute the following command in the console (XX is the course id, YY the activity 1 ID, ZZ the activity 2 ID):
M.reactive.CourseEditorXX.dispatch( 'cmCompletion' , [YY, ZZ], 1 )
Check that the content of the log message bar appears and the content is "Selected 2 activities marked as completed."
Wait 5 seconds
Check that the log message bar is now empty.
Execute the following command in the console (XX is the course id, YY the activity 1 ID, ZZ the activity 2 ID):
M.reactive.CourseEditorXX.dispatch( 'cmCompletion' , [YY, ZZ], 0 )
Check that the content of the log message bar appears and the content is "Selected 2 activities marked as uncompleted."