1 |
efrain |
1 |
@core @core_completion
|
|
|
2 |
Feature: Restrict sections availability through completion or grade conditions
|
|
|
3 |
In order to control section's contents access through activities completion or grade condition
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to restrict sections availability using different conditions
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "courses" exist:
|
|
|
9 |
| fullname | shortname | category | enablecompletion |
|
|
|
10 |
| Course 1 | C1 | 0 | 1 |
|
|
|
11 |
And the following "users" exist:
|
|
|
12 |
| username | firstname | lastname | email |
|
|
|
13 |
| teacher1 | Teacher | First | teacher1@example.com |
|
|
|
14 |
| student1 | Student | First | student1@example.com |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| teacher1 | C1 | editingteacher |
|
|
|
18 |
| student1 | C1 | student |
|
|
|
19 |
And the following "activities" exist:
|
|
|
20 |
| activity | course | section | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | submissiondrafts | content |
|
|
|
21 |
| assign | C1 | 1 | Grade assignment | Grade this assignment to revoke restriction on restricted assignment | 1 | 0 | 0 | |
|
|
|
22 |
| page | C1 | 2 | Test page name | Restricted section page resource, till grades in Grade assignment is at least 20% | | | | Test page contents |
|
|
|
23 |
|
|
|
24 |
@javascript
|
|
|
25 |
Scenario: Show section greyed-out to student when completion condition is not satisfied
|
|
|
26 |
Given the following "activities" exist:
|
|
|
27 |
| activity | course | section | intro | completion | idnumber |
|
|
|
28 |
| label | C1 | 1 | Test label | 1 | 1 |
|
|
|
29 |
And I log in as "teacher1"
|
|
|
30 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
31 |
When I edit the section "2"
|
|
|
32 |
And I expand all fieldsets
|
|
|
33 |
And I click on "Add restriction..." "button"
|
|
|
34 |
And I click on "Activity completion" "button" in the "Add restriction..." "dialogue"
|
|
|
35 |
And I set the following fields to these values:
|
|
|
36 |
| cm | Test label |
|
|
|
37 |
| Required completion status | must be marked complete |
|
|
|
38 |
And I press "Save changes"
|
|
|
39 |
And I am on the "Course 1" course page logged in as "student1"
|
|
|
40 |
Then I should see "Not available unless: The activity Test label is marked complete"
|
|
|
41 |
And I should not see "Test page name"
|
|
|
42 |
And I toggle the manual completion state of "Test label"
|
|
|
43 |
And I should see "Test page name"
|
|
|
44 |
And I should not see "Not available unless: The activity Test label is marked complete"
|
|
|
45 |
|
|
|
46 |
@javascript
|
|
|
47 |
Scenario: Show section greyed-out to student when grade condition is not satisfied
|
|
|
48 |
Given I log in as "teacher1"
|
|
|
49 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
50 |
And I edit the section "2"
|
|
|
51 |
And I expand all fieldsets
|
|
|
52 |
And I click on "Add restriction..." "button"
|
|
|
53 |
And I click on "Grade" "button" in the "Add restriction..." "dialogue"
|
|
|
54 |
And I set the following fields to these values:
|
|
|
55 |
| id | Grade assignment |
|
|
|
56 |
| min | 1 |
|
|
|
57 |
| minval | 20 |
|
|
|
58 |
And I press "Save changes"
|
|
|
59 |
When I am on the "Course 1" course page logged in as "student1"
|
|
|
60 |
Then I should see "Not available unless: You achieve higher than a certain score in Grade assignment"
|
|
|
61 |
And "Test page name" activity should be hidden
|
|
|
62 |
And I am on the "Grade assignment" "assign activity" page
|
|
|
63 |
And I press "Add submission"
|
|
|
64 |
And I set the following fields to these values:
|
|
|
65 |
| Online text | I'm the student submission |
|
|
|
66 |
And I press "Save changes"
|
|
|
67 |
And I should see "Submitted for grading"
|
|
|
68 |
And I log out
|
|
|
69 |
And I am on the "Grade assignment" "assign activity" page logged in as teacher1
|
|
|
70 |
And I follow "View all submissions"
|
|
|
71 |
And I click on "Grade" "link" in the "Student First" "table_row"
|
|
|
72 |
And I set the following fields to these values:
|
|
|
73 |
| Grade | 21 |
|
|
|
74 |
And I press "Save changes"
|
|
|
75 |
And I follow "Edit settings"
|
|
|
76 |
And I am on the "Course 1" Course page logged in as student1
|
|
|
77 |
And "Test page name" activity should be visible
|
|
|
78 |
And I should not see "Not available unless: You achieve higher than a certain score in Grade assignment"
|