1 |
efrain |
1 |
@mod @mod_quiz @javascript
|
|
|
2 |
Feature: Editing random questions already in a quiz based on category and tags
|
|
|
3 |
In order to have better assessment
|
|
|
4 |
As a teacher
|
|
|
5 |
I want to be able to update how questions are randomly picked from the question bank
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | Teacher | 1 | t1@example.com |
|
|
|
11 |
And the following "courses" exist:
|
|
|
12 |
| fullname | shortname |
|
|
|
13 |
| Course 1 | C1 |
|
|
|
14 |
And the following "course enrolments" exist:
|
|
|
15 |
| user | course | role |
|
|
|
16 |
| teacher1 | C1 | editingteacher |
|
|
|
17 |
And the following "activities" exist:
|
1441 |
ariadna |
18 |
| activity | name | intro | course | idnumber |
|
|
|
19 |
| quiz | Quiz 1 | Quiz 1 for testing the Add random question form | C1 | quiz1 |
|
|
|
20 |
| qbank | Qbank 1 | Qbank 1 for testing the Edit random question form | C1 | qbank1 |
|
1 |
efrain |
21 |
And the following "question categories" exist:
|
1441 |
ariadna |
22 |
| contextlevel | reference | name |
|
|
|
23 |
| Activity module | quiz1 | Questions Category 1|
|
|
|
24 |
| Activity module | quiz1 | Questions Category 2|
|
|
|
25 |
| Activity module | qbank1 | Questions Category 3|
|
1 |
efrain |
26 |
And the following "questions" exist:
|
|
|
27 |
| questioncategory | qtype | name | user | questiontext |
|
|
|
28 |
| Questions Category 1 | essay | question 1 name | admin | Question 1 text |
|
|
|
29 |
| Questions Category 1 | essay | question 2 name | teacher1 | Question 2 text |
|
1441 |
ariadna |
30 |
| Questions Category 3 | essay | question 3 name | teacher1 | Question 3 text |
|
1 |
efrain |
31 |
And the following "core_question > Tags" exist:
|
|
|
32 |
| question | tag |
|
|
|
33 |
| question 1 name | easy |
|
|
|
34 |
| question 1 name | essay |
|
|
|
35 |
| question 2 name | hard |
|
|
|
36 |
| question 2 name | essay |
|
1441 |
ariadna |
37 |
| question 3 name | essay |
|
1 |
efrain |
38 |
|
|
|
39 |
Scenario: Editing tags on one slot does not delete the rest
|
|
|
40 |
Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
|
|
|
41 |
And I open the "last" add to quiz menu
|
|
|
42 |
And I follow "a random question"
|
1441 |
ariadna |
43 |
And I apply question bank filter "Category" with value "Questions Category 1"
|
1 |
efrain |
44 |
# To actually reproduce MDL-68733 it would be better to set tags easy,essay here, and then below just delete one tag.
|
|
|
45 |
# However, the state of Behat for autocomplete fields does not let us actually do that.
|
|
|
46 |
And I apply question bank filter "Tag" with value "easy"
|
|
|
47 |
And I press "Add random question"
|
|
|
48 |
And I open the "Page 1" add to quiz menu
|
|
|
49 |
And I follow "a random question"
|
1441 |
ariadna |
50 |
And I apply question bank filter "Category" with value "Questions Category 1"
|
1 |
efrain |
51 |
And I apply question bank filter "Tag" with value "hard"
|
|
|
52 |
And I press "Add random question"
|
|
|
53 |
And I follow "Add page break"
|
1441 |
ariadna |
54 |
When I click on "Configure question" "link" in the "Random (Questions Category 1) based on filter condition with tags: easy" "list_item"
|
1 |
efrain |
55 |
And I apply question bank filter "Tag" with value "essay"
|
|
|
56 |
And I press "Update filter conditions"
|
1441 |
ariadna |
57 |
Then I should see "Random (Questions Category 1) based on filter condition with tags: essay" on quiz page "1"
|
|
|
58 |
And I should see "Random (Questions Category 1) based on filter condition with tags: hard" on quiz page "2"
|
|
|
59 |
And I click on "Configure question" "link" in the "Random (Questions Category 1) based on filter condition with tags: hard" "list_item"
|
1 |
efrain |
60 |
And "hard" "autocomplete_selection" should be visible
|
1441 |
ariadna |
61 |
|
|
|
62 |
Scenario: Switch banks when editing a random question
|
|
|
63 |
Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
|
|
|
64 |
And I open the "last" add to quiz menu
|
|
|
65 |
And I follow "a random question"
|
|
|
66 |
And I apply question bank filter "Category" with value "Questions Category 1"
|
|
|
67 |
And I apply question bank filter "Tag" with value "essay"
|
|
|
68 |
And I press "Add random question"
|
|
|
69 |
When I click on "Configure question" "link" in the "Random (Questions Category 1) based on filter condition with tags: essay" "list_item"
|
|
|
70 |
And I press "Switch bank"
|
|
|
71 |
And I click on "Qbank 1" "link" in the "Select question bank" "dialogue"
|
|
|
72 |
And the field "filter-value-qtagids" matches value "essay"
|
|
|
73 |
And I apply question bank filter "Category" with value "Questions Category 3 (1)"
|
|
|
74 |
And I should see "question 3 name"
|
|
|
75 |
And I press "Update filter conditions"
|
|
|
76 |
Then I should see "Random (Questions Category 3) based on filter condition with tags: essay" on quiz page "1"
|
|
|
77 |
|
|
|
78 |
Scenario: "Go back" from bank switcher keeps existing filter values.
|
|
|
79 |
Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
|
|
|
80 |
And I open the "last" add to quiz menu
|
|
|
81 |
And I follow "a random question"
|
|
|
82 |
And I apply question bank filter "Category" with value "Questions Category 1"
|
|
|
83 |
And I apply question bank filter "Tag" with value "essay"
|
|
|
84 |
And I press "Add random question"
|
|
|
85 |
When I click on "Configure question" "link" in the "Random (Questions Category 1) based on filter condition with tags: essay" "list_item"
|
|
|
86 |
And the field "filter-value-category" matches value " Questions Category 1 (2)"
|
|
|
87 |
And the field "filter-value-qtagids" matches value "essay"
|
|
|
88 |
And I press "Switch bank"
|
|
|
89 |
And I press "Go back"
|
|
|
90 |
Then the field "filter-value-category" matches value " Questions Category 1 (2)"
|
|
|
91 |
And the field "filter-value-qtagids" matches value "essay"
|