MDL-52964 Qtype: Add behat tests to core question types
[moodle.git] / question / type / match / tests / behat / backup_and_restore.feature
blob3ea996afb4a4fd2547bbe4f2eb9819193b3b9a09
1 @qtype @qtype_match
2 Feature: Test duplicating a quiz containing a Matching question
3   As a teacher
4   In order re-use my courses containing Matching 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   | match | matching-001 | foursubq |
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       | matching-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 Matching 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 "matching-001" "table_row"
34     Then the following fields match these values:
35       | Question name                      | matching-001          |
36       | Question text                      | Classify the animals. |
37       | General feedback                   | General feedback.     |
38       | Default mark                       | 1                     |
39       | Shuffle                            | 1                     |
40       | Question 1                         | frog                  |
41       | Question 2                         | cat                   |
42       | Question 3                         | newt                  |
43       | Question 4                         |                       |
44       | id_subanswers_0                    | amphibian             |
45       | id_subanswers_1                    | mammal                |
46       | id_subanswers_2                    | amphibian             |
47       | id_subanswers_3                    | insect                |