1 |
efrain |
1 |
@qformat @qformat_xml
|
|
|
2 |
Feature: Test importing questions from Moodle XML format.
|
|
|
3 |
In order to reuse questions
|
|
|
4 |
As an teacher
|
|
|
5 |
I need to be able to import them in XML format.
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "courses" exist:
|
|
|
9 |
| fullname | shortname | format |
|
|
|
10 |
| Course 1 | C1 | topics |
|
|
|
11 |
And the following "users" exist:
|
|
|
12 |
| username | firstname |
|
|
|
13 |
| teacher | Teacher |
|
|
|
14 |
And the following "course enrolments" exist:
|
|
|
15 |
| user | course | role |
|
|
|
16 |
| teacher | C1 | editingteacher |
|
|
|
17 |
|
|
|
18 |
@javascript @_file_upload
|
|
|
19 |
Scenario: import some true/false questions from Moodle XML format
|
|
|
20 |
When I am on the "Course 1" "core_question > course question import" page logged in as "teacher"
|
|
|
21 |
And I set the field "id_format_xml" to "1"
|
|
|
22 |
And I upload "question/format/xml/tests/fixtures/truefalse.xml" file to "Import" filemanager
|
|
|
23 |
And I press "id_submitbutton"
|
|
|
24 |
Then I should see "Parsing questions from import file."
|
|
|
25 |
And I should see "Importing 2 questions from file"
|
|
|
26 |
And I should see "is an acronym for Modular Object-Oriented Dynamic Learning Education"
|
|
|
27 |
And I should see "is an acronym for Modular Object-Oriented Dynamic Learning Environment"
|
|
|
28 |
When I press "Continue"
|
|
|
29 |
Then I should see "Moodle acronym (False)"
|
|
|
30 |
Then I should see "Moodle acronym (True)"
|
|
|
31 |
|
|
|
32 |
# Now export again.
|
|
|
33 |
When I am on the "Course 1" "core_question > course question export" page logged in as "teacher"
|
|
|
34 |
And I set the field "id_format_xml" to "1"
|
|
|
35 |
And I set the field "Export category" to "TrueFalse"
|
|
|
36 |
And I press "Export questions to file"
|
|
|
37 |
Then following "click here" should download between "57100" and "58150" bytes
|
|
|
38 |
|
|
|
39 |
@javascript @_file_upload
|
|
|
40 |
Scenario: import some multiple choice questions from Moodle XML format
|
|
|
41 |
When I am on the "Course 1" "core_question > course question import" page logged in as "teacher"
|
|
|
42 |
And I set the field "id_format_xml" to "1"
|
|
|
43 |
And I upload "question/format/xml/tests/fixtures/multichoice.xml" file to "Import" filemanager
|
|
|
44 |
And I press "id_submitbutton"
|
|
|
45 |
Then I should see "Parsing questions from import file."
|
|
|
46 |
And I should see "Importing 1 questions from file"
|
|
|
47 |
And I should see "What language is being spoken?"
|
|
|
48 |
When I press "Continue"
|
|
|
49 |
Then I should see "Greeting"
|
|
|
50 |
|
|
|
51 |
@javascript @_file_upload
|
|
|
52 |
Scenario: import some multi-answer questions from Moodle XML format
|
|
|
53 |
When I am on the "Course 1" "core_question > course question import" page logged in as "teacher"
|
|
|
54 |
And I set the field "id_format_xml" to "1"
|
|
|
55 |
And I upload "question/format/xml/tests/fixtures/multianswer.xml" file to "Import" filemanager
|
|
|
56 |
And I press "id_submitbutton"
|
|
|
57 |
Then I should see "Parsing questions from import file."
|
|
|
58 |
And I should see "Importing 1 questions from file"
|
|
|
59 |
And I should see "Match the following cities with the correct state,"
|
|
|
60 |
When I press "Continue"
|
|
|
61 |
Then I should see "cloze with images"
|
|
|
62 |
|
|
|
63 |
@javascript @_file_upload
|
|
|
64 |
Scenario: import some questions with legacy-style images from Moodle XML format
|
|
|
65 |
When I am on the "Course 1" "core_question > course question import" page logged in as "teacher"
|
|
|
66 |
And I set the field "id_format_xml" to "1"
|
|
|
67 |
And I upload "question/format/xml/tests/fixtures/sample_questions_with_old_image_tag.xml" file to "Import" filemanager
|
|
|
68 |
And I press "id_submitbutton"
|
|
|
69 |
Then I should see "Parsing questions from import file."
|
|
|
70 |
And I should see "Importing 2 questions from file"
|
|
|
71 |
And I should see "This is a multianswer question with an image in the old"
|
|
|
72 |
And I should see "This is a multichoice question with an image in the old"
|
|
|
73 |
When I press "Continue"
|
|
|
74 |
Then I should see "cloze question with image"
|
|
|
75 |
Then I should see "mcq with image"
|