1 |
efrain |
1 |
@eWallah @availability @availability_relativedate
|
|
|
2 |
Feature: availability relative course enddate
|
|
|
3 |
In order to control student access to activities
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to set date conditions which prevent student access
|
|
|
6 |
Based on course start and end date
|
|
|
7 |
|
|
|
8 |
Background:
|
|
|
9 |
Given the following "courses" exist:
|
|
|
10 |
| fullname | shortname | category | format | startdate | enddate | enablecompletion |
|
|
|
11 |
| Course 1 | C1 | 0 | topics | ##-10 days noon ## | ##+10 days noon ## | 1 |
|
|
|
12 |
And the following "activities" exist:
|
|
|
13 |
| activity | name | intro | course | idnumber | section | visible |
|
|
|
14 |
| page | Page A | intro | C1 | pageA | 1 | 1 |
|
|
|
15 |
And the following "users" exist:
|
|
|
16 |
| username | timezone |
|
|
|
17 |
| teacher1 | 5 |
|
|
|
18 |
| student1 | 5 |
|
|
|
19 |
And the following "course enrolments" exist:
|
|
|
20 |
| user | course | role |
|
|
|
21 |
| teacher1 | C1 | editingteacher |
|
|
|
22 |
| student1 | C1 | student |
|
|
|
23 |
|
|
|
24 |
@javascript
|
|
|
25 |
Scenario Outline: Test relative course date condition
|
|
|
26 |
When I am on the "pageA" "page activity editing" page logged in as teacher1
|
|
|
27 |
And I expand all fieldsets
|
|
|
28 |
And I click on "Add restriction..." "button"
|
|
|
29 |
And I click on "Relative date" "button" in the "Add restriction..." "dialogue"
|
|
|
30 |
And I set the field "relativenumber" to "2"
|
|
|
31 |
And I set the field "relativednw" to <relweek>
|
|
|
32 |
And I set the field "relativestart" to <relstart>
|
|
|
33 |
And I press "Save and return to course"
|
|
|
34 |
And I should see "Not available unless" in the "region-main" "region"
|
|
|
35 |
And I should see "2 <text> <before> course <end> date" in the "region-main" "region"
|
|
|
36 |
And I log out
|
|
|
37 |
|
|
|
38 |
# Log in as student 1.
|
|
|
39 |
When I am on the "C1" "Course" page logged in as "student1"
|
|
|
40 |
# Only real dates.
|
|
|
41 |
Then I should not see "2 <text> <before> course <end> date" in the "region-main" "region"
|
|
|
42 |
|
|
|
43 |
And I should see "Page A" in the "region-main" "region"
|
|
|
44 |
And I should <nau> "Not available unless" in the "region-main" "region"
|
|
|
45 |
|
|
|
46 |
Examples:
|
|
|
47 |
| relstart | relweek | text | before | end | nau |
|
|
|
48 |
# 2 weeks after course start = -10 + 14 = +4
|
|
|
49 |
| "1" | "4" | months | after | start | see |
|
|
|
50 |
# 2 days after course start = -10 + 2 = -8
|
|
|
51 |
| "1" | "2" | days | after | start | not see |
|
|
|
52 |
# 2 weeks before course start = -10 - 14 = -14
|
|
|
53 |
| "6" | "4" | months | before | start | not see |
|
|
|
54 |
# 2 days before course start = -10 - 12 = -12
|
|
|
55 |
| "6" | "2" | days | before | start | not see |
|
|
|
56 |
# 2 weeks before course end = +10 - 14 = -4
|
|
|
57 |
| "2" | "4" | months | before | end | not see |
|
|
|
58 |
# 2 days before course end = +10 - 2 = 8
|
|
|
59 |
| "2" | "2" | days | before | end | see |
|
|
|
60 |
# 2 weeks after course end = +10 + 14 = +24
|
|
|
61 |
| "5" | "4" | months | after | end | see |
|
|
|
62 |
# 2 days after course end = +10 + 2 = +12
|
|
|
63 |
| "5" | "2" | days | after | end | see |
|