This commit is contained in:
Amaia Anabitarte
2025-08-27 15:28:54 +02:00
@@ -11,23 +11,18 @@ Feature: Display and choose from the available activities in course
And the following "courses" exist:
| fullname | shortname | format | startdate |
| Course | C | topics | |
| Course 2 | C2 | weeks | 95713920 |
And the following "course enrolments" exist:
| user | course | role |
| teacher | C | editingteacher |
| teacher | C2 | editingteacher |
And the following config values are set as admin:
| enablemoodlenet | 0 | tool_moodlenet |
And I log in as "teacher"
And I am on "Course" course homepage with editing mode on
Scenario: The available activities are displayed to the teacher in the activity chooser
Given I open the activity chooser
Then I should see "Add an activity or resource" in the ".modal-title" "css_element"
And I should see "Assignment" in the ".modal-body" "css_element"
Scenario: The teacher can choose to add an activity from the activity items in the activity chooser
# Validate the activity chooser is opened in this first scenario.
Given I open the activity chooser
And I should see "Assignment" in the "Add an activity or resource" "dialogue"
When I click on "Add a new Assignment" "link" in the "Add an activity or resource" "dialogue"
And I click on "Add selected activity" "button" in the "Add an activity or resource" "dialogue"
Then I should see "New Assignment"
@@ -62,19 +57,6 @@ Feature: Display and choose from the available activities in course
And I should see "Resources" in the "help" "core_course > Activity chooser screen"
And I should see "Gradable" in the "help" "core_course > Activity chooser screen"
And I should see "No" in the "help" "core_course > Activity chooser screen"
# Validate everything again in weekly format course.
And I am on "C2" course homepage with editing mode on
And I click on "Add content" "button" in the "13 January - 19 January" "section"
And I click on "Activity or resource" "button" in the "13 January - 19 January" "section"
And I click on "Information about the Forum activity" "button" in the "Add an activity or resource" "dialogue"
And I should see "Forum" in the "help" "core_course > Activity chooser screen"
And I should see "The forum activity module enables participants to have asynchronous discussions"
And "More help" "link" should exist
And "Opens in new window" "link" should be visible
And I should see "Collaboration" in the "help" "core_course > Activity chooser screen"
And I should see "Communication" in the "help" "core_course > Activity chooser screen"
And I should see "Gradable" in the "help" "core_course > Activity chooser screen"
And I should see "Yes" in the "help" "core_course > Activity chooser screen"
Scenario: The teacher use the activity chooser help panel to go to the specific purpose category
Given I open the activity chooser
@@ -97,16 +79,6 @@ Feature: Display and choose from the available activities in course
And "help" "core_course > Activity chooser screen" should not be visible
And "Back" "button" in the "Add an activity or resource" "dialogue" should not be visible
And I should not see "The assignment activity module enables a teacher to communicate tasks, collect work and provide grades and feedback." in the "Add an activity or resource" "dialogue"
# Confirm hide summary also works for weekly format course
And I am on "C2" course homepage with editing mode on
And I click on "Add content" "button" in the "13 January - 19 January" "section"
And I click on "Activity or resource" "button" in the "13 January - 19 January" "section"
And I click on "Information about the Assignment activity" "button" in the "Add an activity or resource" "dialogue"
And I click on "Back" "button" in the "Add an activity or resource" "dialogue"
And "modules" "core_course > Activity chooser screen" should be visible
And "help" "core_course > Activity chooser screen" should not be visible
And "Back" "button" should not exist in the "modules" "core_course > Activity chooser screen"
And I should not see "The assignment activity module enables a teacher to communicate tasks, collect work and provide grades and feedback." in the "Add an activity or resource" "dialogue"
Scenario: View recommended activities
When I log out
@@ -157,7 +129,7 @@ Feature: Display and choose from the available activities in course
And I click on "All" "link" in the "Add an activity or resource" "dialogue"
And I should not see "Starred" in the "Add an activity or resource" "dialogue"
Scenario: The teacher can manage favourites form the favourites tab and the list is refreshed when the user change tab
Scenario: The teacher can manage favourites from the favourites tab and the list is refreshed when the user change tab
Given I open the activity chooser
And I click on "Add Assignment to starred" "button" in the "Add an activity or resource" "dialogue"
And I click on "Add Forum to starred" "button" in the "Add an activity or resource" "dialogue"
@@ -172,7 +144,7 @@ Feature: Display and choose from the available activities in course
And I should see "Forum" in the "favourites" "core_course > Activity chooser tab"
And I should not see "Assignment" in the "favourites" "core_course > Activity chooser tab"
Scenario: The teacher can undo a unfavourite action done in the activity chooser favourites tab
Scenario: The teacher can undo an unfavourite action done in the activity chooser favourites tab
Given I open the activity chooser
And I click on "Add Assignment to starred" "button" in the "Add an activity or resource" "dialogue"
When I click on "Starred" "link" in the "Add an activity or resource" "dialogue"
@@ -185,22 +157,19 @@ Feature: Display and choose from the available activities in course
And I click on "Starred" "link" in the "Add an activity or resource" "dialogue"
And I should see "Assignment" in the "favourites" "core_course > Activity chooser tab"
Scenario: The teacher can search for an activity by it's name
Given I open the activity chooser
When I set the field "search" to "Lesson"
Then I should see "1 results found" in the "Add an activity or resource" "dialogue"
Scenario: The teacher can search for an activity by name or description in the activity chooser
When I open the activity chooser
# Test name.
Then I set the field "search" to "Lesson"
And I should see "1 results found" in the "Add an activity or resource" "dialogue"
And I should see "Lesson" in the "Add an activity or resource" "dialogue"
Scenario: The teacher can search for an activity by it's description
Given I open the activity chooser
When I set the field "search" to "The lesson activity module enables a teacher to deliver content"
Then I should see "1 results found" in the "Add an activity or resource" "dialogue"
# Test description.
And I set the field "search" to "The lesson activity module enables a teacher to deliver content"
And I should see "1 results found" in the "Add an activity or resource" "dialogue"
And I should see "Lesson" in the "Add an activity or resource" "dialogue"
Scenario: Search results are not returned if the search query does not match any activity name or description
Given I open the activity chooser
When I set the field "search" to "Random search query"
Then I should see "0 results found" in the "Add an activity or resource" "dialogue"
# Test non matching search.
And I set the field "search" to "Random search query"
And I should see "0 results found" in the "Add an activity or resource" "dialogue"
Scenario: Teacher can return to the default activity chooser state by manually removing the search query
Given I open the activity chooser
@@ -212,23 +181,17 @@ Feature: Display and choose from the available activities in course
Then ".searchresultscontainer" "css_element" should not be visible
And ".optionscontainer" "css_element" should exist
Scenario: Teacher can not see a clear button if a search query is not entered in the activity chooser search bar
Scenario: Teacher can see the clear button onyl when there is a search query
When I open the activity chooser
Then "Clear search input" "button" should not be visible
Scenario: Teacher can see a clear button after entering a search query in the activity chooser search bar
Given I open the activity chooser
When I set the field "search" to "Search query"
Then "Clear search input" "button" should be visible
Scenario: Teacher can not see a clear button if the search query is removed in the activity chooser search bar
Given I open the activity chooser
And I set the field "search" to "Search query"
And "Clear search input" "button" should be visible
And I set the field "search" to "Search query"
And "Clear search input" "button" should exist
When I set the field "search" to ""
And I set the field "search" to ""
# Waiting for the animation to hide the button to finish.
And I wait "1" seconds
Then "Clear search input" "button" should not be visible
And "Clear search input" "button" should not be visible
Scenario: Teacher can instantly remove the search query from the activity search bar by clicking on the clear button
Given I open the activity chooser
@@ -239,7 +202,7 @@ Feature: Display and choose from the available activities in course
And ".searchresultscontainer" "css_element" should not be visible
And ".optionscontainer" "css_element" should exist
Scenario: Click on an activity chosser category should cancel the current search
Scenario: Click on an activity chooser category should cancel the current search
Given I open the activity chooser
And I set the field "search" to "Search query"
And I should see "results found" in the "Add an activity or resource" "dialogue"
@@ -279,7 +242,7 @@ Feature: Display and choose from the available activities in course
And "File" "link" should not exist in the "interactivecontent" "core_course > Activity chooser tab"
And "H5P" "link" should exist in the "interactivecontent" "core_course > Activity chooser tab"
Scenario: Teacher can navigate through activity chooser in Topics format course
Scenario: Teacher can navigate through activity chooser
When I open the activity chooser
Then I should see "All" in the "Add an activity or resource" "dialogue"
And I press the tab key
@@ -301,27 +264,21 @@ Feature: Display and choose from the available activities in course
And I press the escape key
And "Add an activity or resource" "dialogue" should not be visible
Scenario: Teacher can navigate through activity chooser in Weekly format course
Given I am on "C2" course homepage with editing mode on
Scenario: Check the activity chooser is compatible with weekly format course
Given the following "courses" exist:
| fullname | shortname | format | startdate |
| Course 2 | C2 | weeks | 95713920 |
And the following "course enrolments" exist:
| user | course | role |
| teacher | C2 | editingteacher |
And I am on "C2" course homepage with editing mode on
And I click on "Add content" "button" in the "13 January - 19 January" "section"
When I click on "Activity or resource" "button" in the "13 January - 19 January" "section"
# We don't need to validate everything again, just some basic elements.
Then I should see "All" in the "Add an activity or resource" "dialogue"
And I press the tab key
And I press the tab key
And I press the tab key
And I press the tab key
# Confirm right key works
And I press the right key
And I press the right key
And the focused element is "Choice" "menuitem" in the "Add an activity or resource" "dialogue"
# Confirm left key works
And I press the left key
And the focused element is "Book" "menuitem" in the "Add an activity or resource" "dialogue"
# Confirm clicking "x" button closes modal
And I click on "Close" "button" in the "Add an activity or resource" "dialogue"
And "Add an activity or resource" "dialogue" should not be visible
And I click on "Add content" "button" in the "13 January - 19 January" "section"
And I click on "Activity or resource" "button" in the "13 January - 19 January" "section"
# Confirm escape key closes the modal
And I press the escape key
And "Add an activity or resource" "dialogue" should not be visible
And I should see "Collaboration" in the "Add an activity or resource" "dialogue"
And I should see "Assignment" in the "all" "core_course > Activity chooser tab"
And I should see "Book" in the "all" "core_course > Activity chooser tab"
And "Add selected activity" "button" should exist in the "Add an activity or resource" "dialogue"
And "Add selected activity" "button" should exist in the "Add an activity or resource" "dialogue"
And "Add Assignment to starred" "button" should exist in the "Add an activity or resource" "dialogue"