Moodle release 2.9beta
[moodle.git] / completion / tests / behat / restrict_activity_by_date.feature
CommitLineData
932fa015
RT
1@core @core_completion
2Feature: 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:
759b323e 8 Given the following "courses" exist:
932fa015
RT
9 | fullname | shortname | category |
10 | Course 1 | C1 | 0 |
759b323e 11 And the following "users" exist:
932fa015
RT
12 | username | firstname | lastname | email |
13 | teacher1 | Teacher | Frist | teacher1@asd.com |
14 | student1 | Student | First | student1@asd.com |
759b323e 15 And the following "course enrolments" exist:
932fa015
RT
16 | user | course | role |
17 | teacher1 | C1 | editingteacher |
18 | student1 | C1 | student |
bed97c39
RT
19 And the following config values are set as admin:
20 | enableavailability | 1 |
d1e55a47 21 And I log in as "teacher1"
39030d8d 22 And I am on site homepage
932fa015
RT
23 And I follow "Course 1"
24 And I turn editing mode on
d1e55a47 25 # Adding the page like this because id_available*_enabled needs to be clicked to trigger the action.
932fa015 26 And I add a "Assignment" to section "1"
d1e55a47
DM
27 And I expand all fieldsets
28
29 @javascript
30 Scenario: Show activity greyed-out to students when available from date is in future
3e9c7420 31 Given I click on "Add restriction..." "button"
32 And I click on "Date" "button" in the "Add restriction..." "dialogue"
f083d614 33 And I set the following fields to these values:
932fa015
RT
34 | Assignment name | Test assignment 1 |
35 | Description | This assignment is restricted by date |
36 | assignsubmission_onlinetext_enabled | 1 |
37 | assignsubmission_file_enabled | 0 |
3e9c7420 38 | x[day] | 31 |
39 | x[month] | 12 |
40 | x[year] | 2037 |
932fa015
RT
41 And I press "Save and return to course"
42 And I log out
43 When I log in as "student1"
39030d8d 44 And I am on site homepage
932fa015 45 And I follow "Course 1"
3e9c7420 46 Then I should see "Available from 31 December 2037"
932fa015
RT
47 And "Test assignment 1" activity should be hidden
48 And I log out
49
50 @javascript
51 Scenario: Show activity hidden to students when available until date is in past
3e9c7420 52 Given I click on "Add restriction..." "button"
53 And I click on "Date" "button" in the "Add restriction..." "dialogue"
f083d614 54 And I set the following fields to these values:
932fa015
RT
55 | Assignment name | Test assignment 2 |
56 | Description | This assignment is restricted by date |
57 | assignsubmission_onlinetext_enabled | 1 |
58 | assignsubmission_file_enabled | 0 |
3e9c7420 59 | x[day] | 1 |
60 | x[month] | 2 |
61 | x[year] | 2013 |
62 | Direction | until |
63 # Click eye icon to hide it when not available.
64 And I click on ".availability-item .availability-eye img" "css_element"
932fa015
RT
65 And I press "Save and return to course"
66 And I log out
67 When I log in as "student1"
39030d8d 68 And I am on site homepage
932fa015
RT
69 And I follow "Course 1"
70 Then I should not see "Test assignment 2"