PageRenderTime 43ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/mod/forum/report/summary/tests/behat/summary_filter_groups.feature

https://github.com/mackensen/moodle
Gherkin Specification | 240 lines | 218 code | 7 blank | 15 comment | 3 complexity | 8e9e8cbb01a6c3db2d129c1a603c4669 MD5 | raw file
  1. @mod @mod_forum @forumreport @forumreport_summary
  2. Feature: Groups report filter is available if groups exist
  3. In order to retrieve targeted forum data
  4. As a teacher
  5. I can filter the forum summary report by groups of users
  6. Background:
  7. Given the following "users" exist:
  8. | username | firstname | lastname | email |
  9. | teacher1 | Teacher | 1 | teacher1@example.com |
  10. | student1 | Student | 1 | student1@example.com |
  11. | student2 | Student | 2 | student1@example.com |
  12. And the following "courses" exist:
  13. | fullname | shortname | category |
  14. | Course 1 | C1 | 0 |
  15. | Course 2 | C2 | 0 |
  16. And the following "course enrolments" exist:
  17. | user | course | role |
  18. | teacher1 | C1 | editingteacher |
  19. | student1 | C1 | student |
  20. | student2 | C1 | student |
  21. | teacher1 | C2 | editingteacher |
  22. And the following "groups" exist:
  23. | name | course | idnumber |
  24. | Group A | C1 | G1 |
  25. | Group B | C1 | G2 |
  26. | Group C | C1 | G3 |
  27. | Group D | C1 | G4 |
  28. | Group E | C2 | G5 |
  29. And the following "group members" exist:
  30. | user | group |
  31. | teacher1 | G1 |
  32. | teacher1 | G2 |
  33. | teacher1 | G3 |
  34. | student1 | G3 |
  35. And the following "activities" exist:
  36. | activity | name | description | course | idnumber | groupmode |
  37. | forum | forum1 | C1 first forum | C1 | c1forum1 | 1 |
  38. | forum | forum2 | C1 second forum | C1 | c1forum2 | 2 |
  39. | forum | forum1 | C2 first forum | C2 | c2forum1 | 0 |
  40. And the following forum discussions exist in course "Course 1":
  41. | user | forum | name | message | group | created |
  42. | teacher1 | forum1 | discussion1 | D1 message | G1 | ## 1 month ago ## |
  43. | teacher1 | forum1 | discussion2 | D2 message | G2 | ## 1 week ago ## |
  44. | teacher1 | forum2 | discussion3 | D3 message | G1 | ## 6 days ago ## |
  45. | teacher1 | forum2 | discussion4 | D4 message | G4 | ## 5 days ago ## |
  46. | teacher1 | forum2 | discussion5 | D5 message | All participants | ## 4 days ago ## |
  47. | student1 | forum1 | discussion6 | D6 message | G3 | ## 3 days ago ## |
  48. | student2 | forum2 | discussion7 | D7 message | All participants | ## 2 days ago ## |
  49. And the following forum replies exist in course "Course 1":
  50. | user | forum | discussion | message | created |
  51. | teacher1 | forum1 | discussion1 | D1 reply | ## 3 weeks ago ## |
  52. | teacher1 | forum2 | discussion3 | D3 reply | ## 4 days ago ## |
  53. | teacher1 | forum1 | discussion6 | D6 reply | ## 2 days ago ## |
  54. | student1 | forum1 | discussion6 | D6 reply 2 | ## 2 days ago ## |
  55. | student2 | forum2 | discussion4 | D4 reply | ## 4 days ago ## |
  56. | student2 | forum2 | discussion5 | D5 reply | ## 3 days ago ## |
  57. And the following forum discussions exist in course "Course 2":
  58. | user | forum | name | message | created |
  59. | teacher1 | forum1 | discussion1 | D1 other course | ## 1 week ago ## |
  60. | teacher1 | forum1 | discussion2 | D2 other course | ## 4 days ago ## |
  61. @javascript
  62. Scenario: All groups can be selected or cleared together in the groups filter, and are unchecked by default
  63. When I am on the "c1forum1" "forum activity" page logged in as teacher1
  64. And I navigate to "Reports" in current page administration
  65. Then "Groups" "button" should exist
  66. And the following should exist in the "forumreport_summary_table" table:
  67. # | | Discussions | Replies |
  68. | First name / Surname | -3- | -4- |
  69. | Student 1 | 1 | 1 |
  70. | Student 2 | 0 | 0 |
  71. | Teacher 1 | 2 | 2 |
  72. And I click on "Groups" "button"
  73. And "Group A" "checkbox" should exist in the "filter-groups-popover" "region"
  74. And "Group B" "checkbox" should exist in the "filter-groups-popover" "region"
  75. And "Group C" "checkbox" should exist in the "filter-groups-popover" "region"
  76. And "Group D" "checkbox" should exist in the "filter-groups-popover" "region"
  77. And "No groups" "checkbox" should exist in the "filter-groups-popover" "region"
  78. And "Group E" "checkbox" should not exist in the "filter-groups-popover" "region"
  79. And the following fields match these values:
  80. | Group A | 0 |
  81. | Group B | 0 |
  82. | Group C | 0 |
  83. | Group D | 0 |
  84. | No groups | 0 |
  85. And I click on "Select all" "button" in the "filter-groups-popover" "region"
  86. And the following fields match these values:
  87. | Group A | 1 |
  88. | Group B | 1 |
  89. | Group C | 1 |
  90. | Group D | 1 |
  91. | No groups | 1 |
  92. And I click on "Clear" "button" in the "filter-groups-popover" "region"
  93. And the following fields match these values:
  94. | Group A | 0 |
  95. | Group B | 0 |
  96. | Group C | 0 |
  97. | Group D | 0 |
  98. | No groups | 0 |
  99. And I click on "Select all" "button" in the "filter-groups-popover" "region"
  100. And I click on "Save" "button" in the "filter-groups-popover" "region"
  101. And "Groups (all)" "button" should exist
  102. And the following should exist in the "forumreport_summary_table" table:
  103. # | | Discussions | Replies |
  104. | First name / Surname | -3- | -4- |
  105. | Student 1 | 1 | 1 |
  106. | Student 2 | 0 | 0 |
  107. | Teacher 1 | 2 | 2 |
  108. @javascript
  109. Scenario: The summary report can be filtered by a subset of groups, and re-ordering the results retains the filter
  110. When I am on the "c1forum1" "forum activity" page logged in as teacher1
  111. And I navigate to "Reports" in current page administration
  112. Then "Groups" "button" should exist
  113. And the following should exist in the "forumreport_summary_table" table:
  114. # | | Discussions | Replies |
  115. | First name / Surname | -3- | -4- |
  116. | Student 1 | 1 | 1 |
  117. | Student 2 | 0 | 0 |
  118. | Teacher 1 | 2 | 2 |
  119. And I click on "Groups" "button"
  120. And I click on "Clear" "button" in the "filter-groups-popover" "region"
  121. And I click on "Group A" "checkbox" in the "filter-groups-popover" "region"
  122. And I click on "Group C" "checkbox" in the "filter-groups-popover" "region"
  123. And I click on "Group D" "checkbox" in the "filter-groups-popover" "region"
  124. And I click on "Save" "button"
  125. And "Groups (3)" "button" should exist
  126. And the following should exist in the "forumreport_summary_table" table:
  127. # | | Discussions | Replies |
  128. | First name / Surname | -3- | -4- |
  129. | Student 1 | 1 | 1 |
  130. | Teacher 1 | 1 | 2 |
  131. And I should not see "Student 2"
  132. # Ensure re-ordering retains filter.
  133. And I click on "Number of discussions posted" "link"
  134. And "Groups (3)" "button" should exist
  135. And the following should exist in the "forumreport_summary_table" table:
  136. # | | Discussions | Replies |
  137. | First name / Surname | -3- | -4- |
  138. | Student 1 | 1 | 1 |
  139. | Teacher 1 | 1 | 2 |
  140. And I should not see "Student 2"
  141. @javascript
  142. Scenario: The summary report can be filtered as a mixture of groups and no groups
  143. When I am on the "c1forum2" "forum activity" page logged in as teacher1
  144. And I navigate to "Reports" in current page administration
  145. Then "Groups" "button" should exist
  146. And the following should exist in the "forumreport_summary_table" table:
  147. # | | Discussions | Replies |
  148. | First name / Surname | -3- | -4- |
  149. | Student 1 | 0 | 0 |
  150. | Student 2 | 1 | 2 |
  151. | Teacher 1 | 3 | 1 |
  152. And I click on "Groups" "button"
  153. And I click on "Clear" "button" in the "filter-groups-popover" "region"
  154. And I click on "Group A" "checkbox" in the "filter-groups-popover" "region"
  155. And I click on "No groups" "checkbox" in the "filter-groups-popover" "region"
  156. And I click on "Save" "button" in the "filter-groups-popover" "region"
  157. And "Groups (2)" "button" should exist
  158. And the following should exist in the "forumreport_summary_table" table:
  159. # | | Discussions | Replies |
  160. | First name / Surname | -3- | -4- |
  161. | Student 1 | 0 | 0 |
  162. | Student 2 | 1 | 1 |
  163. | Teacher 1 | 2 | 1 |
  164. @javascript
  165. Scenario: The summary report can be filtered by no groups only
  166. When I am on the "c1forum2" "forum activity" page logged in as teacher1
  167. And I navigate to "Reports" in current page administration
  168. Then the following should exist in the "forumreport_summary_table" table:
  169. # | | Discussions | Replies |
  170. | First name / Surname | -3- | -4- |
  171. | Student 1 | 0 | 0 |
  172. | Student 2 | 1 | 2 |
  173. | Teacher 1 | 3 | 1 |
  174. And I click on "Groups" "button"
  175. And I click on "Clear" "button" in the "filter-groups-popover" "region"
  176. And I click on "No groups" "checkbox" in the "filter-groups-popover" "region"
  177. And I click on "Save" "button" in the "filter-groups-popover" "region"
  178. And "Groups (1)" "button" should exist
  179. And the following should exist in the "forumreport_summary_table" table:
  180. # | | Discussions | Replies |
  181. | First name / Surname | -3- | -4- |
  182. | Student 1 | 0 | 0 |
  183. | Student 2 | 1 | 1 |
  184. | Teacher 1 | 1 | 0 |
  185. @javascript
  186. Scenario: Filtering by a group containing no users still allows the page to render
  187. # Log in as admin so Teacher 1 not existing on page can be confirmed.
  188. When I am on the "c1forum1" "forum activity" page logged in as admin
  189. And I navigate to "Reports" in current page administration
  190. Then "Groups" "button" should exist
  191. And the following should exist in the "forumreport_summary_table" table:
  192. # | | Discussions | Replies |
  193. | First name / Surname | -3- | -4- |
  194. | Student 1 | 1 | 1 |
  195. | Student 2 | 0 | 0 |
  196. | Teacher 1 | 2 | 2 |
  197. And I click on "Groups" "button"
  198. And I click on "Clear" "button" in the "filter-groups-popover" "region"
  199. And I click on "Group D" "checkbox" in the "filter-groups-popover" "region"
  200. And I click on "Save" "button" in the "filter-groups-popover" "region"
  201. And "Groups (1)" "button" should exist
  202. And I should see "Nothing to display"
  203. And I should not see "Teacher 1"
  204. And I should not see "Student 1"
  205. And I should not see "Student 2"
  206. And I should not see "With selected users..."
  207. And I should not see "Download table data as"
  208. @javascript
  209. Scenario: Course forum summary report can be filtered by group
  210. When I am on the "c1forum2" "forum activity" page logged in as teacher1
  211. And I navigate to "Reports" in current page administration
  212. And I select "All forums in course" from the "Forum selected" singleselect
  213. And I click on "Groups" "button"
  214. And I click on "Clear" "button" in the "filter-groups-popover" "region"
  215. And I click on "Group A" "checkbox" in the "filter-groups-popover" "region"
  216. And I click on "Group C" "checkbox" in the "filter-groups-popover" "region"
  217. And I click on "Save" "button"
  218. And "Groups (2)" "button" should exist
  219. Then the following should exist in the "forumreport_summary_table" table:
  220. # | | Discussions | Replies |
  221. | First name / Surname | -3- | -4- |
  222. | Student 1 | 1 | 1 |
  223. | Teacher 1 | 2 | 3 |
  224. And I should not see "Student 2"
  225. # Ensure re-ordering retains filter.
  226. And I click on "Number of discussions posted" "link"
  227. And "Groups (2)" "button" should exist
  228. And the following should exist in the "forumreport_summary_table" table:
  229. # | | Discussions | Replies |
  230. | First name / Surname | -3- | -4- |
  231. | Student 1 | 1 | 1 |
  232. | Teacher 1 | 2 | 3 |
  233. And I should not see "Student 2"