Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@eWallah @availability @availability_relativedate @javascript
2
Feature: availability_relativedate
3
  In order to control student access to activities
4
  As a teacher
5
  I need to set date conditions which prevent student access
6
 
7
  Background:
8
    Given the following "users" exist:
9
      | username | timezone |
10
      | teacher1 | 5        |
11
      | student1 | 5        |
12
      | student2 | 5        |
13
    And the following config values are set as admin:
14
      | enableavailability   | 1 |
15
    And the following "course" exists:
16
      | fullname          | Course 1             |
17
      | shortname         | C1                   |
18
      | category          | 0                    |
19
      | enablecompletion  | 1                    |
20
      | startdate         | ## -10 days 17:00 ## |
21
      | enddate           | ## +2 weeks 17:00 ## |
22
      | numsections       | 5                    |
23
    And the following "activities" exist:
24
      | activity   | name  | course | idnumber | section | completion |
25
      | page       | PageA | C1     | pageA    | 1       | 1          |
26
      | page       | PageB | C1     | pageB    | 1       | 1          |
27
      | page       | PageC | C1     | pageC    | 1       | 1          |
28
      | page       | PageD | C1     | pageD    | 1       | 1          |
29
      | page       | PageE | C1     | pageE    | 1       | 1          |
30
    And selfenrolment exists in course "C1" ending "## tomorrow 17:00 ##"
31
    And the following "course enrolments" exist:
32
      | user     | course | role           | timestart             |
33
      | teacher1 | C1     | editingteacher | ## yesterday 17:00 ## |
34
      | student1 | C1     | student        | ## yesterday 17:00 ## |
35
 
36
  Scenario: Restrict section0
37
    Given I log in as "teacher1"
38
    And I am on "Course 1" course homepage with editing mode on
39
    And I edit the section "0"
40
    And I expand all fieldsets
41
    When I click on "Add restriction..." "button"
42
    Then "Relative date" "button" should exist in the "Add restriction..." "dialogue"
43
 
44
  Scenario: Test relative conditions
45
    Given I am on the "pageA" "page activity editing" page logged in as teacher1
46
    And I expand all fieldsets
47
    And I click on "Add restriction..." "button"
48
    And I click on "Relative date" "button" in the "Add restriction..." "dialogue"
49
    And I set the field "relativenumber" to "2"
50
    And I set the field "relativednw" to "1"
51
    And I set the field "relativestart" to "1"
52
    And I press "Save and return to course"
53
 
54
    And I am on the "pageB" "page activity editing" page logged in as teacher1
55
    And I expand all fieldsets
56
    And I click on "Add restriction..." "button"
57
    And I click on "Relative date" "button" in the "Add restriction..." "dialogue"
58
    And I set the field "relativenumber" to "4"
59
    And I set the field "relativednw" to "2"
60
    And I set the field "relativestart" to "2"
61
    And I press "Save and return to course"
62
 
63
    And I am on the "pageC" "page activity editing" page logged in as teacher1
64
    And I expand all fieldsets
65
    And I click on "Add restriction..." "button"
66
    And I click on "Relative date" "button" in the "Add restriction..." "dialogue"
67
    And I set the field "relativenumber" to "6"
68
    And I set the field "relativednw" to "3"
69
    And I set the field "relativestart" to "3"
70
    And I press "Save and return to course"
71
 
72
    And I am on the "pageD" "page activity editing" page logged in as teacher1
73
    And I expand all fieldsets
74
    And I click on "Add restriction..." "button"
75
    And I click on "Relative date" "button" in the "Add restriction..." "dialogue"
76
    And I set the field "relativenumber" to "7"
77
    And I set the field "relativednw" to "4"
78
    And I set the field "relativestart" to "4"
79
    And I press "Save and return to course"
80
 
81
    # 5 days before course start date.
82
    And I am on "Course 1" course homepage with editing mode on
83
    And I change window size to "large"
84
    And I edit the section "2"
85
    When I expand all fieldsets
86
    Then I should see "None" in the "Restrict access" "fieldset"
87
    And I click on "Add restriction..." "button"
88
    And  I click on "Relative date" "button" in the "Add restriction..." "dialogue"
89
    And I set the field "relativenumber" to "5"
90
    And I set the field "relativednw" to "2"
91
    And I set the field "relativestart" to "1"
92
    And I press "Save changes"
93
 
94
    And I am on "Course 1" course homepage with editing mode on
95
    And I edit the section "2"
96
    When I expand all fieldsets
97
    Then I should see "5" in the "Restrict access" "fieldset"
98
    And I should see "days" in the "Restrict access" "fieldset"
99
    And I should see "after course start date" in the "Restrict access" "fieldset"
100
    And I press "Cancel"
101
 
102
    # 5 days after course end date.
103
    And I am on "Course 1" course homepage with editing mode on
104
    And I edit the section "3"
105
    When I expand all fieldsets
106
    Then I should see "None" in the "Restrict access" "fieldset"
107
    And I click on "Add restriction..." "button"
108
    And  I click on "Relative date" "button" in the "Add restriction..." "dialogue"
109
    And I set the field "relativenumber" to "5"
110
    And I set the field "relativednw" to "2"
111
    And I set the field "relativestart" to "2"
112
    And I press "Save changes"
113
 
114
    And I am on "Course 1" course homepage
115
    And I should see "PageA" in the "region-main" "region"
116
    And I should see "2 hours after course start date" in the "region-main" "region"
117
    And I should see "4 days before course end date" in the "region-main" "region"
118
    And I should see relativedate "##+2 weeks -4 days 17:00##"
119
    And I should see "6 weeks after user enrolment date" in the "region-main" "region"
120
    And I should see relativedate "##+6 weeks -1 days 17:00##"
121
    And I should see "7 months after enrolment method end date" in the "region-main" "region"
122
    And I should see "5 days after course start date" in the "region-main" "region"
123
    And I log out
124
 
125
    # Log back in as student 1.
126
    When I am on the "C1" "Course" page logged in as "student1"
127
    Then I should see "PageA" in the "region-main" "region"
128
    And I should not see "2 hours after course start date" in the "region-main" "region"
129
    And I should see "PageB" in the "region-main" "region"
130
    And I should see relativedate "##+2 weeks -4 days 17:00##"
131
    But I should see "PageC" in the "region-main" "region"
132
    And I should see relativedate "##+6 weeks -1 days 17:00##"
133
    And I should see "PageD" in the "region-main" "region"
134
    And I log out
135
 
136
    # Log back in as student 2.
137
    When I am on the "C1" "Course" page logged in as "student2"
138
    And I press "Enrol me"
139
    Then I should see "PageA" in the "region-main" "region"
140
    And I should not see "2 hours after course start date" in the "region-main" "region"
141
    And I should see "PageB" in the "region-main" "region"
142
    But I should see "PageC" in the "region-main" "region"
143
    And I should see "PageD" in the "region-main" "region"
144
    And I log out
145
 
146
    # Log back in as admin.
147
    When I am on the "C1" "Course" page logged in as "admin"
148
    Then I should see "2 hours after course start date" in the "region-main" "region"
149
    And I should see "4 days before course end date" in the "region-main" "region"
150
    And I should see "6 weeks after user enrolment date" in the "region-main" "region"
151
    And I should see "7 months after enrolment method end date" in the "region-main" "region"
152
    And I should see "5 days after course start date" in the "region-main" "region"