MDL-58520 block_myoverview: change display name to Course overview
[moodle.git] / blocks / myoverview / tests / behat / block_myoverview_dashboard.feature
CommitLineData
1dc764a6
SL
1@block @block_myoverview @javascript
2Feature: The my overview block allows users to easily access their courses and see upcoming activities
3 In order to enable the my overview block in a course
4 As a student
5 I can add the my overview 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 next month## | ##last day of next month## |
22 | feedback | C2 | feedback1 | Test feedback 1 | Test feedback description | ##yesterday## | ##tomorrow## |
23 | feedback | C3 | feedback3 | Test feedback 3 | Test feedback description | ##first day of next month## | ##last day of next month## |
24 And the following "course enrolments" exist:
25 | user | course | role |
26 | student1 | C1 | student |
27 | student1 | C2 | student |
28 | student1 | C3 | student |
29
30 Scenario: View courses and upcoming activities on timeline view
31 Given I log in as "student1"
4671ae63
RW
32 And I click on "Timeline" "link" in the "Course overview" "block"
33 When I click on "Sort by dates" "link" in the "Course overview" "block"
34 Then I should see "Next 7 days" in the "Course overview" "block"
35 And I should see "Choice Test choice 1 closes" in the "Course overview" "block"
36 And I should see "View choices" in the "Course overview" "block"
37 And I should see "Feedback Test feedback 1 closes" in the "Course overview" "block"
38 And I should see "Answer the questions" in the "Course overview" "block"
39 And I should see "##tomorrow##j M, H:i##" in the "Course overview" "block"
40 And I should see "Future" in the "Course overview" "block"
41 And I should see "Choice Test choice 3 closes" in the "Course overview" "block"
42 And I should see "Feedback Test feedback 3 closes" in the "Course overview" "block"
43 And I should see "##last day of next month##j M, H:i##" in the "Course overview" "block"
1dc764a6
SL
44 And I log out
45
46 Scenario: Past activities should not be displayed on the timeline view
47 Given I log in as "student1"
4671ae63
RW
48 And I click on "Timeline" "link" in the "Course overview" "block"
49 When I click on "Sort by dates" "link" in the "Course overview" "block"
50 And I should not see "Choice Test choice 2 closes" in the "Course overview" "block"
51 And I should not see "##1 month ago##j M, H:i##" in the "Course overview" "block"
1dc764a6
SL
52 And I log out
53
54 Scenario: See the courses I am enrolled by their status on courses view
55 Given I log in as "student1"
4671ae63
RW
56 And I click on "Courses" "link" in the "Course overview" "block"
57 And I click on "In progress" "link" in the "Course overview" "block"
58 And I should see "Course 2" in the "Course overview" "block"
59 And I should see "##yesterday##j F Y##" in the "Course overview" "block"
60 And I should see "##tomorrow##j F Y##" in the "Course overview" "block"
61 And I should not see "Course 1" in the "Course overview" "block"
62 And I click on "Future" "link" in the "Course overview" "block"
63 And I should see "Course 3" in the "Course overview" "block"
64 And I should see "##first day of next month##j F Y##" in the "Course overview" "block"
65 And I should see "##last day of next month##j F Y##" in the "Course overview" "block"
66 And I should not see "Course 1" in the "Course overview" "block"
67 When I click on "Past" "link" in the "Course overview" "block"
68 Then I should see "Course 1" in the "Course overview" "block"
69 And I should not see "Course 2" in the "Course overview" "block"
70 And I should not see "Course 3" in the "Course overview" "block"
71 And I should see "##1 month ago##j F Y##" in the "Course overview" "block"
72 And I should see "##15 days ago##j F Y##" in the "Course overview" "block"
1dc764a6
SL
73 And I log out
74
75 Scenario: No activities should be displayed if the user is not enrolled
76 Given I log in as "student2"
4671ae63
RW
77 And I click on "Timeline" "link" in the "Course overview" "block"
78 And I should see "No upcoming activities" in the "Course overview" "block"
79 When I click on "Courses" "link" in the "Course overview" "block"
80 Then I should see "No courses" in the "Course overview" "block"
1dc764a6 81 And I log out