Commit | Line | Data |
---|---|---|
db3686d5 RM |
1 | @mod @mod_quiz |
2 | Feature: Set a quiz to be marked complete when the student uses all attempts allowed | |
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 receives a passing grade, or completed_fail if they use all attempts without passing | |
6 | ||
7 | Background: | |
8 | Given the following "users" exist: | |
9 | | username | firstname | lastname | email | | |
0fe86bbd RT |
10 | | student1 | Student | 1 | student1@example.com | |
11 | | teacher1 | Teacher | 1 | teacher1@example.com | | |
db3686d5 RM |
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 | | |
345c6a1a | 19 | And the following config values are set as admin: |
bed97c39 | 20 | | enablecompletion | 1 | |
db3686d5 | 21 | And I log in as "admin" |
bed97c39 | 22 | And I navigate to "Grade item settings" node in "Site administration > Grades" |
db3686d5 RM |
23 | And I set the field "Advanced grade item options" to "hiddenuntil" |
24 | And I press "Save changes" | |
25 | And I log out | |
26 | ||
27 | Scenario: student1 uses up both attempts without passing | |
28 | When I log in as "teacher1" | |
29 | And I follow "Course 1" | |
30 | And I turn editing mode on | |
31 | And I click on "Edit settings" "link" in the "Administration" "block" | |
32 | And I set the following fields to these values: | |
33 | | Enable completion tracking | Yes | | |
38ea5e0a | 34 | And I press "Save and display" |
db3686d5 RM |
35 | And I add a "Quiz" to section "1" and I fill the form with: |
36 | | Name | Test quiz name | | |
37 | | Description | Test quiz description | | |
38 | | Completion tracking | Show activity as complete when conditions are met | | |
39 | | Attempts allowed | 2 | | |
40 | | Require passing grade | 1 | | |
41 | | Or all available attempts completed | 1 | | |
42 | And I add a "True/False" question to the "Test quiz name" quiz with: | |
43 | | Question name | First question | | |
44 | | Question text | Answer the first question | | |
45 | | General feedback | Thank you, this is the general feedback | | |
46 | | Correct answer | True | | |
47 | | Feedback for the response 'True'. | So you think it is true | | |
48 | | Feedback for the response 'False'. | So you think it is false | | |
49 | And I follow "Course 1" | |
4887d152 | 50 | And I navigate to "Grades" node in "Course administration" |
9f1088d4 | 51 | And I navigate to "Categories and items" node in "Grade administration > Setup" |
db3686d5 RM |
52 | And I follow "Edit quiz Test quiz name" |
53 | Then I should see "Edit grade item" | |
54 | And I set the field "gradepass" to "5" | |
55 | And I press "Save changes" | |
9f1088d4 | 56 | And I should see "Categories and items" |
db3686d5 RM |
57 | Then I log out |
58 | ||
59 | And I log in as "student1" | |
60 | And I follow "Course 1" | |
61 | And "//img[contains(@alt, 'Not completed: Test quiz name')]" "xpath_element" should exist in the "li.modtype_quiz" "css_element" | |
62 | And I follow "Test quiz name" | |
63 | And I press "Attempt quiz now" | |
64 | And I should see "Question 1" | |
65 | And I should see "Answer the first question" | |
66 | And I set the field "False" to "1" | |
67 | And I press "Next" | |
68 | And I should see "Answer saved" | |
69 | And I press "Submit all and finish" | |
70 | And I follow "C1" | |
71 | And "//img[contains(@alt, 'Not completed: Test quiz name')]" "xpath_element" should exist in the "li.modtype_quiz" "css_element" | |
72 | And I follow "Test quiz name" | |
73 | And I press "Re-attempt quiz" | |
74 | Then I should see "Question 1" | |
75 | And I should see "Answer the first question" | |
76 | And I set the field "False" to "1" | |
77 | And I press "Next" | |
78 | And I should see "Answer saved" | |
79 | And I press "Submit all and finish" | |
80 | And I follow "C1" | |
81 | And "//img[contains(@alt, 'Completed: Test quiz name')]" "xpath_element" should exist in the "li.modtype_quiz" "css_element" | |
82 | And I log out | |
83 | And I log in as "teacher1" | |
84 | And I follow "Course 1" | |
85 | And I follow "Activity completion" | |
86 | Then "//img[contains(@title,'Test quiz name') and @alt='Completed']" "xpath_element" should exist in the "Student 1" "table_row" | |
87 |