MDL-52964 Qtype: Add behat tests to core question types
[moodle.git] / question / type / essay / tests / behat / edit.feature
blob9f032147f517f75031c4194a13a288a046811439
1 @qtype @qtype_essay
2 Feature: Test editing an Essay question
3   As a teacher
4   In order to be able to update my Essay question
5   I need to edit them
7   Background:
8     Given the following "users" exist:
9       | username | firstname | lastname | email                |
10       | teacher1 | T1        | Teacher1 | teacher1@example.com |
11     And the following "courses" exist:
12       | fullname | shortname | category |
13       | Course 1 | C1        | 0        |
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      | template         |
22       | Test questions   | essay | essay-001 | editor           |
23       | Test questions   | essay | essay-002 | editorfilepicker |
24       | Test questions   | essay | essay-003 | plain            |
25     And I log in as "teacher1"
26     And I follow "Course 1"
27     And I navigate to "Question bank" node in "Course administration"
29   @javascript
30   Scenario: Edit an Essay question
31     When I click on "Edit" "link" in the "essay-001" "table_row"
32     And I set the following fields to these values:
33       | Question name | |
34     And I press "id_submitbutton"
35     Then I should see "You must supply a value here."
36     When I set the following fields to these values:
37       | Question name   | Edited essay-001 name |
38       | Response format | No inline text        |
39     And I press "id_submitbutton"
40     Then I should see "When \"no inline text\" is selected, or responses are optional, you must allow at least one attachment."
41     When I set the following fields to these values:
42       | Response format | Plain text |
43     And I press "id_submitbutton"
44     Then I should see "Edited essay-001 name"