MDL-60858 feedback: update behat tests for lang string change
[moodle.git] / mod / feedback / tests / behat / question_types.feature
blob78834baafec50a6e493ece766dbadfc8cc8f6d7f
1 @mod @mod_feedback
2 Feature: Test creating different types of feedback questions for anonymous feedback
3   In order to create feedbacks
4   As a teacher
5   I need to be able to add different question types
7   @javascript
8   Scenario: Create different types of questions in anonymous feedback with javascript enabled
9     Given the following "users" exist:
10       | username | firstname | lastname |
11       | teacher1 | Teacher   | 1        |
12       | student1 | Student   | 1        |
13       | student2 | Student   | 2        |
14     And the following "courses" exist:
15       | fullname | shortname |
16       | Course 1 | C1        |
17     And the following "course enrolments" exist:
18       | user     | course | role           |
19       | teacher1 | C1     | editingteacher |
20       | student1 | C1     | student        |
21       | student2 | C1     | student        |
22     And the following "activities" exist:
23       | activity   | name                | course | idnumber    |
24       | feedback   | Learning experience | C1     | feedback0   |
25     When I log in as "teacher1"
26     And I am on "Course 1" course homepage
27     And I follow "Learning experience"
28     And I click on "Edit questions" "link" in the "[role=main]" "css_element"
29     And I add a "Information" question to the feedback with:
30       | Question         | this is an information question |
31       | Label            | info                            |
32       | Information type | Course                          |
33     And I add a "Label" question to the feedback with:
34       | Contents | label text |
35     And I add a "Longer text answer" question to the feedback with:
36       | Question         | this is a longer text answer |
37       | Label            | longertext                   |
38     And I add a "Multiple choice" question to the feedback with:
39       | Question         | this is a multiple choice 1 |
40       | Label            | multichoice1                |
41       | Multiple choice type | Multiple choice - single answer |
42       | Multiple choice values | option a\noption b\noption c  |
43     And I add a "Multiple choice" question to the feedback with:
44       | Question                       | this is a multiple choice 2        |
45       | Label                          | multichoice2                       |
46       | Multiple choice type           | Multiple choice - multiple answers |
47       | Hide the "Not selected" option | Yes                                |
48       | Multiple choice values         | option d\noption e\noption f       |
49     And I add a "Multiple choice" question to the feedback with:
50       | Question                       | this is a multiple choice 3        |
51       | Label                          | multichoice3                       |
52       | Multiple choice type           | Multiple choice - single answer allowed (dropdownlist) |
53       | Multiple choice values         | option g\noption h\noption i                           |
54     And I add a "Multiple choice (rated)" question to the feedback with:
55       | Question               | this is a multiple choice rated |
56       | Label                  | multichoice4                    |
57       | Multiple choice type   | Multiple choice - single answer |
58       | Multiple choice values | 0/option k\n1/option l\n5/option m |
59     And I add a "Numeric answer" question to the feedback with:
60       | Question               | this is a numeric answer |
61       | Label                  | numeric                  |
62       | Range from             | 0                        |
63       | Range to               | 100                      |
64     And I add a "Short text answer" question to the feedback with:
65       | Question               | this is a short text answer |
66       | Label                  | shorttext                   |
67       | Maximum characters accepted | 200                    |
68     And I log out
69     And I log in as "student1"
70     And I am on "Course 1" course homepage
71     And I follow "Learning experience"
72     And I follow "Answer the questions"
73     And I set the following fields to these values:
74       | this is a longer text answer | my long answer |
75       | option b                     | 1              |
76       | option d                     | 1              |
77       | option f                     | 1              |
78       | this is a multiple choice 3  | option h       |
79       | option l                     | 1              |
80       | this is a numeric answer (0 - 100) | 35       |
81       | this is a short text answer  | hello          |
82     And I press "Submit your answers"
83     And I log out
84     And I log in as "student2"
85     And I am on "Course 1" course homepage
86     And I follow "Learning experience"
87     And I follow "Answer the questions"
88     And I set the following fields to these values:
89       | this is a longer text answer | lots of feedbacks |
90       | option a                     | 1              |
91       | option d                     | 1              |
92       | option e                     | 1              |
93       | this is a multiple choice 3  | option i       |
94       | option m                     | 1              |
95       | this is a numeric answer (0 - 100) | 71       |
96       | this is a short text answer  | no way         |
97     And I press "Submit your answers"
98     And I log out
99     When I log in as "teacher1"
100     And I am on "Course 1" course homepage
101     And I follow "Learning experience"
102     And I navigate to "Analysis" in current page administration
103     And I should see "Submitted answers: 2"
104     And I should see "Questions: 8"
105     And I log out
106     And I log in as "teacher1"
107     And I am on "Course 1" course homepage
108     And I follow "Learning experience"
109     And I navigate to "Analysis" in current page administration
110     And I should see "C1" in the "(info)" "table"
111     And I should see "my long answer" in the "(longertext)" "table"
112     And I should see "lots of feedbacks" in the "(longertext)" "table"
113     And I show chart data for the "multichoice2" feedback
114     And I should see "2 (100.00 %)" in the "option d" "table_row"
115     And I should see "1 (50.00 %)" in the "option e" "table_row"
116     And I should see "1 (50.00 %)" in the "option f" "table_row"
117     And I show chart data for the "multichoice3" feedback
118     And I should see "0" in the "option g" "table_row"
119     And I should not see "%" in the "option g" "table_row"
120     And I should see "1 (50.00 %)" in the "option h" "table_row"
121     And I should see "1 (50.00 %)" in the "option i" "table_row"
122     And I show chart data for the "multichoice4" feedback
123     And I should see "0" in the "option k" "table_row"
124     And I should not see "%" in the "(0) option k" "table_row"
125     And I should see "1 (50.00 %)" in the "(1) option l" "table_row"
126     And I should see "1 (50.00 %)" in the "(5) option m" "table_row"
127     And I should see "Average: 3.00"
128     And I should see "35" in the "(numeric)" "table"
129     And I should see "71" in the "(numeric)" "table"
130     And I should see "Average: 53.00" in the "(numeric)" "table"
131     And I should see "no way" in the "(shorttext)" "table"
132     And I should see "hello" in the "(shorttext)" "table"
133     And I show chart data for the "multichoice1" feedback
134     And I should see "1 (50.00 %)" in the "option a" "table_row"
135     And I should see "1 (50.00 %)" in the "option b" "table_row"
136     And I log out