/course/tests/behat/activities_visibility_icons.feature

https://github.com/markn86/moodle · Gherkin Specification · 180 lines · 170 code · 3 blank · 7 comment · 5 complexity · 263d88b6bee0f8df88ad25acdb68c5e1 MD5 · raw file

  1. @core @core_course @_cross_browser
  2. Feature: Toggle activities visibility from the course page
  3. In order to delay activities availability
  4. As a teacher
  5. I need to quickly change the visibility of an activity
  6. @javascript
  7. Scenario: Hide/Show toggle with javascript enabled
  8. Given the following "users" exist:
  9. | username | firstname | lastname | email |
  10. | teacher1 | Teacher | 1 | teacher1@example.com |
  11. | student1 | Student | 1 | student1@example.com |
  12. And the following "courses" exist:
  13. | fullname | shortname | format |
  14. | Course 1 | C1 | topics |
  15. And the following "course enrolments" exist:
  16. | user | course | role |
  17. | teacher1 | C1 | editingteacher |
  18. | student1 | C1 | student |
  19. And the following "activity" exists:
  20. | activity | forum |
  21. | course | C1 |
  22. | idnumber | C1F1 |
  23. | name | Test forum name |
  24. | intro | Test forum description |
  25. | visible | 1 |
  26. And I log in as "teacher1"
  27. And I am on "Course 1" course homepage with editing mode on
  28. When I open "Test forum name" actions menu
  29. Then "Test forum name" actions menu should not have "Show" item
  30. And "Test forum name" actions menu should not have "Make available" item
  31. And "Test forum name" actions menu should not have "Make unavailable" item
  32. And I click on "Hide" "link" in the "Test forum name" activity
  33. And "Test forum name" activity should be hidden
  34. And I open "Test forum name" actions menu
  35. And "Test forum name" actions menu should not have "Hide" item
  36. # Stealth behaviour is not available by default:
  37. And "Test forum name" actions menu should not have "Make available" item
  38. And "Test forum name" actions menu should not have "Make unavailable" item
  39. And I click on "Show" "link" in the "Test forum name" activity
  40. And "Test forum name" activity should be visible
  41. And I open "Test forum name" actions menu
  42. And "Test forum name" actions menu should not have "Show" item
  43. And "Test forum name" actions menu should not have "Make available" item
  44. And "Test forum name" actions menu should not have "Make unavailable" item
  45. And I click on "Hide" "link" in the "Test forum name" activity
  46. And "Test forum name" activity should be hidden
  47. And I reload the page
  48. And "Test forum name" activity should be hidden
  49. # Make sure that "Availability" dropdown in the edit menu has two options: Show/Hide.
  50. And I open "Test forum name" actions menu
  51. And I click on "Edit settings" "link" in the "Test forum name" activity
  52. And I expand all fieldsets
  53. And the "Availability" select box should contain "Show on course page"
  54. And the "Availability" select box should not contain "Make available but not shown on course page"
  55. And the field "Availability" matches value "Hide from students"
  56. And I press "Save and return to course"
  57. And "Test forum name" activity should be hidden
  58. And I turn editing mode off
  59. And "Test forum name" activity should be hidden
  60. And I log out
  61. # Student should not see this activity.
  62. And I log in as "student1"
  63. And I am on "Course 1" course homepage
  64. And I should not see "Test forum name"
  65. @javascript
  66. Scenario: Activities can be made available and unavailable inside a hidden section
  67. Given the following "users" exist:
  68. | username | firstname | lastname | email |
  69. | teacher1 | Teacher | 1 | teacher1@example.com |
  70. | student1 | Student | 1 | student1@example.com |
  71. And the following "courses" exist:
  72. | fullname | shortname | format | numsections |
  73. | Course 1 | C1 | topics | 2 |
  74. And the following "course enrolments" exist:
  75. | user | course | role |
  76. | teacher1 | C1 | editingteacher |
  77. | student1 | C1 | student |
  78. And the following "activity" exists:
  79. | activity | forum |
  80. | course | C1 |
  81. | idnumber | C1F1 |
  82. | section | 2 |
  83. | name | Test forum name |
  84. | intro | Test forum description |
  85. | visible | 1 |
  86. And I log in as "teacher1"
  87. And I am on "Course 1" course homepage with editing mode on
  88. And I add the "Recent activity" block
  89. When I hide section "2"
  90. Then "Test forum name" activity should be hidden
  91. And I open "Test forum name" actions menu
  92. And "Test forum name" actions menu should not have "Show" item
  93. And "Test forum name" actions menu should not have "Hide" item
  94. And "Test forum name" actions menu should not have "Make unavailable" item
  95. And I click on "Make available" "link" in the "Test forum name" activity
  96. And "Test forum name" activity should be available but hidden from course page
  97. And I open "Test forum name" actions menu
  98. And "Test forum name" actions menu should not have "Show" item
  99. And "Test forum name" actions menu should not have "Hide" item
  100. And "Test forum name" actions menu should not have "Make available" item
  101. And I click on "Make unavailable" "link" in the "Test forum name" activity
  102. And "Test forum name" activity should be hidden
  103. # Make sure that "Availability" dropdown in the edit menu has three options.
  104. And I open "Test forum name" actions menu
  105. And I click on "Edit settings" "link" in the "Test forum name" activity
  106. And I expand all fieldsets
  107. And the "Availability" select box should contain "Hide from students"
  108. And the "Availability" select box should contain "Make available but not shown on course page"
  109. And the "Availability" select box should not contain "Show on course page"
  110. And I set the field "Availability" to "Make available but not shown on course page"
  111. And I press "Save and return to course"
  112. And "Test forum name" activity should be available but hidden from course page
  113. And I turn editing mode off
  114. And "Test forum name" activity should be available but hidden from course page
  115. And I log out
  116. # Student will not see the module on the course page but can access it from other reports and blocks:
  117. And I log in as "student1"
  118. And I am on "Course 1" course homepage
  119. And "Test forum name" activity should be hidden
  120. And I click on "Test forum name" "link" in the "Recent activity" "block"
  121. And I should see "Test forum name"
  122. And I should see "(There are no discussion topics yet in this forum)"
  123. @javascript
  124. Scenario: Activities can be made available but not visible on a course page
  125. Given the following "users" exist:
  126. | username | firstname | lastname | email |
  127. | teacher1 | Teacher | 1 | teacher1@example.com |
  128. | student1 | Student | 1 | student1@example.com |
  129. And the following "courses" exist:
  130. | fullname | shortname | format | numsections |
  131. | Course 1 | C1 | topics | 2 |
  132. And the following "course enrolments" exist:
  133. | user | course | role |
  134. | teacher1 | C1 | editingteacher |
  135. | student1 | C1 | student |
  136. And the following config values are set as admin:
  137. | allowstealth | 1 |
  138. And I log in as "teacher1"
  139. And I am on "Course 1" course homepage with editing mode on
  140. And I add the "Recent activity" block
  141. And I add a "Assignment" to section "2" and I fill the form with:
  142. | Assignment name | Test assignment name |
  143. | Description | Test assignment description |
  144. | Availability | Show on course page |
  145. When I open "Test assignment name" actions menu
  146. Then "Test assignment name" actions menu should not have "Show" item
  147. And "Test assignment name" actions menu should have "Hide" item
  148. And "Test assignment name" actions menu should not have "Make available" item
  149. And "Test assignment name" actions menu should not have "Make unavailable" item
  150. And I click on "Hide" "link" in the "Test assignment name" activity
  151. And "Test assignment name" activity should be hidden
  152. And I open "Test assignment name" actions menu
  153. And "Test assignment name" actions menu should have "Show" item
  154. And "Test assignment name" actions menu should not have "Hide" item
  155. And "Test assignment name" actions menu should not have "Make unavailable" item
  156. And I click on "Make available" "link" in the "Test assignment name" activity
  157. And "Test assignment name" activity should be available but hidden from course page
  158. # Make sure that "Availability" dropdown in the edit menu has three options.
  159. And I open "Test assignment name" actions menu
  160. And I click on "Edit settings" "link" in the "Test assignment name" activity
  161. And I expand all fieldsets
  162. And the "Availability" select box should contain "Show on course page"
  163. And the "Availability" select box should contain "Hide from students"
  164. And the field "Availability" matches value "Make available but not shown on course page"
  165. And I press "Save and return to course"
  166. And "Test assignment name" activity should be available but hidden from course page
  167. And I turn editing mode off
  168. And "Test assignment name" activity should be available but hidden from course page
  169. And I log out
  170. # Student will not see the module on the course page but can access it from other reports and blocks:
  171. And I log in as "student1"
  172. And I am on "Course 1" course homepage
  173. And "Test assignment name" activity should be hidden
  174. And I click on "Test assignment name" "link" in the "Recent activity" "block"
  175. And I should see "Test assignment name"
  176. And I should see "Submission status"
  177. And I log out