Merge branch 'MDL-53140-master' of git://github.com/rezaies/moodle
[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"
fdeeaff9 20 And I am on "Course 1" course homepage with editing mode on
d1e55a47 21 # Adding the page like this because id_available*_enabled needs to be clicked to trigger the action.
932fa015 22 And I add a "Assignment" to section "1"
d1e55a47
DM
23 And I expand all fieldsets
24
25 @javascript
26 Scenario: Show activity greyed-out to students when available from date is in future
3e9c7420 27 Given I click on "Add restriction..." "button"
28 And I click on "Date" "button" in the "Add restriction..." "dialogue"
f083d614 29 And I set the following fields to these values:
932fa015
RT
30 | Assignment name | Test assignment 1 |
31 | Description | This assignment is restricted by date |
32 | assignsubmission_onlinetext_enabled | 1 |
33 | assignsubmission_file_enabled | 0 |
3e9c7420 34 | x[day] | 31 |
35 | x[month] | 12 |
36 | x[year] | 2037 |
932fa015
RT
37 And I press "Save and return to course"
38 And I log out
39 When I log in as "student1"
fdeeaff9 40 And I am on "Course 1" course homepage
3e9c7420 41 Then I should see "Available from 31 December 2037"
3f950346
MG
42 And "Test assignment 1" activity should be dimmed
43 And "Test assignment 1" "link" should not exist
932fa015
RT
44 And I log out
45
46 @javascript
47 Scenario: Show activity hidden to students when available until date is in past
3e9c7420 48 Given I click on "Add restriction..." "button"
49 And I click on "Date" "button" in the "Add restriction..." "dialogue"
f083d614 50 And I set the following fields to these values:
932fa015
RT
51 | Assignment name | Test assignment 2 |
52 | Description | This assignment is restricted by date |
53 | assignsubmission_onlinetext_enabled | 1 |
54 | assignsubmission_file_enabled | 0 |
3e9c7420 55 | x[day] | 1 |
56 | x[month] | 2 |
57 | x[year] | 2013 |
58 | Direction | until |
59 # Click eye icon to hide it when not available.
60 And I click on ".availability-item .availability-eye img" "css_element"
932fa015
RT
61 And I press "Save and return to course"
62 And I log out
63 When I log in as "student1"
fdeeaff9 64 And I am on "Course 1" course homepage
932fa015 65 Then I should not see "Test assignment 2"