2 Feature: Test importing questions from Moodle XML format.
3 In order to reuse questions
5 I need to be able to import them in XML format.
8 Given the following "courses" exist:
9 | fullname | shortname | format |
10 | Course 1 | C1 | topics |
11 And the following "users" exist:
12 | username | firstname |
14 And the following "course enrolments" exist:
15 | user | course | role |
16 | teacher | C1 | editingteacher |
17 And I log in as "teacher"
18 And I follow "Course 1"
20 @javascript @_file_upload
21 Scenario: import some true/false questions from Moodle XML format
22 When I navigate to "Import" node in "Course administration > Question bank"
23 And I set the field "id_format_xml" to "1"
24 And I upload "question/format/xml/tests/fixtures/truefalse.xml" file to "Import" filemanager
25 And I press "id_submitbutton"
26 Then I should see "Parsing questions from import file."
27 And I should see "Importing 2 questions from file"
28 And I should see "is an acronym for Modular Object-Oriented Dynamic Learning Education"
29 And I should see "is an acronym for Modular Object-Oriented Dynamic Learning Environment"
30 When I press "Continue"
31 Then I should see "Moodle acronym (False)"
32 Then I should see "Moodle acronym (True)"
34 @javascript @_file_upload
35 Scenario: import some multiple choice questions from Moodle XML format
36 When I navigate to "Import" node in "Course administration > Question bank"
37 And I set the field "id_format_xml" to "1"
38 And I upload "question/format/xml/tests/fixtures/multichoice.xml" file to "Import" filemanager
39 And I press "id_submitbutton"
40 Then I should see "Parsing questions from import file."
41 And I should see "Importing 1 questions from file"
42 And I should see "What language is being spoken?"
43 When I press "Continue"
44 Then I should see "Greeting"
46 @javascript @_file_upload
47 Scenario: import some multi-answer questions from Moodle XML format
48 When I navigate to "Import" node in "Course administration > Question bank"
49 And I set the field "id_format_xml" to "1"
50 And I upload "question/format/xml/tests/fixtures/multianswer.xml" file to "Import" filemanager
51 And I press "id_submitbutton"
52 Then I should see "Parsing questions from import file."
53 And I should see "Importing 1 questions from file"
54 And I should see "Match the following cities with the correct state,"
55 When I press "Continue"
56 Then I should see "cloze with images"
58 @javascript @_file_upload
59 Scenario: import some questions with legacy-style images from Moodle XML format
60 When I navigate to "Import" node in "Course administration > Question bank"
61 And I set the field "id_format_xml" to "1"
62 And I upload "question/format/xml/tests/fixtures/sample_questions_with_old_image_tag.xml" file to "Import" filemanager
63 And I press "id_submitbutton"
64 Then I should see "Parsing questions from import file."
65 And I should see "Importing 2 questions from file"
66 And I should see "This is a multianswer question with an image in the old"
67 And I should see "This is a multichoice question with an image in the old"
68 When I press "Continue"
69 Then I should see "cloze question with image"
70 Then I should see "mcq with image"