MDL-48024 behat: allow plugins to have data generators
[moodle.git] / mod / quiz / tests / behat / quiz_reset.feature
CommitLineData
113486d2
SB
1@mod @mod_quiz
2Feature: Quiz reset
3 In order to reuse past quizzes
4 As a teacher
5 I need to remove all previous data.
6
7 Background:
8 Given the following "users" exist:
0fe86bbd
RT
9 | username | firstname | lastname | email |
10 | teacher1 | Terry1 | Teacher1 | teacher1@example.com |
11 | student1 | Sam1 | Student1 | student1@example.com |
113486d2
SB
12 And the following "courses" exist:
13 | fullname | shortname | category |
14 | Course 1 | C1 | 0 |
15 And the following "course enrolments" exist:
16 | user | course | role |
17 | teacher1 | C1 | editingteacher |
18 | student1 | C1 | student |
19 And the following "groups" exist:
20 | name | course | idnumber |
21 | Group 1 | C1 | G1 |
22 | Group 2 | C1 | G2 |
23 And the following "question categories" exist:
24 | contextlevel | reference | name |
25 | Course | C1 | Test questions |
26 And the following "questions" exist:
27 | questioncategory | qtype | name | questiontext |
28 | Test questions | truefalse | TF1 | First question |
29 And the following "activities" exist:
30 | activity | name | intro | course | idnumber |
31 | quiz | Test quiz name | Test quiz description | C1 | quiz1 |
32 And quiz "Test quiz name" contains the following questions:
33 | question | page |
34 | TF1 | 1 |
3c4ff02e
SL
35 And user "student1" has attempted "Test quiz name" with responses:
36 | slot | response |
37 | 1 | True |
113486d2
SB
38
39 Scenario: Use course reset to clear all attempt data
3c4ff02e 40 When I log in as "teacher1"
fdeeaff9 41 And I am on "Course 1" course homepage
02fda279 42 And I navigate to "Reset" in current page administration
113486d2 43 And I set the following fields to these values:
4e1ebf8c 44 | Delete all quiz attempts | 1 |
113486d2
SB
45 And I press "Reset course"
46 And I press "Continue"
4e1ebf8c 47 And I am on the "Test quiz name" "mod_quiz > Grades report" page
113486d2
SB
48 Then I should see "Attempts: 0"
49
50 Scenario: Use course reset to remove user overrides.
285c7036
TH
51 Given the following "mod_quiz > user overrides" exist:
52 | quiz | user | attempts |
53 | Test quiz name | student1 | 2 |
54 When I log in as "teacher1"
02fda279
VDF
55 And I am on "Course 1" course homepage
56 And I navigate to "Reset" in current page administration
285c7036 57 And I set the field "Delete all user overrides" to "1"
113486d2
SB
58 And I press "Reset course"
59 And I press "Continue"
4e1ebf8c 60 And I am on the "Test quiz name" "mod_quiz > User overrides" page
113486d2
SB
61 Then I should not see "Sam1 Student1"
62
57bee542 63 Scenario: Use course reset to remove group overrides.
285c7036
TH
64 Given the following "mod_quiz > group overrides" exist:
65 | quiz | group | attempts |
66 | Test quiz name | G1 | 2 |
67 When I log in as "teacher1"
02fda279
VDF
68 And I am on "Course 1" course homepage
69 And I navigate to "Reset" in current page administration
113486d2 70 And I set the following fields to these values:
4e1ebf8c 71 | Delete all group overrides | 1 |
113486d2
SB
72 And I press "Reset course"
73 And I press "Continue"
4e1ebf8c 74 And I am on the "Test quiz name" "mod_quiz > Group overrides" page
113486d2 75 Then I should not see "Group 1"