1 |
efrain |
1 |
@qformat @qformat_gift
|
|
|
2 |
Feature: Test importing questions from GIFT format.
|
|
|
3 |
In order to reuse questions
|
|
|
4 |
As an teacher
|
|
|
5 |
I need to be able to import them in GIFT 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 |
And I am on the "Course 1" "core_question > course question import" page logged in as "teacher"
|
|
|
18 |
|
|
|
19 |
@javascript @_file_upload
|
|
|
20 |
Scenario: import some GIFT questions
|
|
|
21 |
When I set the field "id_format_gift" to "1"
|
|
|
22 |
And I upload "question/format/gift/tests/fixtures/questions.gift.txt" 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 9 questions from file"
|
|
|
26 |
And I should see "What's between orange and green in the spectrum?"
|
|
|
27 |
When I press "Continue"
|
|
|
28 |
Then I should see "colours"
|
|
|
29 |
|
|
|
30 |
# Now export again.
|
|
|
31 |
And I am on the "Course 1" "core_question > course question export" page
|
|
|
32 |
And I set the field "id_format_gift" to "1"
|
|
|
33 |
And I press "Export questions to file"
|
|
|
34 |
And following "click here" should download between "1500" and "1800" bytes
|
|
|
35 |
|
|
|
36 |
@javascript @_file_upload
|
|
|
37 |
Scenario: import a GIFT file which specifies the category
|
|
|
38 |
When I set the field "id_format_gift" to "1"
|
|
|
39 |
And I upload "question/format/gift/tests/fixtures/questions_in_category.gift.txt" file to "Import" filemanager
|
|
|
40 |
And I press "id_submitbutton"
|
|
|
41 |
Then I should see "Parsing questions from import file."
|
|
|
42 |
And I should see "Importing 4 questions from file"
|
|
|
43 |
And I should see "Match the activity to the description."
|
|
|
44 |
When I press "Continue"
|
|
|
45 |
Then I should see "Moodle activities"
|
|
|
46 |
|
|
|
47 |
@javascript @_file_upload
|
|
|
48 |
Scenario: import some GIFT questions with unsupported encoding
|
|
|
49 |
When I set the field "id_format_gift" to "1"
|
|
|
50 |
And I upload "question/format/gift/tests/fixtures/questions_encoding_windows-1252.gift.txt" file to "Import" filemanager
|
|
|
51 |
And I press "id_submitbutton"
|
|
|
52 |
Then I should see "The file you selected does not use UTF-8 character encoding. GIFT format files must use UTF-8."
|