1 |
efrain |
1 |
@availability @availability_date @javascript
|
|
|
2 |
Feature: As a teacher I can set availability dates restriction to an activity and see a warning when conflicting dates are set
|
|
|
3 |
|
|
|
4 |
Background:
|
|
|
5 |
Given the following "courses" exist:
|
|
|
6 |
| fullname | shortname | format | enablecompletion |
|
|
|
7 |
| Course 1 | C1 | topics | 1 |
|
|
|
8 |
And the following "users" exist:
|
|
|
9 |
| username |
|
|
|
10 |
| teacher1 |
|
|
|
11 |
And the following "course enrolments" exist:
|
|
|
12 |
| user | course | role |
|
|
|
13 |
| teacher1 | C1 | editingteacher |
|
|
|
14 |
And the following "activities" exist:
|
|
|
15 |
| activity | name | intro | introformat | course | content | contentformat | idnumber |
|
|
|
16 |
| page | PageName1 | PageDesc1 | 1 | C1 | Page 1 | 1 | 1 |
|
|
|
17 |
|
|
|
18 |
Scenario: When I set dates to potential conflicting dates in the same subset, I should see a warning.
|
|
|
19 |
Given I am on the PageName1 "page activity editing" page logged in as teacher1
|
|
|
20 |
And I expand all fieldsets
|
|
|
21 |
And I click on "Add restriction..." "button" in the "root" "core_availability > Availability Button Area"
|
|
|
22 |
And I click on "Date" "button" in the "Add restriction..." "dialogue"
|
|
|
23 |
And I set the field "year" in the "1" "availability_date > Date Restriction" to "2023"
|
|
|
24 |
And I set the field "Month" in the "1" "availability_date > Date Restriction" to "April"
|
|
|
25 |
And I set the field "day" in the "1" "availability_date > Date Restriction" to "4"
|
|
|
26 |
And I set the field "Direction" in the "1" "availability_date > Date Restriction" to "from"
|
|
|
27 |
And I click on "Add restriction..." "button" in the "root" "core_availability > Availability Button Area"
|
|
|
28 |
And I click on "Date" "button" in the "Add restriction..." "dialogue"
|
|
|
29 |
And I set the field "year" in the "2" "availability_date > Date Restriction" to "2023"
|
|
|
30 |
And I set the field "Month" in the "2" "availability_date > Date Restriction" to "April"
|
|
|
31 |
And I set the field "day" in the "2" "availability_date > Date Restriction" to "6"
|
|
|
32 |
And I set the field "Direction" in the "2" "availability_date > Date Restriction" to "until"
|
|
|
33 |
And I click on "Add restriction..." "button" in the "root" "core_availability > Availability Button Area"
|
|
|
34 |
And I click on "Date" "button" in the "Add restriction..." "dialogue"
|
|
|
35 |
And I set the field "year" in the "3" "availability_date > Date Restriction" to "2023"
|
|
|
36 |
And I set the field "Month" in the "3" "availability_date > Date Restriction" to "April"
|
|
|
37 |
And I set the field "day" in the "3" "availability_date > Date Restriction" to "6"
|
|
|
38 |
When I set the field "Direction" in the "3" "availability_date > Date Restriction" to "from"
|
|
|
39 |
Then I should see "Conflicts with other date restrictions"
|
|
|
40 |
|
|
|
41 |
Scenario: If there are conflicting dates in the same subset, I should not see a warning if condition are separated by "any".
|
|
|
42 |
Given I am on the PageName1 "page activity editing" page logged in as teacher1
|
|
|
43 |
And I expand all fieldsets
|
|
|
44 |
And I click on "Add restriction..." "button" in the "root" "core_availability > Availability Button Area"
|
|
|
45 |
And I click on "Restriction set" "button" in the "Add restriction..." "dialogue"
|
|
|
46 |
And I click on "Add restriction..." "button" in the "1" "core_availability > Availability Button Area"
|
|
|
47 |
And I click on "Date" "button" in the "Add restriction..." "dialogue"
|
|
|
48 |
And I set the field "year" in the "1.1" "availability_date > Date Restriction" to "2023"
|
|
|
49 |
And I set the field "Month" in the "1.1" "availability_date > Date Restriction" to "April"
|
|
|
50 |
And I set the field "day" in the "1.1" "availability_date > Date Restriction" to "4"
|
|
|
51 |
And I set the field "Direction" in the "1.1" "availability_date > Date Restriction" to "from"
|
|
|
52 |
And I click on "Add restriction..." "button" in the "1" "core_availability > Availability Button Area"
|
|
|
53 |
And I click on "Date" "button" in the "Add restriction..." "dialogue"
|
|
|
54 |
And I set the field "year" in the "1.2" "availability_date > Date Restriction" to "2023"
|
|
|
55 |
And I set the field "Month" in the "1.2" "availability_date > Date Restriction" to "April"
|
|
|
56 |
And I set the field "day" in the "1.2" "availability_date > Date Restriction" to "6"
|
|
|
57 |
And I set the field "Direction" in the "1.2" "availability_date > Date Restriction" to "until"
|
|
|
58 |
And I click on "Add restriction..." "button" in the "1" "core_availability > Availability Button Area"
|
|
|
59 |
And I click on "Date" "button" in the "Add restriction..." "dialogue"
|
|
|
60 |
And I set the field "year" in the "1.3" "availability_date > Date Restriction" to "2023"
|
|
|
61 |
And I set the field "Month" in the "1.3" "availability_date > Date Restriction" to "April"
|
|
|
62 |
And I set the field "day" in the "1.3" "availability_date > Date Restriction" to "6"
|
|
|
63 |
And I set the field "Direction" in the "1.3" "availability_date > Date Restriction" to "from"
|
|
|
64 |
When I set the field "Required restrictions" in the "1" "core_availability > Set Of Restrictions" to "any"
|
|
|
65 |
Then I should not see "Conflicts with other date restrictions"
|
|
|
66 |
|
|
|
67 |
Scenario: There should a conflicting availability dates are in the same subset separated by "all".
|
|
|
68 |
Given I am on the PageName1 "page activity editing" page logged in as teacher1
|
|
|
69 |
And I expand all fieldsets
|
|
|
70 |
# Root level: Student "must" match the following.
|
|
|
71 |
And I click on "Add restriction..." "button" in the "root" "core_availability > Availability Button Area"
|
|
|
72 |
And I click on "Restriction set" "button" in the "Add restriction..." "dialogue"
|
|
|
73 |
# This is the second level: Student "must" match any of the following.
|
|
|
74 |
And I click on "Add restriction..." "button" in the "1" "core_availability > Availability Button Area"
|
|
|
75 |
And I click on "Restriction set" "button" in the "Add restriction..." "dialogue"
|
|
|
76 |
# And now the third and final level.
|
|
|
77 |
And I click on "Add restriction..." "button" in the "1.1" "core_availability > Availability Button Area"
|
|
|
78 |
And I click on "Date" "button" in the "Add restriction..." "dialogue"
|
|
|
79 |
And I set the field "year" in the "1.1.1" "availability_date > Date Restriction" to "2023"
|
|
|
80 |
And I set the field "Month" in the "1.1.1" "availability_date > Date Restriction" to "April"
|
|
|
81 |
And I set the field "day" in the "1.1.1" "availability_date > Date Restriction" to "2"
|
|
|
82 |
And I set the field "Direction" in the "1.1.1" "availability_date > Date Restriction" to "from"
|
|
|
83 |
And I click on "Add restriction..." "button" in the "1.1" "core_availability > Availability Button Area"
|
|
|
84 |
And I click on "Date" "button" in the "Add restriction..." "dialogue"
|
|
|
85 |
And I set the field "year" in the "1.1.2" "availability_date > Date Restriction" to "2023"
|
|
|
86 |
And I set the field "Month" in the "1.1.2" "availability_date > Date Restriction" to "April"
|
|
|
87 |
And I set the field "day" in the "1.1.2" "availability_date > Date Restriction" to "3"
|
|
|
88 |
And I set the field "Direction" in the "1.1.2" "availability_date > Date Restriction" to "until"
|
|
|
89 |
# Then add a restriction to the second level.
|
|
|
90 |
And I click on "Add restriction..." "button" in the "1" "core_availability > Availability Button Area"
|
|
|
91 |
And I click on "Restriction set" "button" in the "Add restriction..." "dialogue"
|
|
|
92 |
And I click on "Add restriction..." "button" in the "1.2" "core_availability > Availability Button Area"
|
|
|
93 |
And I click on "Date" "button" in the "Add restriction..." "dialogue"
|
|
|
94 |
And I set the field "year" in the "1.2.1" "availability_date > Date Restriction" to "2023"
|
|
|
95 |
And I set the field "Month" in the "1.2.1" "availability_date > Date Restriction" to "April"
|
|
|
96 |
And I set the field "day" in the "1.2.1" "availability_date > Date Restriction" to "4"
|
|
|
97 |
And I set the field "Direction" in the "1.2.1" "availability_date > Date Restriction" to "from"
|
|
|
98 |
And I click on "Add restriction..." "button" in the "1.2" "core_availability > Availability Button Area"
|
|
|
99 |
And I click on "Date" "button" in the "Add restriction..." "dialogue"
|
|
|
100 |
And I set the field "year" in the "1.2.2" "availability_date > Date Restriction" to "2023"
|
|
|
101 |
And I set the field "Month" in the "1.2.2" "availability_date > Date Restriction" to "April"
|
|
|
102 |
And I set the field "day" in the "1.2.2" "availability_date > Date Restriction" to "3"
|
|
|
103 |
When I set the field "Direction" in the "1.2.2" "availability_date > Date Restriction" to "until"
|
|
|
104 |
# Same subset, we can detect conflicts.
|
|
|
105 |
Then I should see "Conflicts with other date restrictions"
|