1 |
efrain |
1 |
@mod @mod_lesson
|
|
|
2 |
Feature: Retake lesson activity
|
|
|
3 |
In order for student to retake a lesson activity
|
|
|
4 |
As a teacher
|
|
|
5 |
I should be able to allow retakes
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
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 |
And the following "courses" exist:
|
|
|
13 |
| fullname | shortname |
|
|
|
14 |
| Course 1 | C1 |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| teacher1 | C1 | editingteacher |
|
|
|
18 |
| student1 | C1 | student |
|
|
|
19 |
# Generate lesson with retakes enabled, maxgrade = 100 and handling of re-takes = use mean
|
|
|
20 |
And the following "activities" exist:
|
|
|
21 |
| activity | name | course | retake | grade[modgrade_point] | usemaxgrade |
|
|
|
22 |
| lesson | Test lesson name | C1 | 1 | 100 | 0 |
|
|
|
23 |
# Generate question pages
|
|
|
24 |
And the following "mod_lesson > page" exist:
|
|
|
25 |
| lesson | qtype | title | content |
|
|
|
26 |
| Test lesson name | multichoice | Question 1 | Which is not a plant? |
|
|
|
27 |
| Test lesson name | multichoice | Question 2 | Which is a plant? |
|
|
|
28 |
| Test lesson name | multichoice | Question 3 | Which is a plant and a colour? |
|
|
|
29 |
# Generate question answers
|
|
|
30 |
And the following "mod_lesson > answers" exist:
|
|
|
31 |
| page | answer | jumpto | score |
|
|
|
32 |
| Question 1 | Brown | Next page | 1 |
|
|
|
33 |
| Question 1 | Lavender | Next page | 0 |
|
|
|
34 |
| Question 2 | Brown | Next page | 0 |
|
|
|
35 |
| Question 2 | Lavender | Next page | 1 |
|
|
|
36 |
| Question 3 | Brown | Next page | 0 |
|
|
|
37 |
| Question 3 | Lavender | Next page | 1 |
|
|
|
38 |
|
|
|
39 |
Scenario: A student can retake a lesson
|
|
|
40 |
# First attempt - all correct
|
|
|
41 |
Given I am on the "Test lesson name" "lesson activity" page logged in as student1
|
|
|
42 |
And I set the following fields to these values:
|
|
|
43 |
| Brown | 1 |
|
|
|
44 |
And I press "Submit"
|
|
|
45 |
And I set the following fields to these values:
|
|
|
46 |
| Lavender | 1 |
|
|
|
47 |
And I press "Submit"
|
|
|
48 |
And I set the following fields to these values:
|
|
|
49 |
| Lavender | 1 |
|
|
|
50 |
And I press "Submit"
|
|
|
51 |
# Confirm that lesson can be retaken
|
|
|
52 |
When I am on the "Test lesson name" "lesson activity" page
|
|
|
53 |
Then I should see "Which is not a plant?"
|
|
|
54 |
# Second attempt - only 1 correct
|
|
|
55 |
And I set the following fields to these values:
|
|
|
56 |
| Lavender | 1 |
|
|
|
57 |
And I press "Submit"
|
|
|
58 |
And I set the following fields to these values:
|
|
|
59 |
| Brown | 1 |
|
|
|
60 |
And I press "Submit"
|
|
|
61 |
And I set the following fields to these values:
|
|
|
62 |
| Lavender | 1 |
|
|
|
63 |
And I press "Submit"
|
|
|
64 |
# Check that grade is 66.67 (mean of the 2 attempts)
|
|
|
65 |
And I click on "View grades" "link"
|
|
|
66 |
And "Test lesson name" row "Grade" column of "generaltable" table should contain "66.67"
|
|
|
67 |
# Change handling of re-takes = use maximum
|
|
|
68 |
And I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1
|
|
|
69 |
And I set the following fields to these values:
|
|
|
70 |
| Handling of re-takes | Use maximum |
|
|
|
71 |
And I press "Save and display"
|
|
|
72 |
# Confirm that lesson grade is the maximum of the 2 attempts (100)
|
|
|
73 |
And I am on the "Course 1" "grades > user > View" page logged in as student1
|
|
|
74 |
And "Test lesson name" row "Grade" column of "generaltable" table should contain "100.00"
|
|
|
75 |
# Disable lesson retake
|
|
|
76 |
And I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1
|
|
|
77 |
And I set the following fields to these values:
|
|
|
78 |
| Re-takes allowed | No |
|
|
|
79 |
And I press "Save and display"
|
|
|
80 |
# Confirm lesson cannot be retaken
|
|
|
81 |
And I am on the "Test lesson name" "lesson activity" page logged in as student1
|
|
|
82 |
And I should see "You are not allowed to retake this lesson."
|