Proyectos de Subversion Moodle

Rev

Ir a la última revisión | | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@mod @mod_quiz @javascript
2
Feature: Adding questions to a quiz from the question bank
3
  In order to re-use questions
4
  As a teacher
5
  I want to add questions from the question bank
6
 
7
  Background:
8
    Given the following "users" exist:
9
      | username | firstname | lastname | email |
10
      | teacher1 | Teacher | 1 | teacher1@example.com |
11
    And the following "courses" exist:
12
      | fullname | shortname | format |
13
      | Course 1 | C1 | weeks |
14
    And the following "course enrolments" exist:
15
      | user | course | role |
16
      | teacher1 | C1 | editingteacher |
17
    And the following "activities" exist:
18
      | activity   | name   | intro                           | course | idnumber |
19
      | quiz       | Quiz 1 | Quiz 1 for testing the Add menu | C1     | quiz1    |
20
    And the following "question categories" exist:
21
      | contextlevel | reference | name           |
22
      | Course       | C1        | Test questions |
23
    And the following "questions" exist:
24
      | questioncategory | qtype     | name             | user     | questiontext     | idnumber |
25
      | Test questions   | essay     | question 01 name | admin    | Question 01 text |          |
26
      | Test questions   | essay     | question 02 name | teacher1 | Question 02 text | qidnum   |
27
 
28
  Scenario: The questions can be filtered by tag
29
    Given I am on the "question 01 name" "core_question > edit" page logged in as teacher1
30
    And I set the following fields to these values:
31
      | Tags | foo |
32
    And I press "id_submitbutton"
33
    And I choose "Edit question" action for "question 02 name" in the question bank
34
    And I set the following fields to these values:
35
      | Tags | bar |
36
    And I press "id_submitbutton"
37
    When I am on the "Quiz 1" "mod_quiz > Edit" page
38
    And I open the "last" add to quiz menu
39
    And I follow "from question bank"
40
    Then I should see "foo" in the "question 01 name" "table_row"
41
    And I should see "bar" in the "question 02 name" "table_row"
42
    And I should see "qidnum" in the "question 02 name" "table_row"
43
    When I apply question bank filter "Tag" with value "foo"
44
    And I should see "question 01 name" in the "categoryquestions" "table"
45
    And I should not see "question 02 name" in the "categoryquestions" "table"
46
 
47
  Scenario: The question modal can be paginated
48
    Given the following "questions" exist:
49
      | questioncategory | qtype     | name             | user     | questiontext     |
50
      | Test questions   | essay     | question 03 name | teacher1 | Question 03 text |
51
      | Test questions   | essay     | question 04 name | teacher1 | Question 04 text |
52
      | Test questions   | essay     | question 05 name | teacher1 | Question 05 text |
53
      | Test questions   | essay     | question 06 name | teacher1 | Question 06 text |
54
      | Test questions   | essay     | question 07 name | teacher1 | Question 07 text |
55
      | Test questions   | essay     | question 08 name | teacher1 | Question 08 text |
56
      | Test questions   | essay     | question 09 name | teacher1 | Question 09 text |
57
      | Test questions   | essay     | question 10 name | teacher1 | Question 10 text |
58
      | Test questions   | essay     | question 11 name | teacher1 | Question 11 text |
59
      | Test questions   | essay     | question 12 name | teacher1 | Question 12 text |
60
      | Test questions   | essay     | question 13 name | teacher1 | Question 13 text |
61
      | Test questions   | essay     | question 14 name | teacher1 | Question 14 text |
62
      | Test questions   | essay     | question 15 name | teacher1 | Question 15 text |
63
      | Test questions   | essay     | question 16 name | teacher1 | Question 16 text |
64
      | Test questions   | essay     | question 17 name | teacher1 | Question 17 text |
65
      | Test questions   | essay     | question 18 name | teacher1 | Question 18 text |
66
      | Test questions   | essay     | question 19 name | teacher1 | Question 19 text |
67
      | Test questions   | essay     | question 20 name | teacher1 | Question 20 text |
68
      | Test questions   | essay     | question 21 name | teacher1 | Question 21 text |
69
      | Test questions   | essay     | question 22 name | teacher1 | Question 22 text |
70
    And I log in as "teacher1"
71
    And I am on the "Quiz 1" "mod_quiz > Edit" page
72
    And I open the "last" add to quiz menu
73
    And I follow "from question bank"
74
    And I click on "2" "link" in the ".pagination" "css_element"
75
    Then I should see "question 21 name" in the "categoryquestions" "table"
76
    And I should see "question 22 name" in the "categoryquestions" "table"
77
    And I should not see "question 01 name" in the "categoryquestions" "table"
78
    And I click on "1" "link" in the ".pagination" "css_element"
79
    And I should see "question 01 name" in the "categoryquestions" "table"
80
 
81
  Scenario: Questions are added in the right place with multiple sections
82
    Given the following "questions" exist:
83
      | questioncategory | qtype | name             | questiontext     |
84
      | Test questions   | essay | question 03 name | question 03 text |
85
    And quiz "Quiz 1" contains the following questions:
86
      | question         | page |
87
      | question 01 name | 1    |
88
      | question 02 name | 2    |
89
    And quiz "Quiz 1" contains the following sections:
90
      | heading   | firstslot | shuffle |
91
      | Section 1 | 1         | 0       |
92
      | Section 2 | 2         | 0       |
93
    And I log in as "teacher1"
94
    And I am on the "Quiz 1" "mod_quiz > Edit" page
95
    When I open the "Page 1" add to quiz menu
96
    And I follow "from question bank"
97
    And I set the field with xpath "//tr[contains(normalize-space(.), 'question 03 name')]//input[@type='checkbox']" to "1"
98
    And I click on "Add selected questions to the quiz" "button"
99
    Then I should see "question 03 name" on quiz page "1"
100
    And I should see "question 01 name" before "question 03 name" on the edit quiz page
101
 
102
  Scenario: Add several selected questions from the question bank
103
    Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
104
    When I open the "last" add to quiz menu
105
    And I follow "from question bank"
106
    And I set the field with xpath "//input[@type='checkbox' and @id='qbheadercheckbox']" to "1"
107
    And I press "Add selected questions to the quiz"
108
    Then I should see "question 01 name" on quiz page "1"
109
    And I should see "question 02 name" on quiz page "2"
110
 
111
  @javascript
112
  Scenario: Validate the sorting while adding questions from question bank
113
    Given the following "questions" exist:
114
      | questioncategory | qtype       | name              | questiontext          |
115
      | Test questions   | multichoice | question 03 name  | question 03 name text |
116
    And I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
117
    When I open the "last" add to quiz menu
118
    And I follow "from question bank"
119
    And I click on "Sort by Question ascending" "link"
120
    Then "question 01 name" "text" should appear before "question 02 name" "text"
121
    And I click on "Sort by Question descending" "link"
122
    And "question 03 name" "text" should appear before "question 01 name" "text"
123
    And I follow "Sort by Question type ascending"
124
    Then "question 01 name" "text" should appear before "question 03 name" "text"
125
    And I follow "Sort by Question type descending"
126
    Then "question 03 name" "text" should appear before "question 01 name" "text"
127
 
128
  Scenario: Shuffle option could be set before adding any question to the quiz
129
    Given the following "questions" exist:
130
      | questioncategory | qtype | name             | questiontext     |
131
      | Test questions   | essay | question 03 name | question 03 text |
132
    And I log in as "teacher1"
133
    And I am on the "Quiz 1" "mod_quiz > Edit" page
134
    When I set the field "Shuffle" to "1"
135
    And I open the "last" add to quiz menu
136
    And I follow "from question bank"
137
    Then I should see "question 01 name"