1 |
efrain |
1 |
@eWallah @availability @availability_relativedate
|
|
|
2 |
Feature: availability_relativedate relative activities
|
|
|
3 |
In order to control student access to activities
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to set relative activity conditions which prevent student access
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username |
|
|
|
10 |
| student1 |
|
|
|
11 |
And the following config values are set as admin:
|
|
|
12 |
| enableavailability | 1 | |
|
|
|
13 |
| backup_import_activities | 0 | backup |
|
|
|
14 |
| enableasyncbackup | 0 | |
|
|
|
15 |
|
|
|
16 |
And the following "course" exists:
|
|
|
17 |
| fullname | Course 1 |
|
|
|
18 |
| shortname | C1 |
|
|
|
19 |
| category | 0 |
|
|
|
20 |
| enablecompletion | 1 |
|
|
|
21 |
| startdate | ## -10 days 17:00 ## |
|
|
|
22 |
| enddate | ## +2 weeks 17:00 ## |
|
|
|
23 |
And the following "course enrolments" exist:
|
|
|
24 |
| user | course | role |
|
|
|
25 |
| student1 | C1 | student |
|
|
|
26 |
And the following "activities" exist:
|
|
|
27 |
| activity | name | course | idnumber | section | completion |
|
|
|
28 |
| page | Page A1 | C1 | pageA1 | 1 | 1 |
|
|
|
29 |
| page | Page A2 | C1 | pageA2 | 1 | 1 |
|
|
|
30 |
| page | Page A3 | C1 | pageA3 | 1 | 1 |
|
|
|
31 |
| page | Page A4 | C1 | pageA4 | 1 | 1 |
|
|
|
32 |
| page | Page A5 | C1 | pageA5 | 1 | 1 |
|
|
|
33 |
| page | Page B1 | C1 | pageB1 | 2 | 1 |
|
|
|
34 |
| page | Page B2 | C1 | pageB2 | 2 | 1 |
|
|
|
35 |
| page | Page B3 | C1 | pageB3 | 2 | 1 |
|
|
|
36 |
| page | Page B4 | C1 | pageB4 | 2 | 1 |
|
|
|
37 |
| page | Page B5 | C1 | pageB5 | 2 | 1 |
|
|
|
38 |
| page | Page C1 | C1 | pageC1 | 3 | 1 |
|
|
|
39 |
| page | Page C2 | C1 | pageC2 | 3 | 1 |
|
|
|
40 |
| page | Page C3 | C1 | pageC3 | 3 | 1 |
|
|
|
41 |
| page | Page C4 | C1 | pageC4 | 3 | 1 |
|
|
|
42 |
| page | Page C5 | C1 | pageC5 | 3 | 1 |
|
|
|
43 |
| page | Page D1 | C1 | pageD1 | 4 | 1 |
|
|
|
44 |
| page | Page D2 | C1 | pageD2 | 4 | 1 |
|
|
|
45 |
| page | Page D3 | C1 | pageD3 | 4 | 1 |
|
|
|
46 |
| page | Page D4 | C1 | pageD4 | 4 | 1 |
|
|
|
47 |
| page | Page D5 | C1 | pageD5 | 4 | 1 |
|
|
|
48 |
| page | Page E1 | C1 | pageE1 | 5 | 1 |
|
|
|
49 |
| page | Page E2 | C1 | pageE2 | 5 | 1 |
|
|
|
50 |
| page | Page E3 | C1 | pageE3 | 5 | 1 |
|
|
|
51 |
| page | Page E4 | C1 | pageE4 | 5 | 1 |
|
|
|
52 |
| page | Page E5 | C1 | pageE5 | 5 | 1 |
|
|
|
53 |
And I make "pageA2" relative date depending on "pageA1"
|
|
|
54 |
And I make "pageA3" relative date depending on "pageA2"
|
|
|
55 |
And I make "pageA4" relative date depending on "pageA3"
|
|
|
56 |
And I make "pageA5" relative date depending on "pageA4"
|
|
|
57 |
And I make "pageB2" relative date depending on "pageB1"
|
|
|
58 |
And I make "pageB3" relative date depending on "pageB2"
|
|
|
59 |
And I make "pageB4" relative date depending on "pageB3"
|
|
|
60 |
And I make "pageB5" relative date depending on "pageB4"
|
|
|
61 |
And I make "pageC2" relative date depending on "pageC1"
|
|
|
62 |
And I make "pageC3" relative date depending on "pageC2"
|
|
|
63 |
And I make "pageC4" relative date depending on "pageC3"
|
|
|
64 |
And I make "pageC5" relative date depending on "pageC4"
|
|
|
65 |
And I make "pageD2" relative date depending on "pageD1"
|
|
|
66 |
And I make "pageD3" relative date depending on "pageD2"
|
|
|
67 |
And I make "pageD4" relative date depending on "pageD3"
|
|
|
68 |
And I make "pageD5" relative date depending on "pageD4"
|
|
|
69 |
And I make "pageE2" relative date depending on "pageE1"
|
|
|
70 |
And I make "pageE3" relative date depending on "pageE2"
|
|
|
71 |
And I make "pageE4" relative date depending on "pageE3"
|
|
|
72 |
And I make "pageE5" relative date depending on "pageE4"
|
|
|
73 |
And I log in as "admin"
|
|
|
74 |
|
|
|
75 |
@javascript
|
|
|
76 |
Scenario: Admin should see relative session restrictions
|
|
|
77 |
When I navigate to "Development > Purge caches" in site administration
|
|
|
78 |
And I press "Purge all caches"
|
|
|
79 |
And I am on "Course 1" course homepage
|
|
|
80 |
Then I should see "Not available unless: (1 hour after completion of activity"
|
|
|
81 |
|
|
|
82 |
@javascript
|
|
|
83 |
Scenario: Student should see relative session restrictions
|
|
|
84 |
When I navigate to "Development > Purge caches" in site administration
|
|
|
85 |
And I press "Purge all caches"
|
|
|
86 |
And I log out
|
|
|
87 |
And I am on the "C1" "Course" page logged in as "student1"
|
|
|
88 |
Then I should see "Page A1" in the "region-main" "region"
|
|
|
89 |
And I should see "1 hour after completion of activity Page A1"
|
|
|
90 |
And I press "Mark as done"
|
|
|
91 |
But I should not see "1 hour after completion of activity Page A1"
|
|
|
92 |
And I log out
|
|
|
93 |
And I trigger cron
|
|
|
94 |
And I am on the "C1" "Course" page logged in as "student1"
|
|
|
95 |
And I should see "1 hour after completion of activity" in the "region-main" "region"
|
|
|
96 |
And I should see relativedate "## +1 hours ##"
|
|
|
97 |
|
|
|
98 |
Scenario: Admin can duplicate a restricted activity
|
|
|
99 |
When I am on "Course 1" course homepage with editing mode on
|
|
|
100 |
And I duplicate "Page A2" activity
|
|
|
101 |
And I duplicate "Page B2" activity
|
|
|
102 |
Then I should see "Not available unless: (1 hour after completion of activity"
|
|
|
103 |
And I should see "Page A2 (copy)"
|
|
|
104 |
And I should see "Page B2 (copy)"
|
|
|
105 |
|
|
|
106 |
@javascript
|
|
|
107 |
Scenario: Admin can backup and restore a course with restricted activities
|
|
|
108 |
When I am on "Course 1" course homepage
|
|
|
109 |
And I backup "Course 1" course using this options:
|
|
|
110 |
| Confirmation | Filename | test_backup.mbz |
|
|
|
111 |
And I restore "test_backup.mbz" backup into a new course using this options:
|
|
|
112 |
| Schema | Course name | Course 2 |
|
|
|
113 |
| Schema | Course short name | C2 |
|
|
|
114 |
And I am on "Course 2" course homepage
|
|
|
115 |
Then I should see "Not available unless: (1 hour after completion of activity"
|
|
|
116 |
|
|
|
117 |
Scenario: Admin can delete relatativedate restricted activities
|
|
|
118 |
When I am on "Course 1" course homepage with editing mode on
|
|
|
119 |
And I delete "Page A1" activity
|
|
|
120 |
And I delete "Page B2" activity
|
|
|
121 |
And I delete "Page C3" activity
|
|
|
122 |
And I delete "Page D4" activity
|
|
|
123 |
And I delete "Page E5" activity
|
|
|
124 |
And I delete section "5"
|
|
|
125 |
And I reload the page
|
|
|
126 |
And I run all adhoc tasks
|
|
|
127 |
And I log out
|
|
|
128 |
And I am on the "C1" "Course" page logged in as "student1"
|
|
|
129 |
Then I should see "Page A2" in the "region-main" "region"
|
|
|
130 |
And I should see "1 hour after completion of activity (missing)"
|
|
|
131 |
And I should not see "1 hour after completion of activity Page A1"
|
|
|
132 |
|
|
|
133 |
@javascript
|
|
|
134 |
Scenario: Admin can delete relatativedate restricted sections
|
|
|
135 |
When I am on "Course 1" course homepage with editing mode on
|
|
|
136 |
And I edit the section "2"
|
|
|
137 |
And I expand all fieldsets
|
|
|
138 |
And I press "Add restriction..."
|
|
|
139 |
And I click on "Relative date" "button" in the "Add restriction..." "dialogue"
|
|
|
140 |
And I set the field "relativenumber" to "1"
|
|
|
141 |
And I set the field "relativednw" to "1"
|
|
|
142 |
And I set the field "relativestart" to "7"
|
|
|
143 |
And I set the field "relativecoursemodule" to "Page A1"
|
|
|
144 |
And I press "Save changes"
|
|
|
145 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
146 |
And I delete "Page A1" activity
|
|
|
147 |
And I reload the page
|
|
|
148 |
And I run all adhoc tasks
|
|
|
149 |
And I log out
|
|
|
150 |
And I am on the "C1" "Course" page logged in as "student1"
|
|
|
151 |
Then I should see "Page A2" in the "region-main" "region"
|
|
|
152 |
And I should see "1 hour after completion of activity (missing)"
|
|
|
153 |
And I should see "1 hour after completion of activity Page E1"
|