MDL-63044 block_timeline: add timeline block
[moodle.git] / blocks / timeline / tests / behat / block_timeline_courses.feature
blobf9376847a4c63c6d0cf51d7a9549efde3edae22e
1 @block @block_timeline @javascript
2 Feature: 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
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        | ##yesterday##               | ##tomorrow## |
15       | Course 2 | C2        | 0        | ##yesterday##               | ##tomorrow## |
16       | Course 3 | C3        | 0        | ##yesterday##               | ##tomorrow## |
17       | Course 4 | C4        | 0        | ##first day of next month## | ##last day of next month## |
18     And the following "activities" exist:
19       | activity | course | idnumber  | name            | intro                   | timeopen      | timeclose     |
20       | choice   | C2     | choice1   | Test choice 1   | Test choice description | ##yesterday## | ##tomorrow##  |
21       | choice   | C1     | choice2   | Test choice 2   | Test choice description | ##1 month ago## | ##15 days ago##  |
22       | choice   | C3     | choice3   | Test choice 3   | Test choice description | ##first day of +5 months## | ##last day of +5 months##  |
23       | feedback | C2     | feedback1 | Test feedback 1 | Test feedback description | ##yesterday## | ##tomorrow##  |
24       | feedback | C1     | feedback2 | Test feedback 2 | Test feedback description | ##first day of +10 months## | ##last day of +10 months##  |
25       | feedback | C3     | feedback3 | Test feedback 3 | Test feedback description | ##first day of +5 months## | ##last day of +5 months## |
26       | feedback | C4     | feedback4 | Test feedback 4 | Test feedback description | ##yesterday## | ##tomorrow## |
27     And the following "activities" exist:
28       | activity | course | idnumber  | name            | intro                   | timeopen        | duedate     |
29       | assign   | C1     | assign1   | Test assign 1   | Test assign description | ##1 month ago## | ##yesterday##  |
30     And the following "course enrolments" exist:
31       | user | course | role |
32       | student1 | C1 | student |
33       | student1 | C2 | student |
34       | student1 | C3 | student |
35       | student1 | C4 | student |
37   Scenario: Next 30 days in course view
38     Given I log in as "student1"
39     And I click on "Sort" "button" in the "Timeline" "block"
40     When I click on "Sort by courses" "link" in the "Timeline" "block"
41     Then I should see "Course 1" in the "Timeline" "block"
42     And I should see "Course 2" in the "Timeline" "block"
43     And I should see "More courses" in the "Timeline" "block"
44     And I should see "Test choice 1 closes" in the "Timeline" "block"
45     And I should see "Test feedback 1 closes" in the "Timeline" "block"
46     And I should not see "Course 3" in the "Timeline" "block"
47     And I should not see "Test choice 2 closes" in the "Timeline" "block"
48     And I should not see "Test choice 3 closes" in the "Timeline" "block"
49     And I should not see "Test feedback 2 closes" in the "Timeline" "block"
50     And I should not see "Test feedback 3 closes" in the "Timeline" "block"
51     And I should not see "Test assign 1 is due" in the "Timeline" "block"
53   Scenario: All in course view
54     Given I log in as "student1"
55     And I click on "Next 30 days" "button" in the "Timeline" "block"
56     And I click on "All" "link" in the "Timeline" "block"
57     And I click on "Sort" "button" in the "Timeline" "block"
58     And I click on "Sort by courses" "link" in the "Timeline" "block"
59     When I click on "More courses" "button" in the "Timeline" "block"
60     Then I should see "Course 3" in the "Timeline" "block"
61     And I should see "Course 2" in the "Timeline" "block"
62     And I should see "Course 1" in the "Timeline" "block"
63     And I should see "Test choice 1 closes" in the "Timeline" "block"
64     And I should see "Test choice 3 closes" in the "Timeline" "block"
65     And I should see "Test feedback 1 closes" in the "Timeline" "block"
66     And I should see "Test feedback 2 closes" in the "Timeline" "block"
67     And I should see "Test feedback 3 closes" in the "Timeline" "block"
68     And I should see "Test assign 1 is due" in the "Timeline" "block"
69     And I should not see "More courses" in the "Timeline" "block"
70     And I should not see "Course 4" in the "Timeline" "block"
71     And I should not see "Test choice 2 closes" in the "Timeline" "block"
72     And I should not see "Test feedback 4 closes" in the "Timeline" "block"