MDL-42282 Behat: Automated test for MDLQA-509
[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
23
24 @javascript
25 Scenario: Show activity greyed-out to students when available from date is in future
26 Given I log in as "teacher1"
27 And I follow "Course 1"
28 And I turn editing mode on
29 And I add a "Assignment" to section "1"
30 And I fill the moodle form with:
31 | Assignment name | Test assignment 1 |
32 | Description | This assignment is restricted by date |
33 | assignsubmission_onlinetext_enabled | 1 |
34 | assignsubmission_file_enabled | 0 |
35 | id_availablefrom_day | 31 |
36 | id_availablefrom_month | 12 |
37 | id_availablefrom_year | 2050 |
38 | id_showavailability | 1 |
39 And I click on "id_availablefrom_enabled" "checkbox"
40 And I press "Save and return to course"
41 And I log out
42 When I log in as "student1"
43 And I follow "Course 1"
44 Then I should see "Available from 31 December 2050."
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
50 Given I log in as "teacher1"
51 And I follow "Course 1"
52 And I turn editing mode on
53 And I add a "Assignment" to section "2"
54 And I fill the moodle form with:
55 | Assignment name | Test assignment 2 |
56 | Description | This assignment is restricted by date |
57 | assignsubmission_onlinetext_enabled | 1 |
58 | assignsubmission_file_enabled | 0 |
59 | id_availableuntil_day | 1 |
60 | id_availableuntil_month | 2 |
61 | id_availableuntil_year | 2013 |
62 | id_showavailability | 0 |
63 And I click on "id_availableuntil_enabled" "checkbox"
64 And I press "Save and return to course"
65 And I log out
66 When I log in as "student1"
67 And I follow "Course 1"
68 Then I should not see "Test assignment 2"