2 Feature: A teacher can set available from and deadline dates to access a lesson
3 In order to schedule lesson activities
5 I need to set available from and deadline dates
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | teacher1 | Teacher | 1 | teacher1@asd.com |
11 | student1 | Student | 1 | student1@asd.com |
12 And the following "courses" exist:
13 | fullname | shortname | category |
15 And the following "course enrolments" exist:
16 | user | course | role |
17 | teacher1 | C1 | editingteacher |
18 | student1 | C1 | student |
19 And I log in as "teacher1"
20 And I follow "Course 1"
21 And I turn editing mode on
24 Scenario: Forbidding lesson accesses until a specified date
25 Given I add a "Lesson" to section "1"
26 And I expand all fieldsets
27 And I click on "id_available_enabled" "checkbox"
28 And I set the following fields to these values:
29 | Name | Test lesson |
30 | available[day] | 1 |
31 | available[month] | January |
32 | available[year] | 2020 |
33 | available[hour] | 08 |
34 | available[minute] | 00 |
35 And I press "Save and display"
36 And I follow "Test lesson"
37 And I follow "Add a content page"
38 And I set the following fields to these values:
39 | Page title | First page name |
40 | Page contents | First page contents |
41 | Description | The first one |
42 And I press "Save page"
44 And I log in as "student1"
45 And I follow "Course 1"
46 When I follow "Test lesson"
47 Then I should see "This lesson will be open on Wednesday, 1 January 2020, 8:00"
48 And I should not see "First page contents"
51 Scenario: Forbidding lesson accesses until a specified date
52 Given I add a "Lesson" to section "1"
53 And I expand all fieldsets
54 And I click on "id_deadline_enabled" "checkbox"
55 And I set the following fields to these values:
56 | Name | Test lesson |
58 | deadline[month] | January |
59 | deadline[year] | 2000 |
60 | deadline[hour] | 08 |
61 | deadline[minute] | 00 |
62 And I press "Save and display"
63 And I follow "Test lesson"
64 And I follow "Add a content page"
65 And I set the following fields to these values:
66 | Page title | First page name |
67 | Page contents | First page contents |
68 | Description | The first one |
69 And I press "Save page"
71 And I log in as "student1"
72 And I follow "Course 1"
73 When I follow "Test lesson"
74 Then I should see "This lesson closed on Saturday, 1 January 2000, 8:00"
75 And I should not see "First page contents"