MDL-64506 mod_choice: fix behat issue with screensize
[moodle.git] / mod / choice / tests / behat / modify_choice.feature
CommitLineData
8676e7c3
MG
1@mod @mod_choice
2Feature: Teacher can modify choices of the students
3 In order to have all students choices
4 As a teacher
5 I need to be able to make choice for studnets
6
7 Background:
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | teacher1 | Teacher | 1 | teacher1@example.com |
11 | student1 | Student | 1 | student1@example.com |
12 | student2 | Student | 2 | student2@example.com |
13 | student3 | Student | 3 | student3@example.com |
14 And the following "courses" exist:
15 | fullname | shortname | category |
16 | Course 1 | C1 | 0 |
17 And the following "course enrolments" exist:
18 | user | course | role |
19 | teacher1 | C1 | editingteacher |
20 | student1 | C1 | student |
21 | student2 | C1 | student |
22 | student3 | C1 | student |
23 And the following "activities" exist:
24 | activity | name | intro | course | idnumber | option |
25 | choice | Choice name | Test choice description | C1 | choice1 | Option 1, Option 2, Option 3 |
26
27 @javascript
28 Scenario: Delete students choice response as a teacher
91e2e5e7
LB
29 When I log in as "teacher1"
30 And I am on "Course 1" course homepage
31 And I follow "Choice name"
32 And I navigate to "Edit settings" in current page administration
33 And I expand all fieldsets
34 And I set the field "Show column for unanswered" to "Yes"
35 And I press "Save and return to course"
36 And I log out
37 And I log in as "student1"
fdeeaff9 38 And I am on "Course 1" course homepage
8676e7c3
MG
39 And I choose "Option 1" from "Choice name" choice activity
40 Then I should see "Your selection: Option 1"
41 And I should see "Your choice has been saved"
42 And I log out
43 And I log in as "teacher1"
27deb595 44 And I change window size to "large"
fdeeaff9 45 And I am on "Course 1" course homepage
8676e7c3 46 And I follow "Choice name"
e5287f9b 47 And I navigate to "View 1 responses" in current page administration
8676e7c3
MG
48 And I click on "Student 1 Option 1" "checkbox"
49 And I select "Delete" from the "With selected" singleselect
50 And "Student 1 Option 1" "checkbox" should not exist
51 And "Student 1 Not answered yet" "checkbox" should exist
52 And I log out
53
54 @javascript
55 Scenario: Teacher set answers of students who did not respond or change existing answers
91e2e5e7
LB
56 When I log in as "teacher1"
57 And I am on "Course 1" course homepage
58 And I follow "Choice name"
59 And I navigate to "Edit settings" in current page administration
60 And I expand all fieldsets
61 And I set the field "Show column for unanswered" to "Yes"
62 And I press "Save and return to course"
63 And I log out
64 And I log in as "student1"
fdeeaff9 65 And I am on "Course 1" course homepage
8676e7c3
MG
66 And I choose "Option 1" from "Choice name" choice activity
67 Then I should see "Your selection: Option 1"
68 And I should see "Your choice has been saved"
69 And I log out
70 And I log in as "teacher1"
27deb595 71 And I change window size to "large"
fdeeaff9 72 And I am on "Course 1" course homepage
8676e7c3 73 And I follow "Choice name"
e5287f9b 74 And I navigate to "View 1 responses" in current page administration
8676e7c3
MG
75 And I click on "Student 1 Option 1" "checkbox"
76 And I click on "Student 2 Not answered yet" "checkbox"
77 And I click on "Student 3 Not answered yet" "checkbox"
78 And I select "Choose: Option 2" from the "With selected" singleselect
79 And "Student 1 Option 1" "checkbox" should not exist
80 And "Student 2 Not answered yet" "checkbox" should not exist
81 And "Student 3 Not answered yet" "checkbox" should not exist
82 And "Student 1 Option 2" "checkbox" should exist
83 And "Student 2 Option 2" "checkbox" should exist
84 And "Student 3 Option 2" "checkbox" should exist
85 And I log out
86
87 @javascript
88 Scenario: Teacher can delete answers in the multiple answer choice
89 And I log in as "teacher1"
fdeeaff9 90 And I am on "Course 1" course homepage
8676e7c3 91 And I follow "Choice name"
e5287f9b 92 And I navigate to "Edit settings" in current page administration
8676e7c3
MG
93 And I set the field "Allow more than one choice to be selected" to "Yes"
94 And I press "Save and return to course"
95 And I log out
96 And I log in as "student1"
fdeeaff9 97 And I am on "Course 1" course homepage
8676e7c3
MG
98 And I choose options "Option 1","Option 2" from "Choice name" choice activity
99 And I should see "Your selection: Option 1; Option 2"
100 And I should see "Your choice has been saved"
101 And I log out
102 And I log in as "teacher1"
27deb595 103 And I change window size to "large"
fdeeaff9 104 And I am on "Course 1" course homepage
8676e7c3 105 And I follow "Choice name"
e5287f9b 106 And I navigate to "View 1 responses" in current page administration
8676e7c3
MG
107 And I click on "Student 1 Option 2" "checkbox"
108 And I select "Delete" from the "With selected" singleselect
109 And I click on "Student 1 Option 1" "checkbox"
110 And I select "Choose: Option 3" from the "With selected" singleselect
111 And I log out
112 And I log in as "student1"
fdeeaff9 113 And I am on "Course 1" course homepage
8676e7c3
MG
114 And I follow "Choice name"
115 And I should see "Your selection: Option 1; Option 3"
116 And I log out
117
118 @javascript
119 Scenario: Teacher can manage answers on view page if the names are displayed
120 When I log in as "student1"
fdeeaff9 121 And I am on "Course 1" course homepage
8676e7c3
MG
122 And I choose "Option 1" from "Choice name" choice activity
123 Then I should see "Your selection: Option 1"
124 And I should see "Your choice has been saved"
125 And I log out
126 And I log in as "teacher1"
27deb595 127 And I change window size to "large"
fdeeaff9 128 And I am on "Course 1" course homepage
8676e7c3 129 And I follow "Choice name"
e5287f9b 130 And I navigate to "Edit settings" in current page administration
8676e7c3
MG
131 And I set the following fields to these values:
132 | Publish results | Always show results to students |
133 | Privacy of results | Publish full results, showing names and their choices |
134 | Show column for unanswered | Yes |
135 And I press "Save and display"
136 And I click on "Student 1 Option 1" "checkbox"
137 And I click on "Student 2 Not answered yet" "checkbox"
138 And I select "Choose: Option 3" from the "With selected" singleselect
139 And "Student 1 Option 1" "checkbox" should not exist
140 And "Student 1 Option 3" "checkbox" should exist
141 And "Student 2 Not answered yet" "checkbox" should not exist
142 And "Student 2 Option 3" "checkbox" should exist
143 And I click on "Student 1 Option 3" "checkbox"
144 And I select "Delete" from the "With selected" singleselect
145 And "Student 1 Option 3" "checkbox" should not exist
146 And "Student 1 Not answered yet" "checkbox" should exist
147 And I log out