MDL-64438 block_recentlyaccessedcourses: Optionally show course category
[moodle.git] / blocks / recentlyaccessedcourses / tests / behat / block_recentlyaccessedcourses_dashboard.feature
CommitLineData
41f61293
VDF
1@block @block_recentlyaccessedcourses @javascript
2Feature: The recently accessed courses block allows users to easily access their most recently accessed courses
3 In order to access the most recently accessed courses
4 As a user
5 I can use the Recently accessed courses block in my dashboard
6
7 Background:
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | student1 | Student | 1 | student1@example.com |
d0b237b3
MG
11 And the following "categories" exist:
12 | name | category | idnumber |
13 | Category 1 | 0 | CAT1 |
41f61293 14 And the following "courses" exist:
d0b237b3
MG
15 | fullname | shortname | category |
16 | Course 1 | C1 | 0 |
17 | Course 2 | C2 | 0 |
18 | Course 3 | C3 | 0 |
19 | Course 4 | C4 | CAT1 |
20 | Course 5 | C5 | 0 |
41f61293
VDF
21 And the following "course enrolments" exist:
22 | user | course | role |
23 | student1 | C1 | student |
24 | student1 | C2 | student |
25 | student1 | C3 | student |
26 | student1 | C4 | student |
27 | student1 | C5 | student |
28
29 Scenario: User has not accessed any course
30 Given I log in as "student1"
31 Then I should see "No recent courses" in the "Recently accessed courses" "block"
32
33 Scenario: User has accessed two courses
34 Given I log in as "student1"
35 And I should not see "Course 1" in the "Recently accessed courses" "block"
36 And I should not see "Course 2" in the "Recently accessed courses" "block"
37 When I am on "Course 1" course homepage
38 And I am on "Course 2" course homepage
39 And I follow "Dashboard" in the user menu
ba2b508c 40 And I change window size to "large"
41f61293
VDF
41 Then I should see "Course 1" in the "Recently accessed courses" "block"
42 And I should see "Course 2" in the "Recently accessed courses" "block"
43 And I should not see "Course 3" in the "Recently accessed courses" "block"
44 And I should not see "Course 4" in the "Recently accessed courses" "block"
45 And I should not see "Course 5" in the "Recently accessed courses" "block"
d0b237b3
MG
46
47 Scenario: Show course category name
48 Given the following config values are set as admin:
49 | displaycategories | 1 | block_recentlyaccessedcourses |
50 And I log in as "student1"
51 And I am on "Course 1" course homepage
52 And I am on "Course 4" course homepage
53 And I follow "Dashboard" in the user menu
54 And I should see "Miscellaneous" in the "Recently accessed courses" "block"
55 And I should see "Category 1" in the "Recently accessed courses" "block"
56
57 Scenario: Hide course category name
58 Given the following config values are set as admin:
59 | displaycategories | 0 | block_recentlyaccessedcourses |
60 And I log in as "student1"
61 And I am on "Course 1" course homepage
62 And I am on "Course 4" course homepage
63 And I follow "Dashboard" in the user menu
64 And I should not see "Miscellaneous" in the "Recently accessed courses" "block"
65 And I should not see "Category 1" in the "Recently accessed courses" "block"
66
67 Scenario: Show short course name
68 Given the following config values are set as admin:
69 | courselistshortnames | 1 |
70 And I log in as "student1"
71 And I am on "Course 1" course homepage
72 And I am on "Course 4" course homepage
73 And I follow "Dashboard" in the user menu
74 And I should see "C1" in the "Recently accessed courses" "block"
75 And I should see "C4" in the "Recently accessed courses" "block"
76
77 Scenario: Hide short course name
78 Given the following config values are set as admin:
79 | courselistshortnames | 0 |
80 And I log in as "student1"
81 And I am on "Course 1" course homepage
82 And I am on "Course 4" course homepage
83 And I follow "Dashboard" in the user menu
84 And I should not see "C1" in the "Recently accessed courses" "block"
85 And I should not see "C4" in the "Recently accessed courses" "block"