/mod/assign/tests/behat/assign_group_override.feature

https://github.com/sbourget/moodle · Gherkin Specification · 239 lines · 228 code · 11 blank · 0 comment · 13 complexity · 8f78d2594bde1614d7948af5b3cb7f5b MD5 · raw file

  1. @mod @mod_assign
  2. Feature: Assign group override
  3. In order to grant a group special access to an assignment
  4. As a teacher
  5. I need to create an override for that group.
  6. Background:
  7. Given the following "users" exist:
  8. | username | firstname | lastname | email |
  9. | teacher1 | Tina | Teacher1 | teacher1@example.com |
  10. | student1 | Sam1 | Student1 | student1@example.com |
  11. | student2 | Sam2 | Student2 | student2@example.com |
  12. | student3 | Sam3 | Student3 | student3@example.com |
  13. And the following "courses" exist:
  14. | fullname | shortname | category |
  15. | Course 1 | C1 | 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. | student3 | C1 | student |
  22. And the following "groups" exist:
  23. | name | course | idnumber |
  24. | Group 1 | C1 | G1 |
  25. | Group 2 | C1 | G2 |
  26. Given the following "group members" exist:
  27. | user | group |
  28. | student1 | G1 |
  29. | student2 | G2 |
  30. | student3 | G1 |
  31. And the following "activities" exist:
  32. | activity | name | intro | course | assignsubmission_onlinetext_enabled |
  33. | assign | Test assignment name | Submit your online text | C1 | 1 |
  34. Scenario: Add, modify then delete a group override
  35. Given I am on the "Test assignment name" Activity page logged in as teacher1
  36. When I navigate to "Overrides" in current page administration
  37. And I select "Group overrides" from the "jump" singleselect
  38. And I press "Add group override"
  39. And I set the following fields to these values:
  40. | Override group | Group 1 |
  41. | Due date | ##1 Jan 2020 08:00## |
  42. And I press "Save"
  43. Then I should see "Wednesday, 1 January 2020, 8:00"
  44. And I click on "Edit" "link" in the "Group 1" "table_row"
  45. And I set the following fields to these values:
  46. | Due date | ##1 Jan 2030 08:00## |
  47. And I press "Save"
  48. And I should see "Tuesday, 1 January 2030, 8:00"
  49. And I click on "Delete" "link"
  50. And I press "Continue"
  51. And I should not see "Group 1"
  52. Scenario: Duplicate a user override
  53. Given I am on the "Test assignment name" Activity page logged in as teacher1
  54. When I navigate to "Overrides" in current page administration
  55. And I select "Group overrides" from the "jump" singleselect
  56. And I press "Add group override"
  57. And I set the following fields to these values:
  58. | Override group | Group 1 |
  59. | Due date | ##1 Jan 2020 08:00## |
  60. And I press "Save"
  61. Then I should see "Wednesday, 1 January 2020, 8:00"
  62. And I click on "copy" "link"
  63. And I set the following fields to these values:
  64. | Override group | Group 2 |
  65. | Due date | ##1 Jan 2030 08:00## |
  66. And I press "Save"
  67. And I should see "Tuesday, 1 January 2030, 8:00"
  68. And I should see "Group 2"
  69. Scenario: Allow a group to have a different due date
  70. Given I am on the "Test assignment name" Activity page logged in as teacher1
  71. When I navigate to "Settings" in current page administration
  72. And I set the following fields to these values:
  73. | Allow submissions from | disabled |
  74. | Due date | ##1 Jan 2000 08:00## |
  75. | Cut-off date | disabled |
  76. And I press "Save and display"
  77. And I navigate to "Overrides" in current page administration
  78. And I select "Group overrides" from the "jump" singleselect
  79. And I press "Add group override"
  80. And I set the following fields to these values:
  81. | Override group | Group 1 |
  82. | Due date | ##1 Jan 2020 08:00## |
  83. And I press "Save"
  84. And I should see "Wednesday, 1 January 2020, 8:00"
  85. And I log out
  86. And I am on the "Test assignment name" Activity page logged in as student2
  87. Then the activity date in "Test assignment name" should contain "Due: Saturday, 1 January 2000, 8:00"
  88. And I log out
  89. And I am on the "Test assignment name" Activity page logged in as student1
  90. And the activity date in "Test assignment name" should contain "Due: Wednesday, 1 January 2020, 8:00"
  91. Scenario: Allow a group to have a different cut off date
  92. Given I am on the "Test assignment name" Activity page logged in as teacher1
  93. When I navigate to "Settings" in current page administration
  94. And I set the following fields to these values:
  95. | Due date | disabled |
  96. | Allow submissions from | disabled |
  97. | Cut-off date | ##1 Jan 2000 08:00## |
  98. And I press "Save and display"
  99. And I navigate to "Overrides" in current page administration
  100. And I select "Group overrides" from the "jump" singleselect
  101. And I press "Add group override"
  102. And I set the following fields to these values:
  103. | Override group | Group 1 |
  104. | Cut-off date | ##1 Jan 2030 08:00## |
  105. And I press "Save"
  106. And I should see "Tuesday, 1 January 2030, 8:00"
  107. And I log out
  108. And I am on the "Test assignment name" Activity page logged in as student2
  109. Then I should not see "You have not made a submission yet."
  110. And I log out
  111. And I am on the "Test assignment name" Activity page logged in as student1
  112. And I should see "No submissions have been made yet"
  113. Scenario: Allow a group to have a different start date
  114. Given I am on the "Test assignment name" Activity page logged in as teacher1
  115. When I navigate to "Settings" in current page administration
  116. And I set the following fields to these values:
  117. | Due date | disabled |
  118. | Allow submissions from | ##1 January 2030 08:00## |
  119. | Cut-off date | disabled |
  120. And I press "Save and display"
  121. And I navigate to "Overrides" in current page administration
  122. And I select "Group overrides" from the "jump" singleselect
  123. And I press "Add group override"
  124. And I set the following fields to these values:
  125. | Override group | Group 1 |
  126. | Allow submissions from | ##1 Jan 2015 08:00## |
  127. And I press "Save"
  128. And I should see "Thursday, 1 January 2015, 8:00"
  129. And I log out
  130. And I am on the "Test assignment name" Activity page logged in as student2
  131. Then the activity date in "Test assignment name" should contain "Opens: Tuesday, 1 January 2030, 8:00"
  132. And I should not see "Add submission"
  133. And I log out
  134. And I am on the "Test assignment name" Activity page logged in as student1
  135. And I should not see "Tuesday, 1 January 2030, 8:00"
  136. @javascript
  137. Scenario: Add both a user and group override and verify that both are applied correctly
  138. Given I am on the "Test assignment name" Activity page logged in as teacher1
  139. When I navigate to "Settings" in current page administration
  140. And I set the following fields to these values:
  141. | Due date | disabled |
  142. | Allow submissions from | ##1 January 2040 08:00## |
  143. | Cut-off date | disabled |
  144. | Group mode | Visible groups |
  145. And I press "Save and display"
  146. And I navigate to "Overrides" in current page administration
  147. And I select "Group overrides" from the "jump" singleselect
  148. And I press "Add group override"
  149. And I set the following fields to these values:
  150. | Override group | Group 1 |
  151. | Allow submissions from | ##1 January 2030 08:00## |
  152. And I press "Save"
  153. And I should see "Tuesday, 1 January 2030, 8:00"
  154. And I am on the "Test assignment name" Activity page
  155. And I navigate to "Overrides" in current page administration
  156. And I press "Add user override"
  157. And I set the following fields to these values:
  158. | Override user | Student1 |
  159. | Allow submissions from | ##1 January 2031 08:00## |
  160. And I press "Save"
  161. And I should see "Wednesday, 1 January 2031, 8:00"
  162. And I log out
  163. And I am on the "Test assignment name" Activity page logged in as student1
  164. And the activity date in "Test assignment name" should contain "Opens: Wednesday, 1 January 2031, 8:00"
  165. And I log out
  166. And I am on the "Test assignment name" Activity page logged in as student2
  167. And the activity date in "Test assignment name" should contain "Opens: Sunday, 1 January 2040, 8:00"
  168. And I log out
  169. And I am on the "Test assignment name" Activity page logged in as student3
  170. And the activity date in "Test assignment name" should contain "Opens: Tuesday, 1 January 2030, 8:00"
  171. Scenario: Override a group when teacher is in no group, and does not have accessallgroups permission, and the activity's group mode is "separate groups"
  172. Given the following "permission overrides" exist:
  173. | capability | permission | role | contextlevel | reference |
  174. | moodle/site:accessallgroups | Prevent | editingteacher | Course | C1 |
  175. And the following "activities" exist:
  176. | activity | name | intro | course | groupmode |
  177. | assign | Assignment 2 | Assignment 2 description | C1 | 1 |
  178. And I am on the "Assignment 2" Activity page logged in as teacher1
  179. When I navigate to "Overrides" in current page administration
  180. And I select "Group overrides" from the "jump" singleselect
  181. Then I should see "No groups you can access."
  182. And the "Add group override" "button" should be disabled
  183. Scenario: A teacher without accessallgroups permission should only be able to add group override for groups that he/she is a member of,
  184. when the activity's group mode is "separate groups"
  185. Given the following "permission overrides" exist:
  186. | capability | permission | role | contextlevel | reference |
  187. | moodle/site:accessallgroups | Prevent | editingteacher | Course | C1 |
  188. And the following "activities" exist:
  189. | activity | name | intro | course | groupmode |
  190. | assign | Assignment 2 | Assignment 2 description | C1 | 1 |
  191. And the following "group members" exist:
  192. | user | group |
  193. | teacher1 | G1 |
  194. And I am on the "Assignment 2" Activity page logged in as teacher1
  195. When I navigate to "Overrides" in current page administration
  196. And I select "Group overrides" from the "jump" singleselect
  197. And I press "Add group override"
  198. Then the "Override group" select box should contain "Group 1"
  199. And the "Override group" select box should not contain "Group 2"
  200. Scenario: A teacher without accessallgroups permission should only be able to see the group overrides for groups that he/she is a member of,
  201. when the activity's group mode is "separate groups"
  202. Given the following "permission overrides" exist:
  203. | capability | permission | role | contextlevel | reference |
  204. | moodle/site:accessallgroups | Prevent | editingteacher | Course | C1 |
  205. And the following "activities" exist:
  206. | activity | name | intro | course | groupmode |
  207. | assign | Assignment 2 | Assignment 2 description | C1 | 1 |
  208. And the following "group members" exist:
  209. | user | group |
  210. | teacher1 | G1 |
  211. And I am on the "Assignment 2" Activity page logged in as admin
  212. And I navigate to "Overrides" in current page administration
  213. And I select "Group overrides" from the "jump" singleselect
  214. And I press "Add group override"
  215. And I set the following fields to these values:
  216. | Override group | Group 1 |
  217. | Allow submissions from | ##1 January 2020 08:00## |
  218. And I press "Save and enter another override"
  219. And I set the following fields to these values:
  220. | Override group | Group 2 |
  221. | Allow submissions from | ##1 January 2020 08:00## |
  222. And I press "Save"
  223. And I log out
  224. When I am on the "Assignment 2" Activity page logged in as teacher1
  225. And I navigate to "Overrides" in current page administration
  226. And I select "Group overrides" from the "jump" singleselect
  227. Then I should see "Group 1" in the ".generaltable" "css_element"
  228. And I should not see "Group 2" in the ".generaltable" "css_element"