weekly release 3.6dev
[moodle.git] / blocks / timeline / tests / behat / block_timeline_dates.feature
CommitLineData
1e44de35
RW
1@block @block_timeline @javascript
2Feature: The timeline block allows users to see upcoming activities
3 In order to enable the timeline block
4 As a student
5 I can add the timeline block to my dashboard
6
7 Background:
8 Given the following "users" exist:
9 | username | firstname | lastname | email | idnumber |
10 | student1 | Student | 1 | student1@example.com | S1 |
11 | student2 | Student | 2 | student2@example.com | S2 |
12 And the following "courses" exist:
13 | fullname | shortname | category | startdate | enddate |
14 | Course 1 | C1 | 0 | ##1 month ago## | ##15 days ago## |
15 | Course 2 | C2 | 0 | ##yesterday## | ##tomorrow## |
16 | Course 3 | C3 | 0 | ##first day of next month## | ##last day of next month## |
17 And the following "activities" exist:
18 | activity | course | idnumber | name | intro | timeopen | timeclose |
19 | choice | C2 | choice1 | Test choice 1 | Test choice description | ##yesterday## | ##tomorrow## |
20 | choice | C1 | choice2 | Test choice 2 | Test choice description | ##1 month ago## | ##15 days ago## |
21 | choice | C3 | choice3 | Test choice 3 | Test choice description | ##first day of +5 months## | ##last day of +5 months## |
22 | feedback | C2 | feedback1 | Test feedback 1 | Test feedback description | ##yesterday## | ##tomorrow## |
23 | feedback | C1 | feedback2 | Test feedback 2 | Test feedback description | ##first day of +10 months## | ##last day of +10 months## |
24 | feedback | C3 | feedback3 | Test feedback 3 | Test feedback description | ##first day of +5 months## | ##last day of +5 months## |
25 And the following "activities" exist:
26 | activity | course | idnumber | name | intro | timeopen | duedate |
27 | assign | C1 | assign1 | Test assign 1 | Test assign description | ##1 month ago## | ##yesterday## |
28 And the following "course enrolments" exist:
29 | user | course | role |
30 | student1 | C1 | student |
31 | student1 | C2 | student |
32 | student1 | C3 | student |
33
34 Scenario: Next 7 days in date view
35 Given I log in as "student1"
36 And I click on "Next 30 days" "button" in the "Timeline" "block"
37 When I click on "Next 7 days" "link" in the "Timeline" "block"
38 Then I should see "Test choice 1 closes" in the "Timeline" "block"
39 And I should see "Test feedback 1 closes" in the "Timeline" "block"
40 And I should not see "Test choice 2 closes" in the "Timeline" "block"
41 And I should not see "Test choice 3 closes" in the "Timeline" "block"
42 And I should not see "Test feedback 3 closes" in the "Timeline" "block"
43 And I should not see "Test assign 1 is due" in the "Timeline" "block"
44
45 Scenario: Overdue in date view
46 Given I log in as "student1"
47 And I click on "Next 30 days" "button" in the "Timeline" "block"
48 When I click on "Overdue" "link" in the "Timeline" "block"
49 Then I should see "Test assign 1 is due" in the "Timeline" "block"
50 And I should not see "Test choice 2 closes" in the "Timeline" "block"
51 And I should not see "Test feedback 1 closes" in the "Timeline" "block"
52 And I should not see "Test choice 1 closes" in the "Timeline" "block"
53 And I should not see "Test choice 3 closes" in the "Timeline" "block"
54 And I should not see "Test feedback 3 closes" in the "Timeline" "block"
55
56 Scenario: All in date view
57 Given I log in as "student1"
58 And I click on "Next 30 days" "button" in the "Timeline" "block"
59 When I click on "All" "link" in the "Timeline" "block"
60 Then I should see "Test assign 1 is due" in the "Timeline" "block"
61 And I should see "Test feedback 1 closes" in the "Timeline" "block"
62 And I should see "Test choice 1 closes" in the "Timeline" "block"
63 And I should see "Test choice 3 closes" in the "Timeline" "block"
64 And I should see "Test feedback 3 closes" in the "Timeline" "block"
65 And I should not see "Test choice 2 closes" in the "Timeline" "block"
66 And I should not see "Test feedback 2 closes" in the "Timeline" "block"
52b78455 67 And I click on "[data-region='paging-bar'] [data-control='next'] [data-region='page-link']" "css_element" in the "Timeline" "block"
1e44de35
RW
68 And I should see "Test feedback 2 closes" in the "Timeline" "block"
69 And I should not see "Test assign 1 is due" in the "Timeline" "block"
70 And I should not see "Test feedback 1 closes" in the "Timeline" "block"
71 And I should not see "Test choice 1 closes" in the "Timeline" "block"
72 And I should not see "Test choice 3 closes" in the "Timeline" "block"
73 And I should not see "Test feedback 3 closes" in the "Timeline" "block"
74 And I should not see "Test choice 2 closes" in the "Timeline" "block"
75
76 Scenario: All in date view no next
77 Given I log in as "student1"
78 And I click on "Next 30 days" "button" in the "Timeline" "block"
79 And I click on "All" "link" in the "Timeline" "block"
80 And I click on "5" "button" in the "Timeline" "block"
81 When I click on "25" "link" in the "Timeline" "block"
82 Then I should see "Test assign 1 is due" in the "Timeline" "block"
83 And I should see "Test feedback 1 closes" in the "Timeline" "block"
84 And I should see "Test choice 1 closes" in the "Timeline" "block"
85 And I should see "Test choice 3 closes" in the "Timeline" "block"
86 And I should see "Test feedback 3 closes" in the "Timeline" "block"
87 And I should see "Test feedback 2 closes" in the "Timeline" "block"
88 And I should not see "Test choice 2 closes" in the "Timeline" "block"