MDL-53778 quiz: ensure completion deps are fulfilled by behat
[moodle.git] / mod / quiz / tests / behat / completion_condition_passing_grade.feature
CommitLineData
db3686d5
RM
1@mod @mod_quiz
2Feature: Set a quiz to be marked complete when the student passes
3 In order to ensure a student has learned the material before being marked complete
4 As a teacher
5 I need to set a quiz to complete when the student recieves a passing grade
6
7 Background:
8 Given the following "users" exist:
83cd293a
TH
9 | username | firstname | lastname | email |
10 | student1 | Student | 1 | student1@example.com |
11 | teacher1 | Teacher | 1 | teacher1@example.com |
db3686d5 12 And the following "courses" exist:
83cd293a
TH
13 | fullname | shortname | category | enablecompletion |
14 | Course 1 | C1 | 0 | 1 |
db3686d5 15 And the following "course enrolments" exist:
83cd293a
TH
16 | user | course | role |
17 | teacher1 | C1 | editingteacher |
18 | student1 | C1 | student |
345c6a1a 19 And the following config values are set as admin:
83cd293a
TH
20 | grade_item_advanced | hiddenuntil |
21 And the following "question categories" exist:
22 | contextlevel | reference | name |
23 | Course | C1 | Test questions |
24 And the following "questions" exist:
25 | questioncategory | qtype | name | questiontext |
26 | Test questions | truefalse | First question | Answer the first question |
27 And the following "activities" exist:
ee47095d
EL
28 | activity | name | course | idnumber | attempts | gradepass | completion | completionusegrade | completionpass |
29 | quiz | Test quiz name | C1 | quiz1 | 4 | 5.00 | 2 | 1 | 1 |
83cd293a
TH
30 And quiz "Test quiz name" contains the following questions:
31 | question | page |
32 | First question | 1 |
db3686d5
RM
33
34 Scenario: student1 passes on the first try
83cd293a 35 When I log in as "student1"
fdeeaff9 36 And I am on "Course 1" course homepage
1a5a476b 37 And the "Test quiz name" "quiz" activity with "auto" completion should be marked as not complete
3c4ff02e
SL
38 And user "student1" has attempted "Test quiz name" with responses:
39 | slot | response |
40 | 1 | True |
197e2bca 41 And I am on "Course 1" course homepage
8857c715 42 Then "Completed: Test quiz name" "icon" should exist in the "li.modtype_quiz" "css_element"
db3686d5
RM
43 And I log out
44 And I log in as "teacher1"
fdeeaff9 45 And I am on "Course 1" course homepage
02fda279 46 And I navigate to "Reports > Activity completion" in current page administration
8857c715 47 And "Completed" "icon" should exist in the "Student 1" "table_row"