2 Feature: Restrict activity availability through date conditions
3 In order to control activity access through date condition
5 I need to set allow access dates to restrict activity access
8 Given the following "courses" exists:
9 | fullname | shortname | category |
11 And the following "users" exists:
12 | username | firstname | lastname | email |
13 | teacher1 | Teacher | Frist | teacher1@asd.com |
14 | student1 | Student | First | student1@asd.com |
15 And the following "course enrolments" exists:
16 | user | course | role |
17 | teacher1 | C1 | editingteacher |
18 | student1 | C1 | student |
19 And I log in as "admin"
20 And I set the following administration settings values:
21 | Enable conditional access | 1 |
23 And I log in as "teacher1"
24 And I follow "Course 1"
25 And I turn editing mode on
26 # Adding the page like this because id_available*_enabled needs to be clicked to trigger the action.
27 And I add a "Assignment" to section "1"
28 And I expand all fieldsets
31 Scenario: Show activity greyed-out to students when available from date is in future
32 Given I click on "id_availablefrom_enabled" "checkbox"
33 And I fill the moodle form with:
34 | Assignment name | Test assignment 1 |
35 | Description | This assignment is restricted by date |
36 | assignsubmission_onlinetext_enabled | 1 |
37 | assignsubmission_file_enabled | 0 |
38 | id_availablefrom_day | 31 |
39 | id_availablefrom_month | 12 |
40 | id_availablefrom_year | 2037 |
41 | id_showavailability | 1 |
42 And I press "Save and return to course"
44 When I log in as "student1"
45 And I follow "Course 1"
46 Then I should see "Available from 31 December 2037."
47 And "Test assignment 1" activity should be hidden
51 Scenario: Show activity hidden to students when available until date is in past
52 Given I click on "id_availableuntil_enabled" "checkbox"
53 And I fill the moodle form with:
54 | Assignment name | Test assignment 2 |
55 | Description | This assignment is restricted by date |
56 | assignsubmission_onlinetext_enabled | 1 |
57 | assignsubmission_file_enabled | 0 |
58 | id_availableuntil_day | 1 |
59 | id_availableuntil_month | 2 |
60 | id_availableuntil_year | 2013 |
61 | id_showavailability | 0 |
62 And I press "Save and return to course"
64 When I log in as "student1"
65 And I follow "Course 1"
66 Then I should not see "Test assignment 2"