1 |
efrain |
1 |
@availability @availability_date
|
|
|
2 |
Feature: availability_date
|
|
|
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 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "courses" exist:
|
|
|
9 |
| fullname | shortname | format | enablecompletion |
|
|
|
10 |
| Course 1 | C1 | topics | 1 |
|
|
|
11 |
And the following "users" exist:
|
|
|
12 |
| username |
|
|
|
13 |
| teacher1 |
|
|
|
14 |
| student1 |
|
|
|
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 | name |
|
|
|
21 |
| page | C1 | Page 1 |
|
|
|
22 |
| page | C1 | Page 2 |
|
|
|
23 |
|
|
|
24 |
@javascript
|
|
|
25 |
Scenario: Test condition
|
|
|
26 |
# Add a Page with a date condition that does match (from the past).
|
|
|
27 |
Given I am on the "Page 1" "page activity editing" page logged in as "teacher1"
|
|
|
28 |
And I expand all fieldsets
|
|
|
29 |
And I click on "Add restriction..." "button"
|
|
|
30 |
And I click on "Date" "button" in the "Add restriction..." "dialogue"
|
|
|
31 |
And I click on ".availability-item .availability-eye img" "css_element"
|
|
|
32 |
And I set the field "year" to "2013"
|
|
|
33 |
And I press "Save and return to course"
|
|
|
34 |
|
|
|
35 |
# Add a Page with a date condition that doesn't match (until the past).
|
|
|
36 |
And I am on the "Page 2" "page activity editing" page
|
|
|
37 |
And I expand all fieldsets
|
|
|
38 |
And I click on "Add restriction..." "button"
|
|
|
39 |
And I click on "Date" "button" in the "Add restriction..." "dialogue"
|
|
|
40 |
And I click on ".availability-item .availability-eye img" "css_element"
|
|
|
41 |
And I set the field "Direction" to "until"
|
|
|
42 |
And I set the field "year" to "2013"
|
|
|
43 |
And I press "Save and return to course"
|
|
|
44 |
|
|
|
45 |
# Log back in as student.
|
|
|
46 |
When I am on the "Course 1" "course" page logged in as "student1"
|
|
|
47 |
|
|
|
48 |
# Page 1 should appear, but page 2 does not.
|
|
|
49 |
Then I should see "Page 1" in the "region-main" "region"
|
|
|
50 |
And I should not see "Page 2" in the "region-main" "region"
|