1 |
efrain |
1 |
@core @core_completion
|
|
|
2 |
Feature: Restrict activity availability through date conditions
|
|
|
3 |
In order to control activity access through date condition
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to set allow access dates to restrict activity access
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "courses" exist:
|
|
|
9 |
| fullname | shortname | category |
|
|
|
10 |
| Course 1 | C1 | 0 |
|
|
|
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 "activity" exists:
|
|
|
20 |
| activity | assign |
|
|
|
21 |
| course | C1 |
|
|
|
22 |
| section | 1 |
|
|
|
23 |
| name | Test assignment 1 |
|
|
|
24 |
| intro | This assignment is restricted by date |
|
|
|
25 |
| assignsubmission_onlinetext_enabled | 1 |
|
|
|
26 |
| assignsubmission_file_enabled | 0 |
|
|
|
27 |
And I am on the "Test assignment 1" "assign activity" page logged in as "teacher1"
|
|
|
28 |
And I navigate to "Settings" in current page administration
|
|
|
29 |
And I expand all fieldsets
|
|
|
30 |
|
|
|
31 |
@javascript
|
|
|
32 |
Scenario: Show activity greyed-out to students when available from date is in future
|
|
|
33 |
Given I click on "Add restriction..." "button"
|
|
|
34 |
And I click on "Date" "button" in the "Add restriction..." "dialogue"
|
|
|
35 |
And I set the following fields to these values:
|
|
|
36 |
| x[day] | 31 |
|
|
|
37 |
| x[month] | 12 |
|
|
|
38 |
| x[year] | 2037 |
|
|
|
39 |
And I press "Save and return to course"
|
|
|
40 |
And I log out
|
|
|
41 |
When I am on the "Course 1" course page logged in as student1
|
|
|
42 |
Then I should see "Available from 31 December 2037"
|
|
|
43 |
And "Test assignment 1" "link" should not exist in the "page" "region"
|
|
|
44 |
|
|
|
45 |
@javascript
|
|
|
46 |
Scenario: Show activity hidden to students when available until date is in past
|
|
|
47 |
Given I click on "Add restriction..." "button"
|
|
|
48 |
And I click on "Date" "button" in the "Add restriction..." "dialogue"
|
|
|
49 |
And I set the following fields to these values:
|
|
|
50 |
| x[day] | 1 |
|
|
|
51 |
| x[month] | 2 |
|
|
|
52 |
| x[year] | 2013 |
|
|
|
53 |
| Direction | until |
|
|
|
54 |
# Click eye icon to hide it when not available.
|
|
|
55 |
And I click on ".availability-item .availability-eye img" "css_element"
|
|
|
56 |
And I press "Save and return to course"
|
|
|
57 |
And I log out
|
|
|
58 |
When I am on the "Course 1" course page logged in as student1
|
|
|
59 |
Then I should not see "Test assignment 1" in the "page" "region"
|