MDL-52964 Qtype: Add behat tests to core question types
[moodle.git] / question / type / multichoice / tests / behat / backup_and_restore.feature
bloba5e4bb66d2b53e7a8566f1c28aba9e8a0589d1a1
1 @qtype @qtype_multichoice
2 Feature: Test duplicating a quiz containing a Multiple choice question
3   As a teacher
4   In order re-use my courses containing Multiple choice 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   | multichoice     | Multi-choice-001 | two_of_four |
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       | Multi-choice-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 Multiple choice 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 "Multi-choice-001" "table_row"
34     Then the following fields match these values:
35       | Question name                      | Multi-choice-001                   |
36       | Question text                      | Which are the odd numbers?         |
37       | General feedback                   | The odd numbers are One and Three. |
38       | Default mark                       | 1                                  |
39       | One or multiple answers?           | Multiple answers allowed           |
40       | Shuffle the choices?               | 1                                  |
41       | Choice 1                           | One                                |
42       | Choice 2                           | Two                                |
43       | Choice 3                           | Three                              |
44       | Choice 4                           | Four                               |
45       | id_fraction_0                      | 50%                                |
46       | id_fraction_1                      | None                               |
47       | id_fraction_2                      | 50%                                |
48       | id_fraction_3                      | None                               |
49       | For any correct response           | Well done!                         |
50       | For any partially correct response | Parts, but only parts, of your response are correct. |
51       | For any incorrect response         | That is not right at all.          |