Merge branch 'MDL-57604-32' of git://github.com/danpoltawski/moodle into MOODLE_32_STABLE
[moodle.git] / question / tests / behat / edit_questions.feature
blob2824d5477b0bcf42b73a6b289abbe6017287ec54
1 @core @core_question
2 Feature: A teacher can edit questions in the question bank
3   In order to improve my questions
4   As a teacher
5   I need to be able to edit questions
7   Background:
8     Given the following "users" exist:
9       | username | firstname | lastname | email |
10       | teacher1 | Teacher | 1 | teacher1@example.com |
11     And the following "courses" exist:
12       | fullname | shortname | format |
13       | Course 1 | C1 | weeks |
14     And the following "course enrolments" exist:
15       | user | course | role |
16       | teacher1 | C1 | editingteacher |
17     And the following "question categories" exist:
18       | contextlevel | reference | name           |
19       | Course       | C1        | Test questions |
20     And the following "questions" exist:
21       | questioncategory | qtype | name                       | questiontext                  |
22       | Test questions   | essay | Test question to be edited | Write about whatever you want |
23     And I log in as "teacher1"
24     And I follow "Course 1"
25     And I navigate to "Questions" node in "Course administration > Question bank"
27   @javascript
28   Scenario: Edit a previously created question
29     When I click on "Edit" "link" in the "Test question to be edited" "table_row"
30     And I set the following fields to these values:
31       | Question name | Edited question name |
32       | Question text | Write a lot about what you want |
33     And I press "id_submitbutton"
34     Then I should see "Edited question name"
35     And I should not see "Test question to be edited"
36     And "Edited question name" row "Created by" column of "categoryquestions" table should contain "Admin User"
37     And "Edited question name" row "Last modified by" column of "categoryquestions" table should contain "Teacher 1"
39   @javascript
40   Scenario: Editing a question can be cancelled
41     When I click on "Edit" "link" in the "Test question to be edited" "table_row"
42     And I set the field "Question name" to "Edited question name"
43     And I press "Cancel"
44     Then I should see "Test question to be edited"
45     And "Test question to be edited" row "Created by" column of "categoryquestions" table should contain "Admin User"
46     And "Test question to be edited" row "Last modified by" column of "categoryquestions" table should contain "Admin User"