Advertisement
rajeshtaneja

phantomjs file_upload

Dec 17th, 2015
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 125.06 KB | None | 0 0
  1. @mod @mod_assign @assignfeedback @assignfeedback_editpdf @_file_upload
  2. Feature: In an assignment, teacher can annotate PDF files during grading
  3. In order to provide visual report on a graded PDF
  4. As a teacher
  5. I need to use the PDF editor
  6.  
  7. @javascript
  8. Scenario: Submit a PDF file as a student and annotate the PDF as a teacher # /home/rajesh/moodles/integration/moodle/mod/assign/feedback/editpdf/tests/behat/annotate_pdf.feature:8
  9. Given ghostscript is installed # behat_assignfeedback_editpdf::ghostscript_is_installed()
  10. And the following "courses" exist: # behat_data_generators::the_following_exist()
  11. | fullname | shortname | category | groupmode |
  12. | Course 1 | C1 | 0 | 1 |
  13. And the following "users" exist: # behat_data_generators::the_following_exist()
  14. | username | firstname | lastname | email |
  15. | teacher1 | Teacher | 1 | teacher1@example.com |
  16. | student1 | Student | 1 | student1@example.com |
  17. And the following "course enrolments" exist: # behat_data_generators::the_following_exist()
  18. | user | course | role |
  19. | teacher1 | C1 | editingteacher |
  20. | student1 | C1 | student |
  21. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  22. Given I set the field "Username" to "admin" # behat_forms::i_set_the_field_to()
  23. Given I set the field "Password" to "admin" # behat_forms::i_set_the_field_to()
  24. Given I press "Log in" # behat_forms::press_button()
  25. And I navigate to "Annotate PDF" node in "Site administration > Plugins > Activity modules > Assignment > Feedback plugins" # behat_navigation::i_navigate_to_node_in()
  26. And I upload "pix/help.png" file to "" filemanager # behat_repository_upload::i_upload_file_to_filemanager()
  27. And I upload "pix/docs.png" file to "" filemanager # behat_repository_upload::i_upload_file_to_filemanager()
  28. When I press "Save changes" # behat_forms::press_button()
  29. Then I should see "Changes saved" # behat_general::assert_page_contains_text()
  30. And I follow "Test ghostscript path" # behat_general::click_link()
  31. And I should see "The ghostscript path appears to be OK" # behat_general::assert_page_contains_text()
  32. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  33. When I follow "Log out" # behat_general::click_link()
  34. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  35. Given I set the field "Username" to "teacher1" # behat_forms::i_set_the_field_to()
  36. Given I set the field "Password" to "teacher1" # behat_forms::i_set_the_field_to()
  37. Given I press "Log in" # behat_forms::press_button()
  38. And I follow "Course 1" # behat_general::click_link()
  39. Given I press "Turn editing on" # behat_forms::press_button()
  40. Given I add a "Assignment" to section "1" # behat_course::i_add_to_section()
  41. Given I set the following fields to these values: # behat_forms::i_set_the_following_fields_to_these_values()
  42. | Assignment name | Test assignment name |
  43. | Description | Submit your PDF file |
  44. | assignsubmission_file_enabled | 1 |
  45. | Maximum number of uploaded files | 2 |
  46. Given I press "Save and return to course" # behat_forms::press_button()
  47. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  48. When I follow "Log out" # behat_general::click_link()
  49. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  50. Given I set the field "Username" to "student1" # behat_forms::i_set_the_field_to()
  51. Given I set the field "Password" to "student1" # behat_forms::i_set_the_field_to()
  52. Given I press "Log in" # behat_forms::press_button()
  53. And I follow "Course 1" # behat_general::click_link()
  54. And I follow "Test assignment name" # behat_general::click_link()
  55. And I press "Add submission" # behat_forms::press_button()
  56. And I upload "mod/assign/feedback/editpdf/tests/fixtures/submission.pdf" file to "File submissions" filemanager # behat_repository_upload::i_upload_file_to_filemanager()
  57. And I upload "mod/assign/feedback/editpdf/tests/fixtures/testgs.pdf" file to "File submissions" filemanager # behat_repository_upload::i_upload_file_to_filemanager()
  58. And I press "Save changes" # behat_forms::press_button()
  59. And I should see "Submitted for grading" # behat_general::assert_page_contains_text()
  60. And I should see "submission.pdf" # behat_general::assert_page_contains_text()
  61. And I should see "Not graded" # behat_general::assert_page_contains_text()
  62. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  63. When I follow "Log out" # behat_general::click_link()
  64. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  65. Given I set the field "Username" to "teacher1" # behat_forms::i_set_the_field_to()
  66. Given I set the field "Password" to "teacher1" # behat_forms::i_set_the_field_to()
  67. Given I press "Log in" # behat_forms::press_button()
  68. And I follow "Course 1" # behat_general::click_link()
  69. And I follow "Test assignment name" # behat_general::click_link()
  70. And I follow "View/grade all submissions" # behat_general::click_link()
  71. And I click on "Grade" "link" in the "Submitted for grading" "table_row" # behat_general::i_click_on_in_the()
  72. And I follow "Launch PDF editor..." # behat_general::click_link()
  73. And I change window size to "large" # behat_general::i_change_window_size_to()
  74. And I click on ".navigate-next-button" "css_element" # behat_general::i_click_on()
  75. And I click on ".stampbutton" "css_element" # behat_general::i_click_on()
  76. And I click on ".linebutton" "css_element" # behat_general::i_click_on()
  77. And I click on ".commentcolourbutton" "css_element" # behat_general::i_click_on()
  78. And I click on "//img[@alt=\"Blue\"]" "xpath_element" # behat_general::i_click_on()
  79. And I change window size to "medium" # behat_general::i_change_window_size_to()
  80. And I wait until the page is ready # behat_general::wait_until_the_page_is_ready()
  81. And I click on "Close" "button" # behat_general::i_click_on()
  82. And I press "Save changes" # behat_forms::press_button()
  83. And I should see "The grade changes were saved" # behat_general::assert_page_contains_text()
  84.  
  85. @javascript
  86. Scenario: Submit a PDF file as a student in a team and annotate the PDF as a teacher # /home/rajesh/moodles/integration/moodle/mod/assign/feedback/editpdf/tests/behat/annotate_pdf.feature:69
  87. Given ghostscript is installed # behat_assignfeedback_editpdf::ghostscript_is_installed()
  88. And the following "courses" exist: # behat_data_generators::the_following_exist()
  89. | fullname | shortname | category | groupmode |
  90. | Course 1 | C1 | 0 | 1 |
  91. And the following "users" exist: # behat_data_generators::the_following_exist()
  92. | username | firstname | lastname | email |
  93. | teacher1 | Teacher | 1 | teacher1@example.com |
  94. | student1 | Student | 1 | student1@example.com |
  95. | student2 | Student | 2 | student2@example.com |
  96. | student3 | Student | 3 | student3@example.com |
  97. | student4 | Student | 4 | student4@example.com |
  98. And the following "course enrolments" exist: # behat_data_generators::the_following_exist()
  99. | user | course | role |
  100. | teacher1 | C1 | editingteacher |
  101. | student1 | C1 | student |
  102. | student2 | C1 | student |
  103. | student3 | C1 | student |
  104. | student4 | C1 | student |
  105. And the following "groups" exist: # behat_data_generators::the_following_exist()
  106. | name | course | idnumber |
  107. | G1 | C1 | G1 |
  108. | G2 | C1 | G2 |
  109. And the following "groupings" exist: # behat_data_generators::the_following_exist()
  110. | name | course | idnumber |
  111. | G1 | C1 | G1 |
  112. And the following "group members" exist: # behat_data_generators::the_following_exist()
  113. | user | group |
  114. | student1 | G1 |
  115. | student2 | G1 |
  116. | student3 | G2 |
  117. | student4 | G2 |
  118. And the following "grouping groups" exist: # behat_data_generators::the_following_exist()
  119. | grouping | group |
  120. | G1 | G1 |
  121. | G1 | G2 |
  122. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  123. Given I set the field "Username" to "teacher1" # behat_forms::i_set_the_field_to()
  124. Given I set the field "Password" to "teacher1" # behat_forms::i_set_the_field_to()
  125. Given I press "Log in" # behat_forms::press_button()
  126. And I follow "Course 1" # behat_general::click_link()
  127. Given I press "Turn editing on" # behat_forms::press_button()
  128. Given I add a "Assignment" to section "1" # behat_course::i_add_to_section()
  129. Given I set the following fields to these values: # behat_forms::i_set_the_following_fields_to_these_values()
  130. | Assignment name | Test assignment name |
  131. | Description | Submit your PDF file |
  132. | assignsubmission_file_enabled | 1 |
  133. | Maximum number of uploaded files | 2 |
  134. | Students submit in groups | Yes |
  135. | Grouping for student groups | G1 |
  136. Given I press "Save and return to course" # behat_forms::press_button()
  137. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  138. When I follow "Log out" # behat_general::click_link()
  139. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  140. Given I set the field "Username" to "student1" # behat_forms::i_set_the_field_to()
  141. Given I set the field "Password" to "student1" # behat_forms::i_set_the_field_to()
  142. Given I press "Log in" # behat_forms::press_button()
  143. And I follow "Course 1" # behat_general::click_link()
  144. And I follow "Test assignment name" # behat_general::click_link()
  145. And I press "Add submission" # behat_forms::press_button()
  146. And I upload "mod/assign/feedback/editpdf/tests/fixtures/submission.pdf" file to "File submissions" filemanager # behat_repository_upload::i_upload_file_to_filemanager()
  147. And I press "Save changes" # behat_forms::press_button()
  148. Then I should see "Submitted for grading" # behat_general::assert_page_contains_text()
  149. And I should see "submission.pdf" # behat_general::assert_page_contains_text()
  150. And I should see "Not graded" # behat_general::assert_page_contains_text()
  151. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  152. When I follow "Log out" # behat_general::click_link()
  153. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  154. Given I set the field "Username" to "teacher1" # behat_forms::i_set_the_field_to()
  155. Given I set the field "Password" to "teacher1" # behat_forms::i_set_the_field_to()
  156. Given I press "Log in" # behat_forms::press_button()
  157. And I follow "Course 1" # behat_general::click_link()
  158. And I follow "Test assignment name" # behat_general::click_link()
  159. And I follow "View/grade all submissions" # behat_general::click_link()
  160. And I click on "Grade" "link" in the "Student 2" "table_row" # behat_general::i_click_on_in_the()
  161. And I follow "Launch PDF editor..." # behat_general::click_link()
  162. And I change window size to "large" # behat_general::i_change_window_size_to()
  163. And I click on ".stampbutton" "css_element" # behat_general::i_click_on()
  164. And I click on ".drawingcanvas" "css_element" # behat_general::i_click_on()
  165. And I change window size to "medium" # behat_general::i_change_window_size_to()
  166. And I wait until the page is ready # behat_general::wait_until_the_page_is_ready()
  167. And I click on "Close" "button" # behat_general::i_click_on()
  168. And I press "Save changes" # behat_forms::press_button()
  169. And I should see "The grade changes were saved" # behat_general::assert_page_contains_text()
  170. And I press "Continue" # behat_forms::press_button()
  171. And I should see "View annotated PDF..." in the "student1@example.com" "table_row" # behat_general::assert_element_contains_text()
  172.  
  173. @mod @mod_assign @assignfeedback @assignfeedback_editpdf @_file_upload
  174. Feature: In a group assignment, teacher can annotate PDF files for all users
  175. In order to provide visual report on a graded PDF for all users
  176. As a teacher
  177. I need to use the PDF editor for a group assignment
  178.  
  179. @javascript
  180. Scenario: Submit a PDF file as a student and annotate the PDF as a teacher # /home/rajesh/moodles/integration/moodle/mod/assign/feedback/editpdf/tests/behat/group_annotations.feature:8
  181. Given ghostscript is installed # behat_assignfeedback_editpdf::ghostscript_is_installed()
  182. And the following "courses" exist: # behat_data_generators::the_following_exist()
  183. | fullname | shortname | category | groupmode |
  184. | Course 1 | C1 | 0 | 1 |
  185. And the following "users" exist: # behat_data_generators::the_following_exist()
  186. | username | firstname | lastname | email |
  187. | teacher1 | Teacher | 1 | teacher1@example.com |
  188. | student1 | Student | 1 | student1@example.com |
  189. | student2 | Student | 2 | student2@example.com |
  190. And the following "course enrolments" exist: # behat_data_generators::the_following_exist()
  191. | user | course | role |
  192. | teacher1 | C1 | editingteacher |
  193. | student1 | C1 | student |
  194. | student2 | C1 | student |
  195. And the following "groups" exist: # behat_data_generators::the_following_exist()
  196. | name | course | idnumber |
  197. | G1 | C1 | G1 |
  198. And the following "group members" exist: # behat_data_generators::the_following_exist()
  199. | user | group |
  200. | student1 | G1 |
  201. | student2 | G1 |
  202. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  203. Given I set the field "Username" to "teacher1" # behat_forms::i_set_the_field_to()
  204. Given I set the field "Password" to "teacher1" # behat_forms::i_set_the_field_to()
  205. Given I press "Log in" # behat_forms::press_button()
  206. And I follow "Course 1" # behat_general::click_link()
  207. Given I press "Turn editing on" # behat_forms::press_button()
  208. Given I add a "Assignment" to section "1" # behat_course::i_add_to_section()
  209. Given I set the following fields to these values: # behat_forms::i_set_the_following_fields_to_these_values()
  210. | Assignment name | Test assignment name |
  211. | Description | Submit your PDF file |
  212. | assignsubmission_file_enabled | 1 |
  213. | Maximum number of uploaded files | 1 |
  214. | Students submit in groups | Yes |
  215. Given I press "Save and return to course" # behat_forms::press_button()
  216. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  217. When I follow "Log out" # behat_general::click_link()
  218. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  219. Given I set the field "Username" to "student1" # behat_forms::i_set_the_field_to()
  220. Given I set the field "Password" to "student1" # behat_forms::i_set_the_field_to()
  221. Given I press "Log in" # behat_forms::press_button()
  222. And I follow "Course 1" # behat_general::click_link()
  223. And I follow "Test assignment name" # behat_general::click_link()
  224. And I press "Add submission" # behat_forms::press_button()
  225. And I upload "mod/assign/feedback/editpdf/tests/fixtures/submission.pdf" file to "File submissions" filemanager # behat_repository_upload::i_upload_file_to_filemanager()
  226. And I press "Save changes" # behat_forms::press_button()
  227. And I should see "Submitted for grading" # behat_general::assert_page_contains_text()
  228. And I should see "submission.pdf" # behat_general::assert_page_contains_text()
  229. And I should see "Not graded" # behat_general::assert_page_contains_text()
  230. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  231. When I follow "Log out" # behat_general::click_link()
  232. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  233. Given I set the field "Username" to "teacher1" # behat_forms::i_set_the_field_to()
  234. Given I set the field "Password" to "teacher1" # behat_forms::i_set_the_field_to()
  235. Given I press "Log in" # behat_forms::press_button()
  236. And I follow "Course 1" # behat_general::click_link()
  237. And I follow "Test assignment name" # behat_general::click_link()
  238. And I follow "View/grade all submissions" # behat_general::click_link()
  239. And I click on "Grade" "link" in the "Submitted for grading" "table_row" # behat_general::i_click_on_in_the()
  240. And I follow "Launch PDF editor..." # behat_general::click_link()
  241. And I change window size to "large" # behat_general::i_change_window_size_to()
  242. And I click on ".navigate-next-button" "css_element" # behat_general::i_click_on()
  243. And I click on ".stampbutton" "css_element" # behat_general::i_click_on()
  244. And I click on ".drawingcanvas" "css_element" # behat_general::i_click_on()
  245. And I change window size to "medium" # behat_general::i_change_window_size_to()
  246. And I wait until the page is ready # behat_general::wait_until_the_page_is_ready()
  247. And I click on "Close" "button" # behat_general::i_click_on()
  248. And I press "Save changes" # behat_forms::press_button()
  249. And I should see "The grade changes were saved" # behat_general::assert_page_contains_text()
  250. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  251. When I follow "Log out" # behat_general::click_link()
  252. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  253. Given I set the field "Username" to "student1" # behat_forms::i_set_the_field_to()
  254. Given I set the field "Password" to "student1" # behat_forms::i_set_the_field_to()
  255. Given I press "Log in" # behat_forms::press_button()
  256. And I follow "Course 1" # behat_general::click_link()
  257. And I follow "Test assignment name" # behat_general::click_link()
  258. When I follow "View annotated PDF..." # behat_general::click_link()
  259. And I change window size to "large" # behat_general::i_change_window_size_to()
  260. Then I should see "Annotate PDF" # behat_general::assert_page_contains_text()
  261. And I change window size to "medium" # behat_general::i_change_window_size_to()
  262. And I wait until the page is ready # behat_general::wait_until_the_page_is_ready()
  263. And I click on "Close" "button" # behat_general::i_click_on()
  264. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  265. When I follow "Log out" # behat_general::click_link()
  266. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  267. Given I set the field "Username" to "student2" # behat_forms::i_set_the_field_to()
  268. Given I set the field "Password" to "student2" # behat_forms::i_set_the_field_to()
  269. Given I press "Log in" # behat_forms::press_button()
  270. And I follow "Course 1" # behat_general::click_link()
  271. And I follow "Test assignment name" # behat_general::click_link()
  272. And I follow "View annotated PDF..." # behat_general::click_link()
  273. And I should see "Annotate PDF" # behat_general::assert_page_contains_text()
  274.  
  275. @editor @editor_atto @atto @atto_image @_file_upload
  276. Feature: Add images to Atto
  277. To write rich text - I need to add images.
  278.  
  279. @javascript
  280. Scenario: Insert an image # /home/rajesh/moodles/integration/moodle/lib/editor/atto/plugins/image/tests/behat/image.feature:6
  281. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  282. Given I set the field "Username" to "admin" # behat_forms::i_set_the_field_to()
  283. Given I set the field "Password" to "admin" # behat_forms::i_set_the_field_to()
  284. Given I press "Log in" # behat_forms::press_button()
  285. And I follow "Manage private files..." # behat_general::click_link()
  286. And I upload "lib/editor/atto/tests/fixtures/moodle-logo.png" file to "Files" filemanager # behat_repository_upload::i_upload_file_to_filemanager()
  287. And I click on "Save changes" "button" # behat_general::i_click_on()
  288. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  289. When I click on "Profile" "link" in the ".usermenu [data-rel='menu-content']" "css_element" # behat_general::i_click_on_in_the()
  290. And I follow "Edit profile" # behat_general::click_link()
  291. When I set the field "Description" to "<p>Image test</p>" # behat_forms::i_set_the_field_to()
  292. And I select the text in the "Description" Atto editor # behat_editor_atto::select_the_text_in_the_atto_editor()
  293. And I click on "Image" "button" # behat_general::i_click_on()
  294. And I click on "Browse repositories..." "button" # behat_general::i_click_on()
  295. And I click on "Private files" "link" # behat_general::i_click_on()
  296. And I click on "moodle-logo.png" "link" # behat_general::i_click_on()
  297. And I click on "Select this file" "button" # behat_general::i_click_on()
  298. And I set the field "Describe this image" to "It's the Moodle" # behat_forms::i_set_the_field_to()
  299. And I wait until the page is ready # behat_general::wait_until_the_page_is_ready()
  300. And the field "Width" matches value "204" # behat_forms::the_field_matches_value()
  301. And the field "Height" matches value "61" # behat_forms::the_field_matches_value()
  302. And I set the field "Auto size" to "1" # behat_forms::i_set_the_field_to()
  303. And I set the field "Width" to "2040" # behat_forms::i_set_the_field_to()
  304. And I take focus off "Width" "field" # behat_general::i_take_focus_off_field()
  305. And the field "Height" matches value "610" # behat_forms::the_field_matches_value()
  306. And I set the field "Height" to "61" # behat_forms::i_set_the_field_to()
  307. And I take focus off "Height" "field" # behat_general::i_take_focus_off_field()
  308. And the field "Width" matches value "204" # behat_forms::the_field_matches_value()
  309. And I set the field "Auto size" to "0" # behat_forms::i_set_the_field_to()
  310. And I set the field "Width" to "123" # behat_forms::i_set_the_field_to()
  311. And I set the field "Height" to "456" # behat_forms::i_set_the_field_to()
  312. And I take focus off "Height" "field" # behat_general::i_take_focus_off_field()
  313. And the field "Width" matches value "123" # behat_forms::the_field_matches_value()
  314. And the field "Height" matches value "456" # behat_forms::the_field_matches_value()
  315. And I click on "Save image" "button" # behat_general::i_click_on()
  316. And I click on "Update profile" "button" # behat_general::i_click_on()
  317. And I follow "Edit profile" # behat_general::click_link()
  318. And I select the text in the "Description" Atto editor # behat_editor_atto::select_the_text_in_the_atto_editor()
  319. And I click on "Image" "button" # behat_general::i_click_on()
  320. Then the field "Describe this image" matches value "It's the Moodle" # behat_forms::the_field_matches_value()
  321. And the field "Width" matches value "123" # behat_forms::the_field_matches_value()
  322. And the field "Height" matches value "456" # behat_forms::the_field_matches_value()
  323.  
  324. @javascript
  325. Scenario: Manually inserting an image # /home/rajesh/moodles/integration/moodle/lib/editor/atto/plugins/image/tests/behat/image.feature:51
  326. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  327. Given I set the field "Username" to "admin" # behat_forms::i_set_the_field_to()
  328. Given I set the field "Password" to "admin" # behat_forms::i_set_the_field_to()
  329. Given I press "Log in" # behat_forms::press_button()
  330. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  331. When I click on "Profile" "link" in the ".usermenu [data-rel='menu-content']" "css_element" # behat_general::i_click_on_in_the()
  332. And I follow "Edit profile" # behat_general::click_link()
  333. And I set the field "Description" to "<p>Image: <img src='/nothing/here'>.</p>" # behat_forms::i_set_the_field_to()
  334. And I select the text in the "Description" Atto editor # behat_editor_atto::select_the_text_in_the_atto_editor()
  335. When I click on "Image" "button" # behat_general::i_click_on()
  336. Then the field "Enter URL" matches value "/nothing/here" # behat_forms::the_field_matches_value()
  337. The 'Enter URL' value is '', '/nothing/here' expected
  338. And I set the field "Describe this image" to "Something" # behat_forms::i_set_the_field_to()
  339. And I set the field "Enter URL" to "" # behat_forms::i_set_the_field_to()
  340. And I press "Save image" # behat_forms::press_button()
  341. And I set the field "Description" to "<p>Image: <img src='/nothing/again' width='123' height='456' alt='Awesome!'>.</p>" # behat_forms::i_set_the_field_to()
  342. And I press "Update profile" # behat_forms::press_button()
  343. And I follow "Edit profile" # behat_general::click_link()
  344. And I select the text in the "Description" Atto editor # behat_editor_atto::select_the_text_in_the_atto_editor()
  345. And I click on "Image" "button" # behat_general::i_click_on()
  346. And the field "Enter URL" matches value "/nothing/again" # behat_forms::the_field_matches_value()
  347. And the field "Width" matches value "123" # behat_forms::the_field_matches_value()
  348. And the field "Height" matches value "456" # behat_forms::the_field_matches_value()
  349. And the field "Describe this image" matches value "Awesome!" # behat_forms::the_field_matches_value()
  350.  
  351. @editor @editor_atto @atto @atto_link @_file_upload
  352. Feature: Add links to Atto
  353. To write rich text - I need to add links.
  354.  
  355. @javascript
  356. Scenario: Insert a links # /home/rajesh/moodles/integration/moodle/lib/editor/atto/plugins/link/tests/behat/link.feature:6
  357. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  358. Given I set the field "Username" to "admin" # behat_forms::i_set_the_field_to()
  359. Given I set the field "Password" to "admin" # behat_forms::i_set_the_field_to()
  360. Given I press "Log in" # behat_forms::press_button()
  361. And I follow "Manage private files..." # behat_general::click_link()
  362. And I upload "lib/editor/atto/tests/fixtures/moodle-logo.png" file to "Files" filemanager # behat_repository_upload::i_upload_file_to_filemanager()
  363. And I click on "Save changes" "button" # behat_general::i_click_on()
  364. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  365. When I click on "Profile" "link" in the ".usermenu [data-rel='menu-content']" "css_element" # behat_general::i_click_on_in_the()
  366. And I follow "Edit profile" # behat_general::click_link()
  367. And I set the field "Description" to "Super cool" # behat_forms::i_set_the_field_to()
  368. And I select the text in the "Description" Atto editor # behat_editor_atto::select_the_text_in_the_atto_editor()
  369. And I click on "Link" "button" # behat_general::i_click_on()
  370. And I click on "Browse repositories..." "button" # behat_general::i_click_on()
  371. And I click on "Private files" "link" # behat_general::i_click_on()
  372. And I click on "moodle-logo.png" "link" # behat_general::i_click_on()
  373. And I click on "Select this file" "button" # behat_general::i_click_on()
  374. And I click on "Update profile" "button" # behat_general::i_click_on()
  375. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  376. When I click on "Preferences" "link" in the ".usermenu [data-rel='menu-content']" "css_element" # behat_general::i_click_on_in_the()
  377. And I follow "Editor preferences" # behat_general::click_link()
  378. And I set the field "Text editor" to "Plain text area" # behat_forms::i_set_the_field_to()
  379. And I press "Save changes" # behat_forms::press_button()
  380. And I follow "Edit profile" # behat_general::click_link()
  381. Then I should see "Super cool</a>" # behat_general::assert_page_contains_text()
  382. "Super cool</a>" text was not found in the page
  383.  
  384. @editor @editor_atto @atto @atto_media @_file_upload
  385. Feature: Add media to Atto
  386. To write rich text - I need to add media.
  387.  
  388. @javascript
  389. Scenario: Insert some media # /home/rajesh/moodles/integration/moodle/lib/editor/atto/plugins/media/tests/behat/media.feature:6
  390. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  391. Given I set the field "Username" to "admin" # behat_forms::i_set_the_field_to()
  392. Given I set the field "Password" to "admin" # behat_forms::i_set_the_field_to()
  393. Given I press "Log in" # behat_forms::press_button()
  394. And I follow "Manage private files..." # behat_general::click_link()
  395. And I upload "lib/editor/atto/tests/fixtures/moodle-logo.webm" file to "Files" filemanager # behat_repository_upload::i_upload_file_to_filemanager()
  396. And I click on "Save changes" "button" # behat_general::i_click_on()
  397. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  398. When I click on "Profile" "link" in the ".usermenu [data-rel='menu-content']" "css_element" # behat_general::i_click_on_in_the()
  399. And I follow "Blog entries" # behat_general::click_link()
  400. And I follow "Add a new entry" # behat_general::click_link()
  401. And I set the field "Blog entry body" to "<p>Media test</p>" # behat_forms::i_set_the_field_to()
  402. And I select the text in the "Blog entry body" Atto editor # behat_editor_atto::select_the_text_in_the_atto_editor()
  403. And I set the field "Entry title" to "The best video in the entire world (not really)" # behat_forms::i_set_the_field_to()
  404. And I click on "Media" "button" # behat_general::i_click_on()
  405. And I click on "Browse repositories..." "button" # behat_general::i_click_on()
  406. And I click on "Private files" "link" # behat_general::i_click_on()
  407. And I click on "moodle-logo.webm" "link" # behat_general::i_click_on()
  408. And I click on "Select this file" "button" # behat_general::i_click_on()
  409. And I set the field "Enter name" to "It's the logo" # behat_forms::i_set_the_field_to()
  410. And I click on "Insert media" "button" # behat_general::i_click_on()
  411. And I click on "Save changes" "button" # behat_general::i_click_on()
  412. Then "video" "css_element" should be visible # behat_general::should_be_visible()
  413. Css matching locator "video" not found.
  414.  
  415. @editor @editor_atto @atto @_file_upload
  416. Feature: Atto Autosave
  417. To reduce frustration, atto should save drafts of my work.
  418.  
  419. Background: # /home/rajesh/moodles/integration/moodle/lib/editor/atto/tests/behat/autosave.feature:5
  420. Given the following "courses" exist: # behat_data_generators::the_following_exist()
  421. | fullname | shortname | category | groupmode |
  422. | Course 1 | C1 | 0 | 1 |
  423. And the following "users" exist: # behat_data_generators::the_following_exist()
  424. | username | firstname | lastname | email |
  425. | teacher1 | Teacher | 1 | teacher1@example.com |
  426. | teacher2 | Teacher | 2 | teacher2@example.com |
  427. And the following "course enrolments" exist: # behat_data_generators::the_following_exist()
  428. | user | course | role |
  429. | teacher1 | C1 | editingteacher |
  430. | teacher2 | C1 | editingteacher |
  431. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  432. Given I set the field "Username" to "admin" # behat_forms::i_set_the_field_to()
  433. Given I set the field "Password" to "admin" # behat_forms::i_set_the_field_to()
  434. Given I press "Log in" # behat_forms::press_button()
  435. And I navigate to "Atto toolbar settings" node in "Site administration > Plugins > Text editors > Atto HTML editor" # behat_navigation::i_navigate_to_node_in()
  436. And I set the field "Autosave frequency" to "3" # behat_forms::i_set_the_field_to()
  437. And I set the field with xpath "//select[@name='s_editor_atto_autosavefrequency[u]']" to "seconds" # behat_forms::i_set_the_field_with_xpath_to()
  438. And I click on "Save changes" "button" # behat_general::i_click_on()
  439. And I am on site homepage # behat_general::i_am_on_site_homepage()
  440. And I follow "Course 1" # behat_general::click_link()
  441. And I navigate to "Edit settings" node in "Course administration" # behat_navigation::i_navigate_to_node_in()
  442. And I set the field with xpath "//select[@name='summary_editor[format]']" to "1" # behat_forms::i_set_the_field_with_xpath_to()
  443. And I click on "Save and display" "button" # behat_general::i_click_on()
  444. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  445. When I follow "Log out" # behat_general::click_link()
  446.  
  447. @javascript
  448. Scenario: Restore a draft # /home/rajesh/moodles/integration/moodle/lib/editor/atto/tests/behat/autosave.feature:30
  449. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  450. Given I set the field "Username" to "teacher1" # behat_forms::i_set_the_field_to()
  451. Given I set the field "Password" to "teacher1" # behat_forms::i_set_the_field_to()
  452. Given I press "Log in" # behat_forms::press_button()
  453. And I follow "Course 1" # behat_general::click_link()
  454. And I navigate to "Edit settings" node in "Course administration" # behat_navigation::i_navigate_to_node_in()
  455. And I set the field "Course summary" to "This is my draft" # behat_forms::i_set_the_field_to()
  456. And I wait "5" seconds # behat_general::i_wait_seconds()
  457. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  458. When I follow "Log out" # behat_general::click_link()
  459. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  460. Given I set the field "Username" to "teacher1" # behat_forms::i_set_the_field_to()
  461. Given I set the field "Password" to "teacher1" # behat_forms::i_set_the_field_to()
  462. Given I press "Log in" # behat_forms::press_button()
  463. And I follow "Course 1" # behat_general::click_link()
  464. And I navigate to "Edit settings" node in "Course administration" # behat_navigation::i_navigate_to_node_in()
  465. And I wait "2" seconds # behat_general::i_wait_seconds()
  466. Then I should see "This is my draft" # behat_general::assert_page_contains_text()
  467.  
  468. @javascript
  469. Scenario: Do not restore a draft if files have been modified # /home/rajesh/moodles/integration/moodle/lib/editor/atto/tests/behat/autosave.feature:46
  470. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  471. Given I set the field "Username" to "teacher1" # behat_forms::i_set_the_field_to()
  472. Given I set the field "Password" to "teacher1" # behat_forms::i_set_the_field_to()
  473. Given I press "Log in" # behat_forms::press_button()
  474. And I follow "Course 1" # behat_general::click_link()
  475. And I navigate to "Edit settings" node in "Course administration" # behat_navigation::i_navigate_to_node_in()
  476. And I set the field "Course summary" to "This is my draft" # behat_forms::i_set_the_field_to()
  477. And I wait "5" seconds # behat_general::i_wait_seconds()
  478. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  479. When I follow "Log out" # behat_general::click_link()
  480. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  481. Given I set the field "Username" to "teacher2" # behat_forms::i_set_the_field_to()
  482. Given I set the field "Password" to "teacher2" # behat_forms::i_set_the_field_to()
  483. Given I press "Log in" # behat_forms::press_button()
  484. And I follow "Manage private files..." # behat_general::click_link()
  485. And I upload "lib/editor/atto/tests/fixtures/moodle-logo.png" file to "Files" filemanager # behat_repository_upload::i_upload_file_to_filemanager()
  486. And I click on "Save changes" "button" # behat_general::i_click_on()
  487. And I click on "Dashboard" "link" in the "Navigation" "block" # behat_general::i_click_on_in_the()
  488. And I follow "Course 1" # behat_general::click_link()
  489. And I navigate to "Edit settings" node in "Course administration" # behat_navigation::i_navigate_to_node_in()
  490. And I set the field "Course summary" to "<p>Image test</p>" # behat_forms::i_set_the_field_to()
  491. And I select the text in the "Course summary" Atto editor # behat_editor_atto::select_the_text_in_the_atto_editor()
  492. And I click on "Image" "button" # behat_general::i_click_on()
  493. And I click on "Browse repositories..." "button" # behat_general::i_click_on()
  494. And I click on "Private files" "link" # behat_general::i_click_on()
  495. And I click on "moodle-logo.png" "link" # behat_general::i_click_on()
  496. And I click on "Select this file" "button" # behat_general::i_click_on()
  497. And I set the field "Describe this image" to "It's the Moodle" # behat_forms::i_set_the_field_to()
  498. And I wait until the page is ready # behat_general::wait_until_the_page_is_ready()
  499. And I click on "Save image" "button" # behat_general::i_click_on()
  500. And I click on "Save and display" "button" # behat_general::i_click_on()
  501. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  502. When I follow "Log out" # behat_general::click_link()
  503. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  504. Given I set the field "Username" to "teacher1" # behat_forms::i_set_the_field_to()
  505. Given I set the field "Password" to "teacher1" # behat_forms::i_set_the_field_to()
  506. Given I press "Log in" # behat_forms::press_button()
  507. And I follow "Course 1" # behat_general::click_link()
  508. And I navigate to "Edit settings" node in "Course administration" # behat_navigation::i_navigate_to_node_in()
  509. Then I should not see "This is my draft" # behat_general::assert_page_not_contains_text()
  510.  
  511. @javascript
  512. Scenario: Do not restore a draft if text has been modified # /home/rajesh/moodles/integration/moodle/lib/editor/atto/tests/behat/autosave.feature:80
  513. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  514. Given I set the field "Username" to "teacher1" # behat_forms::i_set_the_field_to()
  515. Given I set the field "Password" to "teacher1" # behat_forms::i_set_the_field_to()
  516. Given I press "Log in" # behat_forms::press_button()
  517. And I follow "Course 1" # behat_general::click_link()
  518. And I navigate to "Edit settings" node in "Course administration" # behat_navigation::i_navigate_to_node_in()
  519. And I set the field "Course summary" to "This is my draft" # behat_forms::i_set_the_field_to()
  520. And I wait "5" seconds # behat_general::i_wait_seconds()
  521. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  522. When I follow "Log out" # behat_general::click_link()
  523. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  524. Given I set the field "Username" to "teacher2" # behat_forms::i_set_the_field_to()
  525. Given I set the field "Password" to "teacher2" # behat_forms::i_set_the_field_to()
  526. Given I press "Log in" # behat_forms::press_button()
  527. And I follow "Course 1" # behat_general::click_link()
  528. And I navigate to "Edit settings" node in "Course administration" # behat_navigation::i_navigate_to_node_in()
  529. And I set the field "Course summary" to "Modified text" # behat_forms::i_set_the_field_to()
  530. And I click on "Save and display" "button" # behat_general::i_click_on()
  531. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  532. When I follow "Log out" # behat_general::click_link()
  533. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  534. Given I set the field "Username" to "teacher1" # behat_forms::i_set_the_field_to()
  535. Given I set the field "Password" to "teacher1" # behat_forms::i_set_the_field_to()
  536. Given I press "Log in" # behat_forms::press_button()
  537. And I follow "Course 1" # behat_general::click_link()
  538. And I navigate to "Edit settings" node in "Course administration" # behat_navigation::i_navigate_to_node_in()
  539. Then I should not see "This is my draft" # behat_general::assert_page_not_contains_text()
  540. And I should see "Modified text" # behat_general::assert_page_contains_text()
  541.  
  542. @mod @mod_assign
  543. Feature: In an assignment, teachers can edit a students submission inline
  544. In order to easily mark students assignments
  545. As a teacher
  546. I need to have a students submission text copied to the grading online form.
  547.  
  548. @javascript @_file_upload
  549. Scenario: Submit a text online and edit the submission # /home/rajesh/moodles/integration/moodle/mod/assign/tests/behat/comment_inline.feature:8
  550. Given the following "courses" exist: # behat_data_generators::the_following_exist()
  551. | fullname | shortname | category | groupmode |
  552. | Course 1 | C1 | 0 | 1 |
  553. And the following "users" exist: # behat_data_generators::the_following_exist()
  554. | username | firstname | lastname | email |
  555. | teacher1 | Teacher | 1 | teacher1@example.com |
  556. | student1 | Student | 1 | student1@example.com |
  557. And the following "course enrolments" exist: # behat_data_generators::the_following_exist()
  558. | user | course | role |
  559. | teacher1 | C1 | editingteacher |
  560. | student1 | C1 | student |
  561. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  562. Given I set the field "Username" to "teacher1" # behat_forms::i_set_the_field_to()
  563. Given I set the field "Password" to "teacher1" # behat_forms::i_set_the_field_to()
  564. Given I press "Log in" # behat_forms::press_button()
  565. And I follow "Course 1" # behat_general::click_link()
  566. Given I press "Turn editing on" # behat_forms::press_button()
  567. Given I add a "Assignment" to section "1" # behat_course::i_add_to_section()
  568. Given I set the following fields to these values: # behat_forms::i_set_the_following_fields_to_these_values()
  569. | Assignment name | Test assignment name |
  570. | Description | Submit your online text |
  571. | assignsubmission_onlinetext_enabled | 1 |
  572. | assignsubmission_file_enabled | 0 |
  573. | assignfeedback_comments_enabled | 1 |
  574. | assignfeedback_comments_commentinline | 1 |
  575. | assignfeedback_file_enabled | 1 |
  576. Given I press "Save and return to course" # behat_forms::press_button()
  577. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  578. When I follow "Log out" # behat_general::click_link()
  579. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  580. Given I set the field "Username" to "student1" # behat_forms::i_set_the_field_to()
  581. Given I set the field "Password" to "student1" # behat_forms::i_set_the_field_to()
  582. Given I press "Log in" # behat_forms::press_button()
  583. And I follow "Course 1" # behat_general::click_link()
  584. And I follow "Test assignment name" # behat_general::click_link()
  585. And I press "Add submission" # behat_forms::press_button()
  586. And I set the following fields to these values: # behat_forms::i_set_the_following_fields_to_these_values()
  587. | Online text | I'm the student first submission |
  588. And I press "Save changes" # behat_forms::press_button()
  589. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  590. When I follow "Log out" # behat_general::click_link()
  591. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  592. Given I set the field "Username" to "teacher1" # behat_forms::i_set_the_field_to()
  593. Given I set the field "Password" to "teacher1" # behat_forms::i_set_the_field_to()
  594. Given I press "Log in" # behat_forms::press_button()
  595. And I follow "Course 1" # behat_general::click_link()
  596. And I follow "Test assignment name" # behat_general::click_link()
  597. And I follow "View/grade all submissions" # behat_general::click_link()
  598. And I click on "Grade Student 1" "link" in the "Student 1" "table_row" # behat_general::i_click_on_in_the()
  599. And I set the following fields to these values: # behat_forms::i_set_the_following_fields_to_these_values()
  600. | Grade out of 100 | 50 |
  601. | Feedback comments | I'm the teacher feedback |
  602. And I upload "lib/tests/fixtures/empty.txt" file to "Feedback files" filemanager # behat_repository_upload::i_upload_file_to_filemanager()
  603. And I press "Save changes" # behat_forms::press_button()
  604. And I press "Continue" # behat_forms::press_button()
  605. Then I should see "50.00" in the "Student 1" "table_row" # behat_general::assert_element_contains_text()
  606. And I should see "Submitted for grading" in the "Student 1" "table_row" # behat_general::assert_element_contains_text()
  607. And I should see "Graded" in the "Student 1" "table_row" # behat_general::assert_element_contains_text()
  608. And I should see "I'm the student first submission" in the "Student 1" "table_row" # behat_general::assert_element_contains_text()
  609. And I should see "I'm the teacher feedback" in the "Student 1" "table_row" # behat_general::assert_element_contains_text()
  610. And I should see "empty.txt" in the "Student 1" "table_row" # behat_general::assert_element_contains_text()
  611. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  612. When I follow "Log out" # behat_general::click_link()
  613. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  614. Given I set the field "Username" to "student1" # behat_forms::i_set_the_field_to()
  615. Given I set the field "Password" to "student1" # behat_forms::i_set_the_field_to()
  616. Given I press "Log in" # behat_forms::press_button()
  617. And I follow "Course 1" # behat_general::click_link()
  618. And I follow "Test assignment name" # behat_general::click_link()
  619. And I should see "Submitted for grading" in the "Submission status" "table_row" # behat_general::assert_element_contains_text()
  620. And I should see "Graded" in the "Grading status" "table_row" # behat_general::assert_element_contains_text()
  621. And I should see "I'm the student first submission" in the "Online text" "table_row" # behat_general::assert_element_contains_text()
  622. And I should see "I'm the teacher feedback" in the "Feedback comments" "table_row" # behat_general::assert_element_contains_text()
  623. And I should see "empty.txt" in the "Feedback files" "table_row" # behat_general::assert_element_contains_text()
  624.  
  625. @mod @mod_assign @_file_upload
  626. Feature: In an assignment, students can upload files for assessment
  627. In order to complete my assignments providing files
  628. As a student
  629. I need to upload files from my file system to be assessed
  630.  
  631. @javascript
  632. Scenario: Submit a file and update the submission with another file # /home/rajesh/moodles/integration/moodle/mod/assign/tests/behat/file_submission.feature:8
  633. Given the following "courses" exist: # behat_data_generators::the_following_exist()
  634. | fullname | shortname | category | groupmode |
  635. | Course 1 | C1 | 0 | 1 |
  636. And the following "users" exist: # behat_data_generators::the_following_exist()
  637. | username | firstname | lastname | email |
  638. | teacher1 | Teacher | 1 | teacher1@example.com |
  639. | student1 | Student | 1 | student1@example.com |
  640. And the following "course enrolments" exist: # behat_data_generators::the_following_exist()
  641. | user | course | role |
  642. | teacher1 | C1 | editingteacher |
  643. | student1 | C1 | student |
  644. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  645. Given I set the field "Username" to "teacher1" # behat_forms::i_set_the_field_to()
  646. Given I set the field "Password" to "teacher1" # behat_forms::i_set_the_field_to()
  647. Given I press "Log in" # behat_forms::press_button()
  648. And I follow "Course 1" # behat_general::click_link()
  649. Given I press "Turn editing on" # behat_forms::press_button()
  650. Given I add a "Assignment" to section "1" # behat_course::i_add_to_section()
  651. Given I set the following fields to these values: # behat_forms::i_set_the_following_fields_to_these_values()
  652. | Assignment name | Test assignment name |
  653. | Description | Submit your online text |
  654. | assignsubmission_onlinetext_enabled | 0 |
  655. | assignsubmission_file_enabled | 1 |
  656. | Maximum number of uploaded files | 2 |
  657. Given I press "Save and return to course" # behat_forms::press_button()
  658. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  659. When I follow "Log out" # behat_general::click_link()
  660. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  661. Given I set the field "Username" to "student1" # behat_forms::i_set_the_field_to()
  662. Given I set the field "Password" to "student1" # behat_forms::i_set_the_field_to()
  663. Given I press "Log in" # behat_forms::press_button()
  664. And I follow "Course 1" # behat_general::click_link()
  665. And I follow "Test assignment name" # behat_general::click_link()
  666. When I press "Add submission" # behat_forms::press_button()
  667. And I upload "lib/tests/fixtures/empty.txt" file to "File submissions" filemanager # behat_repository_upload::i_upload_file_to_filemanager()
  668. And I press "Save changes" # behat_forms::press_button()
  669. Then I should see "Submitted for grading" # behat_general::assert_page_contains_text()
  670. And I should see "Not graded" # behat_general::assert_page_contains_text()
  671. And "empty.txt" "link" should exist # behat_general::should_exist()
  672. And I press "Edit submission" # behat_forms::press_button()
  673. And I upload "lib/tests/fixtures/upload_users.csv" file to "File submissions" filemanager # behat_repository_upload::i_upload_file_to_filemanager()
  674. And ".ffilemanager .fm-maxfiles .fp-btn-add" "css_element" should not be visible # behat_general::should_not_be_visible()
  675. And I press "Save changes" # behat_forms::press_button()
  676. And I should see "Submitted for grading" # behat_general::assert_page_contains_text()
  677. And "empty.txt" "link" should exist # behat_general::should_exist()
  678. And "upload_users.csv" "link" should exist # behat_general::should_exist()
  679. And I press "Edit submission" # behat_forms::press_button()
  680. And ".ffilemanager .fm-maxfiles .fp-btn-add" "css_element" should not be visible # behat_general::should_not_be_visible()
  681. And I delete "empty.txt" from "File submissions" filemanager # behat_filepicker::i_delete_file_from_filemanager()
  682. And I press "Save changes" # behat_forms::press_button()
  683. And "empty.txt" "link" should not exist # behat_general::should_not_exist()
  684. And "upload_users.csv" "link" should exist # behat_general::should_exist()
  685.  
  686. @mod @mod_forum @_file_upload
  687. Feature: Add forum activities and discussions
  688. In order to discuss topics with other users
  689. As a teacher
  690. I need to add forum activities to moodle courses
  691.  
  692. @javascript
  693. Scenario: Add a forum and a discussion attaching files # /home/rajesh/moodles/integration/moodle/mod/forum/tests/behat/add_forum.feature:8
  694. Given the following "users" exist: # behat_data_generators::the_following_exist()
  695. | username | firstname | lastname | email |
  696. | teacher1 | Teacher | 1 | teacher1@example.com |
  697. | student1 | Student | 1 | student1@example.com |
  698. And the following "courses" exist: # behat_data_generators::the_following_exist()
  699. | fullname | shortname | category |
  700. | Course 1 | C1 | 0 |
  701. And the following "course enrolments" exist: # behat_data_generators::the_following_exist()
  702. | user | course | role |
  703. | teacher1 | C1 | editingteacher |
  704. | student1 | C1 | student |
  705. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  706. Given I set the field "Username" to "teacher1" # behat_forms::i_set_the_field_to()
  707. Given I set the field "Password" to "teacher1" # behat_forms::i_set_the_field_to()
  708. Given I press "Log in" # behat_forms::press_button()
  709. And I follow "Course 1" # behat_general::click_link()
  710. Given I press "Turn editing on" # behat_forms::press_button()
  711. Given I add a "Forum" to section "1" # behat_course::i_add_to_section()
  712. Given I set the following fields to these values: # behat_forms::i_set_the_following_fields_to_these_values()
  713. | Forum name | Test forum name |
  714. | Forum type | Standard forum for general use |
  715. | Description | Test forum description |
  716. Given I press "Save and return to course" # behat_forms::press_button()
  717. Given I follow "Test forum name" # behat_general::click_link()
  718. Given I press "Add a new discussion topic" # behat_forms::press_button()
  719. Given I set the following fields to these values: # behat_forms::i_set_the_following_fields_to_these_values()
  720. | Subject | Forum post 1 |
  721. | Message | This is the body |
  722. Given I press "Post to forum" # behat_forms::press_button()
  723. Given I wait to be redirected # behat_general::i_wait_to_be_redirected()
  724. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  725. When I follow "Log out" # behat_general::click_link()
  726. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  727. Given I set the field "Username" to "student1" # behat_forms::i_set_the_field_to()
  728. Given I set the field "Password" to "student1" # behat_forms::i_set_the_field_to()
  729. Given I press "Log in" # behat_forms::press_button()
  730. And I follow "Course 1" # behat_general::click_link()
  731. Given I follow "Test forum name" # behat_general::click_link()
  732. Given I press "Add a new discussion topic" # behat_forms::press_button()
  733. Given I set the following fields to these values: # behat_forms::i_set_the_following_fields_to_these_values()
  734. | Subject | Post with attachment |
  735. | Message | This is the body |
  736. | Attachment | lib/tests/fixtures/empty.txt |
  737. Given I press "Post to forum" # behat_forms::press_button()
  738. Given I wait to be redirected # behat_general::i_wait_to_be_redirected()
  739. Given I follow "Test forum name" # behat_general::click_link()
  740. Given I follow "Forum post 1" # behat_general::click_link()
  741. Given I follow "Reply" # behat_general::click_link()
  742. Given I set the following fields to these values: # behat_forms::i_set_the_following_fields_to_these_values()
  743. | Subject | Reply with attachment |
  744. | Message | This is the body |
  745. | Attachment | lib/tests/fixtures/upload_users.csv |
  746. Given I press "Post to forum" # behat_forms::press_button()
  747. Given I wait to be redirected # behat_general::i_wait_to_be_redirected()
  748. Then I should see "Reply with attachment" # behat_general::assert_page_contains_text()
  749. And I should see "upload_users.csv" # behat_general::assert_page_contains_text()
  750. And I follow "Test forum name" # behat_general::click_link()
  751. And I follow "Post with attachment" # behat_general::click_link()
  752. And I should see "empty.txt" # behat_general::assert_page_contains_text()
  753. And I follow "Edit" # behat_general::click_link()
  754. And the field "Attachment" matches value "empty.txt" # behat_forms::the_field_matches_value()
  755.  
  756. @mod @mod_lesson
  757. Feature: In a lesson activity, teacher can import blackboard fill in the blank question
  758. As a teacher
  759. I need to import a fill in the blank question made in Blackboard in a lesson
  760.  
  761. @javascript @_file_upload
  762. Scenario: Import fill in the blank question in a lesson # /home/rajesh/moodles/integration/moodle/mod/lesson/tests/behat/import_fillintheblank_question.feature:7
  763. Given the following "users" exist: # behat_data_generators::the_following_exist()
  764. | username | firstname | lastname | email |
  765. | teacher1 | Teacher | 1 | teacher1@example.com |
  766. | student1 | Student | 1 | student1@example.com |
  767. And the following "courses" exist: # behat_data_generators::the_following_exist()
  768. | fullname | shortname | category |
  769. | Course 1 | C1 | 0 |
  770. And the following "course enrolments" exist: # behat_data_generators::the_following_exist()
  771. | user | course | role |
  772. | teacher1 | C1 | editingteacher |
  773. | student1 | C1 | student |
  774. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  775. Given I set the field "Username" to "teacher1" # behat_forms::i_set_the_field_to()
  776. Given I set the field "Password" to "teacher1" # behat_forms::i_set_the_field_to()
  777. Given I press "Log in" # behat_forms::press_button()
  778. When I am on homepage # behat_general::i_am_on_homepage()
  779. And I follow "Course 1" # behat_general::click_link()
  780. Given I press "Turn editing on" # behat_forms::press_button()
  781. Given I add a "Lesson" to section "1" # behat_course::i_add_to_section()
  782. Given I set the following fields to these values: # behat_forms::i_set_the_following_fields_to_these_values()
  783. | Name | Test lesson name |
  784. | Description | Test lesson description |
  785. Given I press "Save and return to course" # behat_forms::press_button()
  786. And I follow "Test lesson name" # behat_general::click_link()
  787. And I follow "Import questions" # behat_general::click_link()
  788. And I set the field "File format" to "Blackboard" # behat_forms::i_set_the_field_to()
  789. And I upload "mod/lesson/tests/fixtures/sample_blackboard_fib_qti.dat" file to "Upload" filemanager # behat_repository_upload::i_upload_file_to_filemanager()
  790. And I press "Import" # behat_forms::press_button()
  791. Then I should see "Importing 1 questions" # behat_general::assert_page_contains_text()
  792. And I should see "Name an amphibian: __________" # behat_general::assert_page_contains_text()
  793. And I press "Continue" # behat_forms::press_button()
  794. And I should not see "__________" # behat_general::assert_page_not_contains_text()
  795. And I should not see "Your answer" # behat_general::assert_page_not_contains_text()
  796. And I set the field "id_answer" to "frog" # behat_forms::i_set_the_field_to()
  797. And I press "Submit" # behat_forms::press_button()
  798. And I should see "Your answer : frog" # behat_general::assert_page_contains_text()
  799. And I should see "A frog is an amphibian" # behat_general::assert_page_contains_text()
  800. And I press "Continue" # behat_forms::press_button()
  801. And I should see "Congratulations - end of lesson reached" # behat_general::assert_page_contains_text()
  802.  
  803. @mod @mod_lesson
  804. Feature: In a lesson activity, teacher can import embedded images in questions answers and responses
  805. As a teacher
  806. I need to import a question with images in answers and responses in a lesson
  807.  
  808. @javascript @_file_upload
  809. Scenario: Import questions with images in answers and responses in a lesson # /home/rajesh/moodles/integration/moodle/mod/lesson/tests/behat/import_images.feature:7
  810. Given the following "users" exist: # behat_data_generators::the_following_exist()
  811. | username | firstname | lastname | email |
  812. | teacher1 | Teacher | 1 | teacher1@example.com |
  813. | student1 | Student | 1 | student1@example.com |
  814. And the following "courses" exist: # behat_data_generators::the_following_exist()
  815. | fullname | shortname | category |
  816. | Course 1 | C1 | 0 |
  817. And the following "course enrolments" exist: # behat_data_generators::the_following_exist()
  818. | user | course | role |
  819. | teacher1 | C1 | editingteacher |
  820. | student1 | C1 | student |
  821. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  822. Given I set the field "Username" to "teacher1" # behat_forms::i_set_the_field_to()
  823. Given I set the field "Password" to "teacher1" # behat_forms::i_set_the_field_to()
  824. Given I press "Log in" # behat_forms::press_button()
  825. When I am on homepage # behat_general::i_am_on_homepage()
  826. And I follow "Course 1" # behat_general::click_link()
  827. Given I press "Turn editing on" # behat_forms::press_button()
  828. Given I add a "Lesson" to section "1" # behat_course::i_add_to_section()
  829. Given I set the following fields to these values: # behat_forms::i_set_the_following_fields_to_these_values()
  830. | Name | Test lesson name |
  831. | Description | Test lesson description |
  832. Given I press "Save and return to course" # behat_forms::press_button()
  833. And I follow "Test lesson name" # behat_general::click_link()
  834. And I follow "Import questions" # behat_general::click_link()
  835. And I set the field "File format" to "Moodle XML format" # behat_forms::i_set_the_field_to()
  836. And I upload "mod/lesson/tests/fixtures/multichoice.xml" file to "Upload" filemanager # behat_repository_upload::i_upload_file_to_filemanager()
  837. And I press "Import" # behat_forms::press_button()
  838. Then I should see "Importing 1 questions" # behat_general::assert_page_contains_text()
  839. And I should see "bonjour.mp3" # behat_general::assert_page_contains_text()
  840. And I should see "What language is being spoken?" # behat_general::assert_page_contains_text()
  841. And I press "Continue" # behat_forms::press_button()
  842. And I should see "What language is being spoken?" # behat_general::assert_page_contains_text()
  843. And "//*[contains(@class, 'answeroption')]//img[contains(@src, 'pluginfile.php')]" "xpath_element" should exist # behat_general::should_exist()
  844. And "//*[contains(@class, 'answeroption')]//img[contains(@src, 'flag-france.jpg')]" "xpath_element" should exist # behat_general::should_exist()
  845.  
  846. @mod @mod_lesson @_file_upload
  847. Feature: In a lesson activity, teacher can add an essay question
  848. As a teacher
  849. I need to add an essay question in a lesson and grade student attempts
  850.  
  851. @javascript
  852. Scenario: questions with essay question # /home/rajesh/moodles/integration/moodle/mod/lesson/tests/behat/lesson_essay_question.feature:7
  853. Given the following "users" exist: # behat_data_generators::the_following_exist()
  854. | username | firstname | lastname | email |
  855. | teacher1 | Teacher | 1 | teacher1@example.com |
  856. | student1 | Student | 1 | student1@example.com |
  857. And the following "courses" exist: # behat_data_generators::the_following_exist()
  858. | fullname | shortname | category |
  859. | Course 1 | C1 | 0 |
  860. And the following "course enrolments" exist: # behat_data_generators::the_following_exist()
  861. | user | course | role |
  862. | teacher1 | C1 | editingteacher |
  863. | student1 | C1 | student |
  864. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  865. Given I set the field "Username" to "teacher1" # behat_forms::i_set_the_field_to()
  866. Given I set the field "Password" to "teacher1" # behat_forms::i_set_the_field_to()
  867. Given I press "Log in" # behat_forms::press_button()
  868. And I follow "Course 1" # behat_general::click_link()
  869. Given I press "Turn editing on" # behat_forms::press_button()
  870. Given I add a "Lesson" to section "1" # behat_course::i_add_to_section()
  871. Given I set the following fields to these values: # behat_forms::i_set_the_following_fields_to_these_values()
  872. | Name | Test lesson name |
  873. | Description | Test lesson description |
  874. | Use default feedback | Yes |
  875. Given I press "Save and return to course" # behat_forms::press_button()
  876. And I follow "Test lesson name" # behat_general::click_link()
  877. And I follow "Add a question page" # behat_general::click_link()
  878. And I set the field "Select a question type" to "Essay" # behat_forms::i_set_the_field_to()
  879. And I press "Add a question page" # behat_forms::press_button()
  880. And I set the following fields to these values: # behat_forms::i_set_the_following_fields_to_these_values()
  881. | Page title | Essay question |
  882. | Page contents | <p>Please write a story about a <b>frog</b>.</p> |
  883. And I press "Save page" # behat_forms::press_button()
  884. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  885. When I follow "Log out" # behat_general::click_link()
  886. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  887. Given I set the field "Username" to "student1" # behat_forms::i_set_the_field_to()
  888. Given I set the field "Password" to "student1" # behat_forms::i_set_the_field_to()
  889. Given I press "Log in" # behat_forms::press_button()
  890. And I follow "Course 1" # behat_general::click_link()
  891. When I follow "Test lesson name" # behat_general::click_link()
  892. Then I should see "Please write a story about a frog." # behat_general::assert_page_contains_text()
  893. And I set the field "Your answer" to "<p>Once upon a time there was a little <b>green</b> frog." # behat_forms::i_set_the_field_to()
  894. And I press "Submit" # behat_forms::press_button()
  895. And I should see "Your answer" # behat_general::assert_page_contains_text()
  896. And I should see "Once upon a time there was a little green frog." # behat_general::assert_page_contains_text()
  897. And I should not see "&lt;b&gt;" # behat_general::assert_page_not_contains_text()
  898. And I press "Continue" # behat_forms::press_button()
  899. And I should see "Congratulations - end of lesson reached" # behat_general::assert_page_contains_text()
  900. And I should see "You earned 0 out of 0 for the automatically graded questions." # behat_general::assert_page_contains_text()
  901. And I should see "Your 1 essay question(s) will be graded and added into your final score at a later date." # behat_general::assert_page_contains_text()
  902. And I should see "Your current grade without the essay question(s) is 0 out of 1." # behat_general::assert_page_contains_text()
  903. When I click on "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]" "xpath_element" # behat_general::i_click_on()
  904. When I follow "Log out" # behat_general::click_link()
  905. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  906. Given I set the field "Username" to "teacher1" # behat_forms::i_set_the_field_to()
  907. Given I set the field "Password" to "teacher1" # behat_forms::i_set_the_field_to()
  908. Given I press "Log in" # behat_forms::press_button()
  909. And I follow "Course 1" # behat_general::click_link()
  910. And I follow "Test lesson name" # behat_general::click_link()
  911. And I follow "Grade essays" # behat_general::click_link()
  912. And I should see "Student 1" # behat_general::assert_page_contains_text()
  913. And I should see "Essay question" # behat_general::assert_page_contains_text()
  914. And I follow "Essay question" # behat_general::click_link()
  915. And I should see "Student 1's response" # behat_general::assert_page_contains_text()
  916. And I should see "Once upon a time there was a little green frog." # behat_general::assert_page_contains_text()
  917. And I set the following fields to these values: # behat_forms::i_set_the_following_fields_to_these_values()
  918. | Your comments | <p>Well <b>done</b>.</p> |
  919. | Essay score | 1 |
  920. And I press "Save changes" # behat_forms::press_button()
  921. And I should see "Changes saved" # behat_general::assert_page_contains_text()
  922. And I follow "Reports" # behat_general::click_link()
  923. And I should see "Student 1" # behat_general::assert_page_contains_text()
  924. And I click on ".lesson-attempt-link" "css_element" in the "Student 1" "table_row" # behat_general::i_click_on_in_the()
  925. And I should see "Essay: Essay question" # behat_general::assert_page_contains_text()
  926. And I should see "Please write a story about a frog." # behat_general::assert_page_contains_text()
  927. And I should see "Once upon a time there was a little green frog." # behat_general::assert_page_contains_text()
  928. And I should see "Well done." # behat_general::assert_page_contains_text()
  929. And I should not see "&lt;b&gt;" # behat_general::assert_page_not_contains_text()
  930.  
  931. @mod @mod_lesson
  932. Feature: In a lesson activity, teacher can add embedded images in questions answers and responses
  933. As a teacher
  934. I need to add questions with images in answers and responses
  935.  
  936. @javascript @_file_upload
  937. Scenario: questions with images in answers and responses # /home/rajesh/moodles/integration/moodle/mod/lesson/tests/behat/questions_images.feature:7
  938. Given the following "users" exist: # behat_data_generators::the_following_exist()
  939. | username | firstname | lastname | email |
  940. | teacher1 | Teacher | 1 | teacher1@example.com |
  941. | student1 | Student | 1 | student1@example.com |
  942. And the following "courses" exist: # behat_data_generators::the_following_exist()
  943. | fullname | shortname | category |
  944. | Course 1 | C1 | 0 |
  945. And the following "course enrolments" exist: # behat_data_generators::the_following_exist()
  946. | user | course | role |
  947. | teacher1 | C1 | editingteacher |
  948. | student1 | C1 | student |
  949. Given I click on "Log in" "link" in the ".logininfo" "css_element" # behat_general::i_click_on_in_the()
  950. Given I set the field "Username" to "teacher1" # behat_forms::i_set_the_field_to()
  951. Given I set the field "Password" to "teacher1" # behat_forms::i_set_the_field_to()
  952. Given I press "Log in" # behat_forms::press_button()
  953. And I follow "Manage private files" # behat_general::click_link()
  954. And I upload "mod/lesson/tests/fixtures/moodle_logo.jpg" file to "Files" filemanager # behat_repository_upload::i_upload_file_to_filemanager()
  955. And I click on "Save changes" "button" # behat_general::i_click_on()
  956. When I am on homepage # behat_general::i_am_on_homepage()
  957. And I follow "Course 1" # behat_general::click_link()
  958. Given I press "Turn editing on" # behat_forms::press_button()
  959. Given I add a "Lesson" to section "1" # behat_course::i_add_to_section()
  960. Given I set the following fields to these values: # behat_forms::i_set_the_following_fields_to_these_values()
  961. | Name | Test lesson name |
  962. | Description | Test lesson description |
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement