/admin/tool/usertours/tests/behat/tour_filter.feature

https://github.com/markn86/moodle · Gherkin Specification · 229 lines · 223 code · 6 blank · 0 comment · 3 complexity · 2adfe320846cce6fcb6ce8a97902f41f MD5 · raw file

  1. @tool @tool_usertours
  2. Feature: Apply tour filters to a tour
  3. In order to give more directed tours
  4. As an administrator
  5. I need to create a user tour with filters applied
  6. @javascript
  7. Scenario: Add a tour for a specific role
  8. Given the following "courses" exist:
  9. | fullname | shortname | format | enablecompletion |
  10. | Course 1 | C1 | topics | 1 |
  11. And the following "users" exist:
  12. | username |
  13. | editor1 |
  14. | teacher1 |
  15. | student1 |
  16. And the following "course enrolments" exist:
  17. | user | course | role |
  18. | editor1 | C1 | editingteacher |
  19. | teacher1 | C1 | teacher |
  20. | student1 | C1 | student |
  21. And I log in as "admin"
  22. And I add a new user tour with:
  23. | Name | First tour |
  24. | Description | My first tour |
  25. | Apply to URL match | /course/view.php% |
  26. | Tour is enabled | 1 |
  27. | Role | Student,Non-editing teacher |
  28. And I add steps to the "First tour" tour:
  29. | targettype | Title | Content |
  30. | Display in middle of page | Welcome | Welcome to your course tour.|
  31. And I log out
  32. And I log in as "editor1"
  33. When I am on "Course 1" course homepage
  34. Then I should not see "Welcome to your course tour."
  35. And I log out
  36. And I log in as "student1"
  37. And I am on "Course 1" course homepage
  38. And I should see "Welcome to your course tour."
  39. And I click on "Got it!" "button"
  40. And I log out
  41. And I log in as "teacher1"
  42. And I am on "Course 1" course homepage
  43. And I should see "Welcome to your course tour."
  44. @javascript
  45. Scenario: Add tour for a specific category and its subcategory
  46. Given the following "categories" exist:
  47. | name | category | idnumber |
  48. | MainCat | 0 | CAT1 |
  49. | SubCat | CAT1 | CAT2 |
  50. And the following "courses" exist:
  51. | fullname | shortname | category |
  52. | Course 1 | C1 | CAT1 |
  53. | Course 2 | C2 | CAT2 |
  54. And the following "users" exist:
  55. | username |
  56. | student1 |
  57. And the following "course enrolments" exist:
  58. | user | course | role |
  59. | student1 | C1 | student |
  60. | student1 | C2 | student |
  61. And I log in as "admin"
  62. And I add a new user tour with:
  63. | Name | First tour |
  64. | Description | My first tour |
  65. | Apply to URL match | /course/view.php% |
  66. | Tour is enabled | 1 |
  67. | Category | MainCat |
  68. And I add steps to the "First tour" tour:
  69. | targettype | Title | Content |
  70. | Display in middle of page | Welcome | Welcome to your course tour.|
  71. And I log out
  72. And I log in as "student1"
  73. When I am on "Course 1" course homepage
  74. And I wait until the page is ready
  75. Then I should see "Welcome to your course tour."
  76. When I am on "Course 2" course homepage
  77. And I wait until the page is ready
  78. Then I should see "Welcome to your course tour."
  79. @javascript
  80. Scenario: Add tour for a specific courseformat
  81. Given the following "courses" exist:
  82. | fullname | shortname | format |
  83. | Course 1 | C1 | topics |
  84. | Course 2 | C2 | weeks |
  85. And the following "users" exist:
  86. | username |
  87. | student1 |
  88. And the following "course enrolments" exist:
  89. | user | course | role |
  90. | student1 | C1 | student |
  91. | student1 | C2 | student |
  92. And I log in as "admin"
  93. And I add a new user tour with:
  94. | Name | First tour |
  95. | Description | My first tour |
  96. | Apply to URL match | /course/view.php% |
  97. | Tour is enabled | 1 |
  98. | Course format | Weekly format |
  99. And I add steps to the "First tour" tour:
  100. | targettype | Title | Content |
  101. | Display in middle of page | Welcome | Welcome to your course tour.|
  102. And I log out
  103. And I log in as "student1"
  104. When I am on "Course 1" course homepage
  105. And I wait until the page is ready
  106. Then I should not see "Welcome to your course tour."
  107. When I am on "Course 2" course homepage
  108. And I wait until the page is ready
  109. Then I should see "Welcome to your course tour."
  110. @javascript
  111. Scenario: Add tour for a specific course
  112. Given the following "courses" exist:
  113. | fullname | shortname | format |
  114. | Course 1 | C1 | topics |
  115. | Course 2 | C2 | weeks |
  116. And the following "users" exist:
  117. | username |
  118. | student1 |
  119. And the following "course enrolments" exist:
  120. | user | course | role |
  121. | student1 | C1 | student |
  122. | student1 | C2 | student |
  123. And I log in as "admin"
  124. And I add a new user tour with:
  125. | Name | First tour |
  126. | Description | My first tour |
  127. | Apply to URL match | /course/view.php% |
  128. | Tour is enabled | 1 |
  129. | Courses | C1 |
  130. And I add steps to the "First tour" tour:
  131. | targettype | Title | Content |
  132. | Display in middle of page | Welcome | Welcome to your course tour.|
  133. And I log out
  134. And I log in as "student1"
  135. When I am on "Course 1" course homepage
  136. And I wait until the page is ready
  137. Then I should see "Welcome to your course tour."
  138. When I am on "Course 2" course homepage
  139. And I wait until the page is ready
  140. Then I should not see "Welcome to your course tour."
  141. @javascript
  142. Scenario: Add tours with CSS selectors
  143. Given the following "users" exist:
  144. | username | firstname | lastname | email |
  145. | student1 | Student | 1 | student1@example.com |
  146. Given the following "courses" exist:
  147. | fullname | shortname | format | enablecompletion |
  148. | Course 1 | C1 | topics | 1 |
  149. | Course 2 | C2 | topics | 1 |
  150. And I log in as "admin"
  151. And I am on "Course 1" course homepage with editing mode on
  152. And I add a "Wiki" to section "1" and I fill the form with:
  153. | Wiki name | Test wiki name |
  154. | Description | Test wiki description |
  155. | First page name | First page |
  156. | Wiki mode | Collaborative wiki |
  157. And I am on "Course 2" course homepage
  158. And I add a "Forum" to section "1" and I fill the form with:
  159. | Forum name | Test forum name |
  160. | Forum type | Standard forum for general use |
  161. | Description | Test forum description |
  162. And I add a new user tour with:
  163. | Name | Wiki tour |
  164. | Description | A tour with both matches |
  165. | Apply to URL match | /course/view.php% |
  166. | Tour is enabled | 1 |
  167. | CSS selector | .modtype_wiki |
  168. And I add steps to the "Wiki tour" tour:
  169. | targettype | Title | Content |
  170. | Display in middle of page | Welcome | Welcome to the Wiki tour |
  171. And I add a new user tour with:
  172. | Name | Forum tour |
  173. | Description | A tour with both matches |
  174. | Apply to URL match | /course/view.php% |
  175. | Tour is enabled | 1 |
  176. | CSS selector | .modtype_forum |
  177. And I add steps to the "Forum tour" tour:
  178. | targettype | Title | Content |
  179. | Display in middle of page | Welcome | Welcome to the Forum tour |
  180. And I am on "Course 1" course homepage
  181. Then I should see "Welcome to the Wiki tour"
  182. And I am on "Course 2" course homepage
  183. Then I should see "Welcome to the Forum tour"
  184. @javascript
  185. Scenario: Check filtering respects the sort order
  186. Given the following "users" exist:
  187. | username | firstname | lastname | email |
  188. | student1 | Student | 1 | student1@example.com |
  189. And I log in as "admin"
  190. And I add a new user tour with:
  191. | Name | First tour |
  192. | Description | The first tour |
  193. | Apply to URL match | /my/% |
  194. | Tour is enabled | 1 |
  195. | CSS selector | #page-my-index |
  196. And I add steps to the "First tour" tour:
  197. | targettype | Title | Content |
  198. | Display in middle of page | Welcome | Welcome to the First tour |
  199. And I add a new user tour with:
  200. | Name | Second tour |
  201. | Description | The second tour |
  202. | Apply to URL match | /my/% |
  203. | Tour is enabled | 0 |
  204. | CSS selector | #page-my-index |
  205. And I add steps to the "Second tour" tour:
  206. | targettype | Title | Content |
  207. | Display in middle of page | Welcome | Welcome to the Second tour |
  208. And I add a new user tour with:
  209. | Name | Third tour |
  210. | Description | The third tour |
  211. | Apply to URL match | /my/% |
  212. | Tour is enabled | 1 |
  213. | CSS selector | #page-my-index |
  214. And I add steps to the "Third tour" tour:
  215. | targettype | Title | Content |
  216. | Display in middle of page | Welcome | Welcome to the Third tour |
  217. And I am on homepage
  218. Then I should see "Welcome to the First tour"
  219. And I open the User tour settings page
  220. And I click on "Move tour down" "link" in the "The first tour" "table_row"
  221. And I click on "Move tour down" "link" in the "The first tour" "table_row"
  222. And I am on homepage
  223. Then I should see "Welcome to the Third tour"