Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
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 |
1441 ariadna 17
    And the following "activities" exist:
18
      | activity   | name    | course | idnumber |
19
      | qbank      | Qbank 1 | C1     | qbank1   |
20
    And I am on the "Qbank 1" "core_question > question import" page logged in as "teacher"
1 efrain 21
 
22
  @javascript @_file_upload
23
  Scenario: import some GIFT questions
24
    When I set the field "id_format_gift" to "1"
25
    And I upload "question/format/gift/tests/fixtures/questions.gift.txt" file to "Import" filemanager
26
    And I press "id_submitbutton"
27
    Then I should see "Parsing questions from import file."
28
    And I should see "Importing 9 questions from file"
29
    And I should see "What's between orange and green in the spectrum?"
30
    When I press "Continue"
31
    Then I should see "colours"
32
 
33
    # Now export again.
1441 ariadna 34
    And I am on the "Qbank 1" "core_question > question export" page
1 efrain 35
    And I set the field "id_format_gift" to "1"
36
    And I press "Export questions to file"
1441 ariadna 37
    And following "click here" should download a file that:
38
      | Has mimetype  | text/plain                                       |
39
      | Contains text | What's between orange and green in the spectrum? |
1 efrain 40
 
41
  @javascript @_file_upload
42
  Scenario: import a GIFT file which specifies the category
43
    When I set the field "id_format_gift" to "1"
44
    And I upload "question/format/gift/tests/fixtures/questions_in_category.gift.txt" file to "Import" filemanager
45
    And I press "id_submitbutton"
46
    Then I should see "Parsing questions from import file."
47
    And I should see "Importing 4 questions from file"
48
    And I should see "Match the activity to the description."
49
    When I press "Continue"
50
    Then I should see "Moodle activities"
51
 
52
  @javascript @_file_upload
53
  Scenario: import some GIFT questions with unsupported encoding
54
    When I set the field "id_format_gift" to "1"
55
    And I upload "question/format/gift/tests/fixtures/questions_encoding_windows-1252.gift.txt" file to "Import" filemanager
56
    And I press "id_submitbutton"
57
    Then I should see "The file you selected does not use UTF-8 character encoding. GIFT format files must use UTF-8."