Merge branch 'MDL-86179-main' of https://github.com/sarjona/moodle

This commit is contained in:
Amaia Anabitarte
2025-08-25 13:27:39 +02:00
3 changed files with 90 additions and 59 deletions
@@ -0,0 +1,72 @@
@core @core_course @core_courseformat @mod_book @mod_imscp @mod_folder @mod_page @mod_url @mod_resource
Feature: Testing overview_report with resources
In order to list all resources in a course
As a user
I need to be able to see the resource overview
Background:
Given the following "users" exist:
| username | firstname | lastname |
| student1 | Username | 1 |
| student2 | Username | 2 |
| student3 | Username | 3 |
| teacher1 | Teacher | T |
And the following "courses" exist:
| fullname | shortname | enablecompletion |
| Course 1 | C1 | 1 |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | name | intro | course | idnumber | completion | completionview |
| book | Book name 1 | Test book1 | C1 | book1 | 2 | 1 |
| page | Page name 1 | Test page1 | C1 | page1 | 2 | 1 |
| url | URL name 1 | Test url1 | C1 | url1 | 1 | |
| folder | Folder name 1 | Test folder1 | C1 | folder1 | | |
| label | Label name 1 | Test label1 | C1 | label1 | | |
And the following "activities" exist:
| activity | name | intro | course | defaultfilename | uploaded |
| resource | File name 1 | Test file1 | C1 | mod/resource/tests/fixtures/samplefile.txt | 1 |
And the following "activities" exist:
| activity | name | intro | course | packagefilepath |
| imscp | IMSCP name 1 | Test imscp1 | C1 | mod/imscp/tests/packages/singelscobasic.zip |
Scenario: Teacher can see the relevant information in the resources overview
When I am on the "Course 1" "course > activities > resource" page logged in as "teacher1"
Then the following should exist in the "Table listing all Resource activities" table:
| Name | Resource type | Actions |
| Book name 1 | Book | View |
| Page name 1 | Page | View |
| URL name 1 | URL | View |
| Folder name 1 | Folder | View |
| File name 1 | File | View |
| IMSCP name 1 | IMS content package | View |
And I should not see "Status" in the "resource_overview_collapsible" "region"
# Labels are not displayed in the resource overview report.
And I should not see "Label name1" in the "resource_overview_collapsible" "region"
Scenario: Students can see the relevant information in the resources overview
When I am on the "Course 1" "course > activities > resource" page logged in as "student1"
Then the following should exist in the "Table listing all Resource activities" table:
| Name | Status | Resource type |
| Book name 1 | To do | Book |
| Page name 1 | To do | Page |
| URL name 1 | Mark as done | URL |
| Folder name 1 | - | Folder |
| File name 1 | - | File |
| IMSCP name 1 | - | IMS content package |
And I should not see "Actions" in the "resource_overview_collapsible" "region"
# Labels are not displayed in the resource overview report.
And I should not see "Label name1" in the "resource_overview_collapsible" "region"
Scenario: The resource overview report should generate log events
Given I am on the "Course 1" "course > activities > resource" page logged in as "teacher1"
When I am on the "Course 1" "course" page logged in as "teacher1"
And I navigate to "Reports" in current page administration
And I click on "Logs" "link"
And I click on "Get these logs" "button"
Then I should see "Course activities overview page viewed"
And I should see "viewed the list of resources in the course"
@@ -141,23 +141,6 @@ Feature: Users can access the course activities overview page
And "Activity 2" "link" should exist in the "resource_overview_collapsible" "region"
And "Activity 3" "link" should exist in the "resource_overview_collapsible" "region"
Scenario: Course overview shows a table with all resources
Given the following "activities" exist:
| activity | course | name |
| book | C1 | Activity 1 |
| folder | C1 | Activity 2 |
| imscp | C1 | Activity 3 |
| page | C1 | Activity 4 |
| resource | C1 | Activity 5 |
| url | C1 | Activity 6 |
When I am on the "Course 1" "course > activities > resource" page logged in as "teacher1"
Then I should see "Book" in the "Activity 1" "table_row"
And I should see "Folder" in the "Activity 2" "table_row"
And I should see "IMS content package" in the "Activity 3" "table_row"
And I should see "Page" in the "Activity 4" "table_row"
And I should see "File" in the "Activity 5" "table_row"
And I should see "URL" in the "Activity 6" "table_row"
@javascript
Scenario: Students should see completion status in the overview when some activity has completion
Given the following "activities" exist:
@@ -216,7 +199,7 @@ Feature: Users can access the course activities overview page
Then I should see "To do" in the "Activity 1" "table_row"
And I should see "View" in the "Activity 1" "table_row"
Scenario: The course overview page should log a page event and a reource list event
Scenario: The course overview page should log a page event and a resource list event
Given the following "activity" exists:
| activity | folder |
| name | Activity 1 |
@@ -235,22 +218,6 @@ Feature: Users can access the course activities overview page
And I should see "Course activities overview page viewed"
And I should see "viewed the list of resources"
@javascript
Scenario: The course overview page should log reource list event when loading the overview table
Given the following "activity" exists:
| activity | folder |
| name | Activity 1 |
| course | C1 |
And I am on the "Course 1" "course > activities" page logged in as "teacher1"
And I click on "Expand" "link" in the "resource_overview_collapsible" "region"
When I am on the "Course 1" "course" page logged in as "teacher1"
And I navigate to "Reports" in current page administration
And I click on "Logs" "link"
And I set the field "Select a user" to "Teacher 1"
And I click on "Get these logs" "button"
Then I should see "Course activities overview page viewed"
And I should see "viewed the list of resources"
Scenario: Users can see a link to the old index when the activity does not provide overview information
Given the following "activities" exist:
| activity | course | name |
@@ -42,38 +42,30 @@ Feature: Testing overview integration in mod_choice
And I should see "viewed the instance list for the module 'choice'"
Scenario: Students can see relevant columns and content in the choice overview
Given I am on the "Course 1" "course > activities > choice" page logged in as "student1"
# Check columns.
Then I should see "Name" in the "choice_overview_collapsible" "region"
And I should see "Due date" in the "choice_overview_collapsible" "region"
And I should see "Status" in the "choice_overview_collapsible" "region"
And I should see "Responded" in the "choice_overview_collapsible" "region"
# Check Responded.
When I am on the "Course 1" "course > activities > choice" page logged in as "student1"
Then the following should exist in the "Table listing all Choice activities" table:
| Name | Due date | Status | Responded |
| Choice 1 | 1 January 2040 | Mark as done | |
| Choice 2 | - | - | - |
| Choice 3 | - | - | - |
| Choice 4 | - | - | - |
And I should not see "Actions" in the "choice_overview_collapsible" "region"
# Check Responded column.
And "Answered" "icon" should exist in the "Choice 1" "table_row"
And "Answered" "icon" should not exist in the "Choice 2" "table_row"
# Check allow responses until.
And the following should exist in the "course-overview-table" table:
| Name | Due date |
| Choice 1 | 1 January 2040 |
| Choice 2 | - |
| Choice 3 | - |
| Choice 4 | - |
@javascript
Scenario: Teachers can see relevant columns and content in the choice overview
Given I am on the "Course 1" "course > activities > choice" page logged in as "teacher1"
# Check columns.
Then I should see "Name" in the "choice_overview_collapsible" "region"
And I should see "Due date" in the "choice_overview_collapsible" "region"
Then the following should exist in the "Table listing all Choice activities" table:
| Name | Due date | Students who responded | Actions |
| Choice 1 | 1 January 2040 | 2 | View |
| Choice 2 | - | 1 | View |
| Choice 3 | - | 0 | View |
| Choice 4 | - | 0 | View |
And I should not see "Status" in the "choice_overview_collapsible" "region"
And I should see "Students who responded" in the "choice_overview_collapsible" "region"
And I should see "Actions" in the "choice_overview_collapsible" "region"
And the following should exist in the "course-overview-table" table:
| Name | Students who responded | Actions |
| Choice 1 | 2 | View |
| Choice 2 | 1 | View |
| Choice 3 | 0 | View |
| Choice 4 | 0 | View |
And I should not see "Responded" in the "choice_overview_collapsible" "region"
# Check dropdown.
And I click on "2" "button" in the "Choice 1" "table_row"
And I should see "Allow more than one choice to be selected"
And I should see "Option 1: 1"