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