1 |
efrain |
1 |
@mod @mod_lesson
|
|
|
2 |
Feature: In a lesson activity, I need to edit pages in the lesson taking into account locale settings
|
|
|
3 |
|
|
|
4 |
Background:
|
|
|
5 |
Given the following "users" exist:
|
|
|
6 |
| username | firstname | lastname | email |
|
|
|
7 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
8 |
| student1 | Student | 1 | student1@example.com |
|
|
|
9 |
And the following "courses" exist:
|
|
|
10 |
| fullname | shortname | category |
|
|
|
11 |
| Course 1 | C1 | 0 |
|
|
|
12 |
And the following "course enrolments" exist:
|
|
|
13 |
| user | course | role |
|
|
|
14 |
| teacher1 | C1 | editingteacher |
|
|
|
15 |
| student1 | C1 | student |
|
|
|
16 |
And the following "language customisations" exist:
|
|
|
17 |
| component | stringid | value |
|
|
|
18 |
| core_langconfig | decsep | # |
|
|
|
19 |
And the following "activities" exist:
|
|
|
20 |
| activity | name | course | idnumber | modattempts |
|
|
|
21 |
| lesson | Test lesson name | C1 | lesson1 | 1 |
|
|
|
22 |
And the following "mod_lesson > page" exist:
|
|
|
23 |
| lesson | qtype | title | content |
|
|
|
24 |
| Test lesson name | numeric | Hardest question ever | 1 + 1? |
|
|
|
25 |
And the following "mod_lesson > answers" exist:
|
|
|
26 |
| page | answer | response | jumpto | score |
|
|
|
27 |
| Hardest question ever | 2.87 | Correct answer | End of lesson | 1 |
|
|
|
28 |
| Hardest question ever | 2.1:2.8 | Incorrect answer | This page | 0 |
|
|
|
29 |
|
|
|
30 |
Scenario: Create a numerical question with the locale specific variables
|
|
|
31 |
Given the following "activities" exist:
|
|
|
32 |
| activity | name | course | idnumber | modattempts |
|
|
|
33 |
| lesson | Empty lesson name | C1 | lesson2 | 1 |
|
|
|
34 |
And I am on the "Empty lesson name" "lesson activity" page logged in as teacher1
|
|
|
35 |
When I follow "Add a question page"
|
|
|
36 |
And I set the field "Select a question type" to "Numerical"
|
|
|
37 |
And I press "Add a question page"
|
|
|
38 |
And I set the following fields to these values:
|
|
|
39 |
| Page title | Second question |
|
|
|
40 |
| Page contents | 2 + 2? |
|
|
|
41 |
| id_answer_editor_0 | 4#87 |
|
|
|
42 |
| id_response_editor_0 | Correct answer |
|
|
|
43 |
| id_jumpto_0 | End of lesson |
|
|
|
44 |
| id_score_0 | 1 |
|
|
|
45 |
| id_answer_editor_1 | 4#1:4#8 |
|
|
|
46 |
| id_response_editor_1 | Incorrect answer |
|
|
|
47 |
| id_jumpto_1 | This page |
|
|
|
48 |
| id_score_1 | 0 |
|
|
|
49 |
And I press "Save page"
|
|
|
50 |
And I follow "Second question"
|
|
|
51 |
Then I should see "4#87"
|
|
|
52 |
And I should see "4#1:4#8"
|
|
|
53 |
|
|
|
54 |
Scenario: Edit a numerical question with the locale specific variables
|
|
|
55 |
Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
|
|
56 |
And I edit the lesson
|
|
|
57 |
And I follow "Hardest question ever"
|
|
|
58 |
Then I should see "2#87"
|
|
|
59 |
And I should see "2#1:2#8"
|
|
|
60 |
|
|
|
61 |
Scenario: View the detailed page of lesson
|
|
|
62 |
Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
|
|
63 |
And I edit the lesson
|
|
|
64 |
And I select edit type "Expanded"
|
|
|
65 |
Then I should see "2#87"
|
|
|
66 |
And I should see "2#1:2#8"
|
|
|
67 |
|
|
|
68 |
Scenario: Attempt the lesson successfully as a student
|
|
|
69 |
Given I am on the "Test lesson name" "lesson activity" page logged in as student1
|
|
|
70 |
And I should see "1 + 1?"
|
|
|
71 |
And I set the following fields to these values:
|
|
|
72 |
| Your answer | 2#87 |
|
|
|
73 |
And I press "Submit"
|
|
|
74 |
Then I should see "Correct answer"
|
|
|
75 |
And I should see "2#87"
|
|
|
76 |
And I should not see "Incorrect answer"
|
|
|
77 |
And I press "Continue"
|
|
|
78 |
And I should see "Congratulations - end of lesson reached"
|
|
|
79 |
And I should see "Your score is 1 (out of 1)."
|
|
|
80 |
|
|
|
81 |
Scenario: Attempt the lesson unsuccessfully as a student
|
|
|
82 |
Given I am on the "Test lesson name" "lesson activity" page logged in as student1
|
|
|
83 |
And I should see "1 + 1?"
|
|
|
84 |
And I set the following fields to these values:
|
|
|
85 |
| Your answer | 2#7 |
|
|
|
86 |
And I press "Submit"
|
|
|
87 |
Then I should not see "Correct answer"
|
|
|
88 |
And I should see "2#7"
|
|
|
89 |
And I should see "Incorrect answer"
|
|
|
90 |
And I press "Continue"
|
|
|
91 |
And I should see "Congratulations - end of lesson reached"
|
|
|
92 |
And I should see "Your score is 0 (out of 1)."
|
|
|
93 |
|
|
|
94 |
Scenario: Attempt the lesson successfully as a student and review
|
|
|
95 |
Given I am on the "Test lesson name" "lesson activity" page logged in as student1
|
|
|
96 |
And I should see "1 + 1?"
|
|
|
97 |
And I set the following fields to these values:
|
|
|
98 |
| Your answer | 2#87 |
|
|
|
99 |
And I press "Submit"
|
|
|
100 |
Then I should see "Correct answer"
|
|
|
101 |
And I should see "2#87"
|
|
|
102 |
And I should not see "Incorrect answer"
|
|
|
103 |
And I press "Continue"
|
|
|
104 |
And I should see "Congratulations - end of lesson reached"
|
|
|
105 |
And I should see "Your score is 1 (out of 1)."
|
|
|
106 |
And I follow "Review lesson"
|
|
|
107 |
Then I should see "1 + 1?"
|
|
|
108 |
And the following fields match these values:
|
|
|
109 |
| Your answer | 2#87 |
|
|
|
110 |
|
|
|
111 |
Scenario: Edit lesson question page with updated locale setting and wrong answer
|
|
|
112 |
Given the following "language customisations" exist:
|
|
|
113 |
| component | stringid | value |
|
|
|
114 |
| core_langconfig | decsep | , |
|
|
|
115 |
And I log in as "teacher1"
|
|
|
116 |
When I am on the "Test lesson name" "lesson activity" page
|
|
|
117 |
And I edit the lesson
|
|
|
118 |
And I follow "Hardest question ever"
|
|
|
119 |
Then I should see "2,87"
|
|
|
120 |
And I should see "2,1:2,8"
|
|
|
121 |
And I am on the "Test lesson name" "lesson activity" page logged in as student1
|
|
|
122 |
And I should see "1 + 1?"
|
|
|
123 |
And I set the following fields to these values:
|
|
|
124 |
| Your answer | 2,7 |
|
|
|
125 |
And I press "Submit"
|
|
|
126 |
And I should see "Incorrect answer"
|
|
|
127 |
And I should see "2,7"
|
|
|
128 |
And I should not see "Correct answer"
|
|
|
129 |
And I press "Continue"
|
|
|
130 |
And I should see "Congratulations - end of lesson reached"
|
|
|
131 |
And I should see "Your score is 0 (out of 1)."
|