1 |
efrain |
1 |
@eWallah @availability @availability_relativedate @javascript
|
|
|
2 |
Feature: availability_relativedate ui
|
|
|
3 |
As an admin
|
|
|
4 |
I also need to be able to use relative dates
|
|
|
5 |
|
|
|
6 |
Background:
|
|
|
7 |
Given the following config values are set as admin:
|
|
|
8 |
| enableavailability | 1 |
|
|
|
9 |
And the following "course" exists:
|
|
|
10 |
| fullname | Course 1 |
|
|
|
11 |
| shortname | C1 |
|
|
|
12 |
| category | 0 |
|
|
|
13 |
| enablecompletion | 1 |
|
|
|
14 |
| startdate | ## -10 days 17:00 ## |
|
|
|
15 |
| enddate | ## +2 weeks 17:00 ## |
|
|
|
16 |
And the following "activities" exist:
|
|
|
17 |
| activity | name | intro | course | idnumber | section | visible | completion |
|
|
|
18 |
| page | Page A | intro | C1 | pageA | 1 | 1 | 1 |
|
|
|
19 |
| page | Page B | intro | C1 | pageB | 1 | 1 | 1 |
|
|
|
20 |
And the following "users" exist:
|
|
|
21 |
| username |
|
|
|
22 |
| teacher1 |
|
|
|
23 |
And the following "course enrolments" exist:
|
|
|
24 |
| user | course | role |
|
|
|
25 |
| teacher1 | C1 | editingteacher |
|
|
|
26 |
And selfenrolment exists in course "C1" ending "## tomorrow 17:00 ##"
|
|
|
27 |
|
|
|
28 |
Scenario Outline: Add relative condition ui
|
|
|
29 |
Given I am on the "pageA" "page activity editing" page logged in as teacher1
|
|
|
30 |
And I expand all fieldsets
|
|
|
31 |
And I click on "Add restriction..." "button"
|
|
|
32 |
And I click on "Relative date" "button" in the "Add restriction..." "dialogue"
|
|
|
33 |
And I set the field "relativenumber" to <number>
|
|
|
34 |
And I set the field "relativednw" to <dmw>
|
|
|
35 |
And I set the field "relativestart" to <relstart>
|
|
|
36 |
And I press "Save and return to course"
|
|
|
37 |
Then I should see "<cond>"
|
|
|
38 |
|
|
|
39 |
Examples:
|
|
|
40 |
| number | dmw | relstart | cond |
|
|
|
41 |
| "1" | "0" | "1" | 1 minute after course start date |
|
|
|
42 |
| "2" | "0" | "1" | 2 minutes after course start date |
|
|
|
43 |
| "3" | "1" | "2" | 3 hours before course end date |
|
|
|
44 |
| "4" | "2" | "3" | 4 days after user enrolment date |
|
|
|
45 |
| "5" | "3" | "4" | 5 weeks after enrolment method end |
|
|
|
46 |
| "6" | "4" | "5" | 6 months after course end date |
|
|
|
47 |
| "7" | "4" | "6" | 7 months before course start date |
|
|
|
48 |
|
|
|
49 |
Scenario: Add relative condition ui to a section
|
|
|
50 |
When I log in as "teacher1"
|
|
|
51 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
52 |
And I edit the section "1"
|
|
|
53 |
And I expand all fieldsets
|
|
|
54 |
And I press "Add restriction..."
|
|
|
55 |
And I click on "Relative date" "button" in the "Add restriction..." "dialogue"
|
|
|
56 |
And I set the field "relativenumber" to "1"
|
|
|
57 |
And I set the field "relativednw" to "1"
|
|
|
58 |
And I set the field "relativestart" to "7"
|
|
|
59 |
And I set the field "relativecoursemodule" to "Page A"
|
|
|
60 |
When I press "Save changes"
|
|
|
61 |
Then I should see "1 hour after completion of"
|
|
|
62 |
|
|
|
63 |
Scenario: Add relative condition ui with a module
|
|
|
64 |
Given I am on the "pageB" "page activity editing" page logged in as teacher1
|
|
|
65 |
And I expand all fieldsets
|
|
|
66 |
And I click on "Add restriction..." "button"
|
|
|
67 |
And I click on "Relative date" "button" in the "Add restriction..." "dialogue"
|
|
|
68 |
And I set the field "relativenumber" to "1"
|
|
|
69 |
And I set the field "relativednw" to "2"
|
|
|
70 |
And I set the field "relativestart" to "7"
|
|
|
71 |
And I set the field "relativecoursemodule" to "Page A"
|
|
|
72 |
When I press "Save and return to course"
|
|
|
73 |
Then I should see "1 day after completion of activity Page A"
|