MDL-43236 behat: Deprecate old steps
[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:
8 Given the following "courses" exists:
9 | fullname | shortname | category |
10 | Course 1 | C1 | 0 |
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 |
22 And I log out
d1e55a47 23 And I log in as "teacher1"
932fa015
RT
24 And I follow "Course 1"
25 And I turn editing mode on
d1e55a47 26 # Adding the page like this because id_available*_enabled needs to be clicked to trigger the action.
932fa015 27 And I add a "Assignment" to section "1"
d1e55a47
DM
28 And I expand all fieldsets
29
30 @javascript
31 Scenario: Show activity greyed-out to students when available from date is in future
32 Given I click on "id_availablefrom_enabled" "checkbox"
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 |
38 | id_availablefrom_day | 31 |
39 | id_availablefrom_month | 12 |
8ef42343 40 | id_availablefrom_year | 2037 |
932fa015 41 | id_showavailability | 1 |
932fa015
RT
42 And I press "Save and return to course"
43 And I log out
44 When I log in as "student1"
45 And I follow "Course 1"
8ef42343 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
d1e55a47 52 Given I click on "id_availableuntil_enabled" "checkbox"
f083d614 53 And I set the following fields to these values:
932fa015
RT
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 |
932fa015
RT
62 And I press "Save and return to course"
63 And I log out
64 When I log in as "student1"
65 And I follow "Course 1"
66 Then I should not see "Test assignment 2"