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