1 |
efrain |
1 |
@mod @mod_choice
|
|
|
2 |
Feature: Limit choice responses
|
|
|
3 |
In order to restrict students from selecting a response more than a specified number of times
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to limit the choice responses
|
|
|
6 |
|
|
|
7 |
Scenario: Limit the number of responses allowed for a choice activity and verify the result as students
|
|
|
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 | showavailable | limitanswers |
|
|
|
25 |
| choice | Choice name | Choice description | C1 | choice1 | Option 1, Option 2 | 1 | 1 |
|
|
|
26 |
And I log in as "teacher1"
|
|
|
27 |
And I am on "Course 1" course homepage
|
|
|
28 |
And I follow "Choice name"
|
|
|
29 |
And I navigate to "Settings" in current page administration
|
|
|
30 |
And I set the field "Limit 1" to "1"
|
|
|
31 |
And I press "Save and display"
|
|
|
32 |
And I log out
|
|
|
33 |
When I log in as "student1"
|
|
|
34 |
And I am on "Course 1" course homepage
|
|
|
35 |
And I follow "Choice name"
|
|
|
36 |
And I choose "Option 1" from "Choice name" choice activity
|
|
|
37 |
Then I should see "Your selection: Option 1"
|
|
|
38 |
And I should see "Your choice has been saved"
|
|
|
39 |
And I log out
|
|
|
40 |
And I log in as "student2"
|
|
|
41 |
And I am on "Course 1" course homepage
|
|
|
42 |
And I follow "Choice name"
|
|
|
43 |
And I should see "Option 1 (Full)"
|
|
|
44 |
And I should see "Responses: 1"
|
|
|
45 |
And I should see "Limit: 1"
|
|
|
46 |
And the "choice_1" "radio" should be disabled
|
|
|
47 |
And I log out
|
|
|
48 |
And I log in as "teacher1"
|
|
|
49 |
And I am on "Course 1" course homepage
|
|
|
50 |
And I follow "Choice name"
|
|
|
51 |
And I navigate to "Settings" in current page administration
|
|
|
52 |
And I set the following fields to these values:
|
|
|
53 |
| Limit the number of responses allowed | No |
|
|
|
54 |
And I press "Save and return to course"
|
|
|
55 |
And I log out
|
|
|
56 |
And I log in as "student3"
|
|
|
57 |
And I am on "Course 1" course homepage
|
|
|
58 |
And I follow "Choice name"
|
|
|
59 |
Then I should not see "Limit: 1"
|
|
|
60 |
And the "choice_1" "radio" should be enabled
|