weekly release 4.0dev
[moodle.git] / course / tests / behat / activity_chooser.feature
... / ...
CommitLineData
1@core @core_course @javascript
2Feature: Display and choose from the available activities in course
3 In order to add activities to a course
4 As a teacher
5 I should be enabled to choose from a list of available activities and also being able to read their summaries.
6
7 Background:
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | teacher | Teacher | 1 | teacher@example.com |
11 And the following "courses" exist:
12 | fullname | shortname | format |
13 | Course | C | topics |
14 And the following "course enrolments" exist:
15 | user | course | role |
16 | teacher | C | editingteacher |
17 And the following config values are set as admin:
18 | enablemoodlenet | 0 | tool_moodlenet |
19 And I log in as "teacher"
20 And I am on "Course" course homepage with editing mode on
21
22 Scenario: The available activities are displayed to the teacher in the activity chooser
23 Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
24 Then I should see "Add an activity or resource" in the ".modal-title" "css_element"
25 And I should see "Assignment" in the ".modal-body" "css_element"
26
27 Scenario: The teacher can choose to add an activity from the activity items in the activity chooser
28 Given I click on "Add an activity or resource" "button" in the "Topic 3" "section"
29 When I click on "Add a new Assignment" "link" in the "Add an activity or resource" "dialogue"
30 Then I should see "Adding a new Assignment"
31 And I set the following fields to these values:
32 | Assignment name | Test Assignment Topic 3 |
33 And I press "Save and return to course"
34 Then I should see "Test Assignment Topic 3" in the "Topic 3" "section"
35
36 Scenario: The teacher can choose to add an activity from the activity summary in the activity chooser
37 Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
38 When I click on "Information about the Assignment activity" "button" in the "Add an activity or resource" "dialogue"
39 When I click on "Add a new Assignment" "link" in the "help" "core_course > Activity chooser screen"
40 Then I should see "Adding a new Assignment"
41
42 Scenario: Show summary
43 Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
44 When I click on "Information about the Assignment activity" "button" in the "Add an activity or resource" "dialogue"
45 Then I should see "Assignment" in the "help" "core_course > Activity chooser screen"
46 And I should see "The assignment activity module enables a teacher to communicate tasks, collect work and provide grades and feedback."
47
48 Scenario: Hide summary
49 Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
50 When I click on "Information about the Assignment activity" "button" in the "modules" "core_course > Activity chooser screen"
51 And I should see "The assignment activity module enables a teacher to communicate tasks, collect work and provide grades and feedback." in the "help" "core_course > Activity chooser screen"
52 And I should see "Back" in the "help" "core_course > Activity chooser screen"
53 When I click on "Back" "button" in the "help" "core_course > Activity chooser screen"
54 Then "modules" "core_course > Activity chooser screen" should be visible
55 And "help" "core_course > Activity chooser screen" should not be visible
56 And "Back" "button" should not exist in the "modules" "core_course > Activity chooser screen"
57 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"
58
59 Scenario: View recommended activities
60 When I log out
61 And I log in as "admin"
62 And I am on site homepage
63 And I navigate to "Courses > Activity chooser > Recommended activities" in site administration
64 And I click on ".activity-recommend-checkbox" "css_element" in the "Book" "table_row"
65 # Setup done, lets check it works with a teacher.
66 And I log out
67 And I log in as "teacher"
68 And I am on "Course" course homepage with editing mode on
69 And I open the activity chooser
70 Then I should see "Recommended" in the "Add an activity or resource" "dialogue"
71 And I click on "Recommended" "link" in the "Add an activity or resource" "dialogue"
72 And I should see "Book" in the "recommended" "core_course > Activity chooser tab"
73
74 Scenario: Favourite a module in the activity chooser
75 Given I open the activity chooser
76 And I should not see "Starred" in the "Add an activity or resource" "dialogue"
77 And I click on "Star Assignment activity" "button" in the "Add an activity or resource" "dialogue"
78 And I should see "Starred" in the "Add an activity or resource" "dialogue"
79 When I click on "Starred" "link" in the "Add an activity or resource" "dialogue"
80 Then I should see "Assignment" in the "favourites" "core_course > Activity chooser tab"
81 And I click on "Information about the Assignment activity" "button" in the "favourites" "core_course > Activity chooser tab"
82 And I should see "The assignment activity module enables a teacher to communicate tasks, collect work and provide grades and feedback."
83
84 Scenario: Add a favourite module and check it exists when reopening the chooser
85 Given I open the activity chooser
86 And I click on "Star Assignment activity" "button" in the "Add an activity or resource" "dialogue"
87 And I click on "Star Forum activity" "button" in the "Add an activity or resource" "dialogue"
88 And I should see "Starred" in the "Add an activity or resource" "dialogue"
89 And I click on "Close" "button" in the "Add an activity or resource" "dialogue"
90 When I click on "Add an activity or resource" "button" in the "Topic 3" "section"
91 And I click on "Starred" "link" in the "Add an activity or resource" "dialogue"
92 Then I should see "Forum" in the "favourites" "core_course > Activity chooser tab"
93
94 Scenario: Add a favourite and then remove it whilst checking the tabs work as expected
95 Given I open the activity chooser
96 And I click on "Star Assignment activity" "button" in the "Add an activity or resource" "dialogue"
97 And I click on "Starred" "link" in the "Add an activity or resource" "dialogue"
98 And I click on "Star Assignment activity" "button" in the "Add an activity or resource" "dialogue"
99 Then I should not see "Starred" in the "Add an activity or resource" "dialogue"
100
101 Scenario: The teacher can search for an activity by it's name
102 Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
103 When I set the field "search" to "Lesson"
104 Then I should see "1 results found" in the "Add an activity or resource" "dialogue"
105 And I should see "Lesson" in the "Add an activity or resource" "dialogue"
106
107 Scenario: The teacher can search for an activity by it's description
108 Given I open the activity chooser
109 When I set the field "search" to "The lesson activity module enables a teacher to deliver content"
110 Then I should see "1 results found" in the "Add an activity or resource" "dialogue"
111 And I should see "Lesson" in the "Add an activity or resource" "dialogue"
112
113 Scenario: Search results are not returned if the search query does not match any activity name or description
114 Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
115 When I set the field "search" to "Random search query"
116 Then I should see "0 results found" in the "Add an activity or resource" "dialogue"
117 And ".option" "css_element" should not exist in the ".searchresultitemscontainer" "css_element"
118
119 Scenario: Teacher can return to the default activity chooser state by manually removing the search query
120 Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
121 And I set the field "search" to "Lesson"
122 And I should see "1 results found" in the "Add an activity or resource" "dialogue"
123 And I should see "Lesson" in the "Add an activity or resource" "dialogue"
124 When I set the field "search" to ""
125 And I should not see "1 results found" in the "Add an activity or resource" "dialogue"
126 Then ".searchresultscontainer" "css_element" should not be visible
127 And ".optionscontainer" "css_element" should exist
128
129 Scenario: Teacher can not see a "clear" button if a search query is not entered in the activity chooser search bar
130 When I click on "Add an activity or resource" "button" in the "Topic 1" "section"
131 Then "Clear search input" "button" should not be visible
132
133 Scenario: Teacher can see a "clear" button after entering a search query in the activity chooser search bar
134 Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
135 When I set the field "search" to "Search query"
136 Then "Clear search input" "button" should not be visible
137
138 Scenario: Teacher can not see a "clear" button if the search query is removed in the activity chooser search bar
139 Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
140 And I set the field "search" to "Search query"
141 And "Clear search input" "button" should exist
142 When I set the field "search" to ""
143 # Waiting for the animation to hide the button to finish.
144 And I wait "1" seconds
145 Then "Clear search input" "button" should not be visible
146
147 Scenario: Teacher can instantly remove the search query from the activity search bar by clicking on the "clear" button
148 Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
149 And I set the field "search" to "Search query"
150 And I should see "results found" in the "Add an activity or resource" "dialogue"
151 When I click on "Clear search input" "button"
152 Then I should not see "Search query"
153 And ".searchresultscontainer" "css_element" should not be visible
154 And ".optionscontainer" "css_element" should exist
155
156 Scenario: Teacher gets the base case for the Activity Chooser tab mode
157 Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
158 And I should see "Activities" in the "Add an activity or resource" "dialogue"
159 When I click on "Activities" "link" in the "Add an activity or resource" "dialogue"
160 Then I should not see "Book" in the "activity" "core_course > Activity chooser tab"
161 And I click on "Resources" "link" in the "Add an activity or resource" "dialogue"
162 And I should not see "Assignment" in the "resources" "core_course > Activity chooser tab"
163
164 Scenario: Teacher gets the simple case for the Activity Chooser tab mode
165 Given I log out
166 And I log in as "admin"
167 And I am on site homepage
168 When I navigate to "Courses > Activity chooser > Activity chooser settings" in site administration
169 And I select "Starred, All, Recommended" from the "Activity chooser tabs" singleselect
170 And I press "Save changes"
171 And I log out
172 And I log in as "teacher"
173 And I am on "Course" course homepage with editing mode on
174 And I click on "Add an activity or resource" "button" in the "Topic 1" "section"
175 Then I should not see "Activities" in the "Add an activity or resource" "dialogue"
176 And I should not see "Resources" in the "Add an activity or resource" "dialogue"
177
178 Scenario: Teacher gets the final case for the Activity Chooser tab mode
179 Given I log out
180 And I log in as "admin"
181 And I am on site homepage
182 When I navigate to "Courses > Activity chooser > Activity chooser settings" in site administration
183 And I select "Starred, Activities, Resources, Recommended" from the "Activity chooser tabs" singleselect
184 And I press "Save changes"
185 And I log out
186 And I log in as "teacher"
187 And I am on "Course" course homepage with editing mode on
188 And I click on "Add an activity or resource" "button" in the "Topic 1" "section"
189 Then I should not see "All" in the "Add an activity or resource" "dialogue"
190 And I should see "Activities" in the "Add an activity or resource" "dialogue"
191 And I should see "Resources" in the "Add an activity or resource" "dialogue"