MDL-52964 Qtype: Add behat tests to core question types
[moodle.git] / question / type / shortanswer / tests / behat / backup_and_restore.feature
blob11d7fa7999f949cc23c7b4714eeeb0c7086b0dfe
1 @qtype @qtype_short asnswer
2 Feature: Test duplicating a quiz containing a Short answer question
3   As a teacher
4   In order re-use my courses containing Short answer questions
5   I need to be able to backup and restore them
7   Background:
8     And the following "courses" exist:
9       | fullname | shortname | category |
10       | Course 1 | C1        | 0        |
11     And the following "question categories" exist:
12       | contextlevel | reference | name           |
13       | Course       | C1        | Test questions |
14     And the following "questions" exist:
15       | questioncategory | qtype       | name            | template |
16       | Test questions   | shortanswer | shortanswer-001 | frogtoad |
17     And the following "activities" exist:
18       | activity   | name      | course | idnumber |
19       | quiz       | Test quiz | C1     | quiz1    |
20     And quiz "Test quiz" contains the following questions:
21       | shortanswer-001 | 1 |
22     And I log in as "admin"
23     And I am on site homepage
24     And I follow "Course 1"
26   @javascript
27   Scenario: Backup and restore a course containing a Short answer question
28     When I backup "Course 1" course using this options:
29       | Confirmation | Filename | test_backup.mbz |
30     And I restore "test_backup.mbz" backup into a new course using this options:
31       | Schema | Course name | Course 2 |
32     And I navigate to "Question bank" node in "Course administration"
33     And I click on "Edit" "link" in the "shortanswer-001" "table_row"
34     Then the following fields match these values:
35       | Question name        | shortanswer-001                                   |
36       | Question text        | Name an amphibian: __________                     |
37       | General feedback     | Generalfeedback: frog or toad would have been OK. |
38       | Default mark         | 1                                                 |
39       | Case sensitivity     | No, case is unimportant                           |
40       | id_answer_0          | frog                                              |
41       | id_fraction_0        | 100%                                              |
42       | id_feedback_0        | Frog is a very good answer.                       |
43       | id_answer_1          | toad                                              |
44       | id_fraction_1        | 80%                                               |
45       | id_feedback_1        | Toad is an OK good answer.                        |
46       | id_answer_2          | *                                                 |
47       | id_fraction_2        | None                                              |
48       | id_feedback_2        | That is a bad answer.                             |