date_availability.feature 3.24 KB
Newer Older
1
@mod @mod_lesson
David Monllaó's avatar
David Monllaó committed
2
3
Feature: A teacher can set available from and deadline dates to access a lesson
  In order to schedule lesson activities
4
  As a teacher
David Monllaó's avatar
David Monllaó committed
5
6
7
  I need to set available from and deadline dates

  Background:
8
    Given the following "users" exist:
David Monllaó's avatar
David Monllaó committed
9
      | username | firstname | lastname | email |
10
11
      | teacher1 | Teacher | 1 | teacher1@example.com |
      | student1 | Student | 1 | student1@example.com |
12
    And the following "courses" exist:
David Monllaó's avatar
David Monllaó committed
13
14
      | fullname | shortname | category |
      | Course 1 | C1 | 0 |
15
    And the following "course enrolments" exist:
David Monllaó's avatar
David Monllaó committed
16
17
18
19
      | user | course | role |
      | teacher1 | C1 | editingteacher |
      | student1 | C1 | student |
    And I log in as "teacher1"
20
    And I am on "Course 1" course homepage with editing mode on
David Monllaó's avatar
David Monllaó committed
21
22

  Scenario: Forbidding lesson accesses until a specified date
ilya's avatar
ilya committed
23
24
25
26
27
28
    Given the following "activities" exist:
      | activity   | name        | intro                     | course | section | idnumber |
      | lesson     | Test lesson | Test lesson description   | C1     | 1       | lesson1  |
    And I am on "Course 1" course homepage
    And I follow "Test lesson"
    And I navigate to "Edit settings" in current page administration
29
    And I set the field "id_available_enabled" to "1"
30
    And I set the following fields to these values:
David Monllaó's avatar
David Monllaó committed
31
32
      | available[day] | 1 |
      | available[month] | January |
33
      | available[year] | 2030 |
David Monllaó's avatar
David Monllaó committed
34
35
      | available[hour] | 08 |
      | available[minute] | 00 |
ilya's avatar
ilya committed
36
    And I press "Save and return to course"
David Monllaó's avatar
David Monllaó committed
37
38
    And I follow "Test lesson"
    And I follow "Add a content page"
39
    And I set the following fields to these values:
David Monllaó's avatar
David Monllaó committed
40
41
42
43
44
45
      | Page title | First page name |
      | Page contents | First page contents |
      | Description | The first one |
    And I press "Save page"
    And I log out
    And I log in as "student1"
46
    And I am on "Course 1" course homepage
David Monllaó's avatar
David Monllaó committed
47
    When I follow "Test lesson"
48
    Then I should see "This lesson will be open on Tuesday, 1 January 2030, 8:00"
David Monllaó's avatar
David Monllaó committed
49
50
51
    And I should not see "First page contents"

  Scenario: Forbidding lesson accesses until a specified date
ilya's avatar
ilya committed
52
53
54
55
56
57
    Given the following "activities" exist:
      | activity   | name        | intro                     | course | section | idnumber |
      | lesson     | Test lesson | Test lesson description   | C1     | 1       | lesson1  |
    And I am on "Course 1" course homepage
    And I follow "Test lesson"
    And I navigate to "Edit settings" in current page administration
58
    And I set the field "id_deadline_enabled" to "1"
59
    And I set the following fields to these values:
David Monllaó's avatar
David Monllaó committed
60
61
62
63
64
      | deadline[day] | 1 |
      | deadline[month] | January |
      | deadline[year] | 2000 |
      | deadline[hour] | 08 |
      | deadline[minute] | 00 |
ilya's avatar
ilya committed
65
    And I press "Save and return to course"
David Monllaó's avatar
David Monllaó committed
66
67
    And I follow "Test lesson"
    And I follow "Add a content page"
68
    And I set the following fields to these values:
David Monllaó's avatar
David Monllaó committed
69
70
71
72
73
74
      | Page title | First page name |
      | Page contents | First page contents |
      | Description | The first one |
    And I press "Save page"
    And I log out
    And I log in as "student1"
75
    And I am on "Course 1" course homepage
David Monllaó's avatar
David Monllaó committed
76
    When I follow "Test lesson"
77
    Then I should see "This lesson closed on Saturday, 1 January 2000, 8:00"
David Monllaó's avatar
David Monllaó committed
78
    And I should not see "First page contents"