1 |
efrain |
1 |
@block @block_myoverview @javascript
|
|
|
2 |
Feature: Zero state on my overview block
|
|
|
3 |
In order to know what should be the next step
|
|
|
4 |
As a user
|
|
|
5 |
I should see the proper information based on my capabilities
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email | idnumber |
|
|
|
10 |
| user | User | X | user@example.com | U1 |
|
|
|
11 |
| manager | Manager | X | manager@example.com | M1 |
|
|
|
12 |
And the following "role assigns" exist:
|
|
|
13 |
| user | role | contextlevel | reference |
|
|
|
14 |
| manager | manager | System | |
|
|
|
15 |
|
|
|
16 |
Scenario: Users with no permissions don't see any CTA
|
|
|
17 |
Given I am on the "My courses" page logged in as "user"
|
|
|
18 |
When I should see "You're not enrolled in any course"
|
|
|
19 |
Then I should see "Once you're enrolled in a course, it will appear here."
|
|
|
20 |
And I should not see "Create course"
|
|
|
21 |
And I should not see "Request a course"
|
|
|
22 |
|
|
|
23 |
Scenario: Users with permissions to request a course should see a Request course button
|
|
|
24 |
Given the following "permission overrides" exist:
|
|
|
25 |
| capability | permission | role | contextlevel | reference |
|
|
|
26 |
| moodle/course:request | Allow | user | System | |
|
|
|
27 |
When I am on the "My courses" page logged in as "user"
|
|
|
28 |
Then I should see "Request your first course"
|
|
|
29 |
And "Moodle documentation" "link" should exist
|
|
|
30 |
And "Quickstart guide" "link" should exist
|
|
|
31 |
And "Request a course" "button" should exist
|
|
|
32 |
And I click on "Request a course" "button"
|
|
|
33 |
And I should see "Details of the course"
|
|
|
34 |
|
|
|
35 |
Scenario: Users with permissions to create a course when there is no course created
|
|
|
36 |
Given I am on the "My courses" page logged in as "manager"
|
|
|
37 |
When I should see "Create your first course"
|
|
|
38 |
Then "Moodle documentation" "link" should exist
|
|
|
39 |
And "View Quickstart guide" "button" should exist
|
|
|
40 |
And "Create course" "button" should exist
|
|
|
41 |
And I click on "Create course" "button"
|
|
|
42 |
And I should see "Add a new course"
|
|
|
43 |
|
|
|
44 |
Scenario: Users with permissions to create a course but is not enrolled in any existing course
|
|
|
45 |
Given the following "course" exists:
|
|
|
46 |
| fullname | Course 1 |
|
|
|
47 |
| shortname | C1 |
|
|
|
48 |
When I am on the "My courses" page logged in as "manager"
|
|
|
49 |
Then I should see "You're not enrolled in any course"
|
|
|
50 |
Then I should see "Once you're enrolled in a course, it will appear here."
|
|
|
51 |
And "Manage courses" "button" should exist
|
|
|
52 |
And "Create course" "button" should exist
|
|
|
53 |
And I click on "Create course" "button"
|
|
|
54 |
And I should see "Add a new course"
|
|
|
55 |
And I am on the "My courses" page
|
|
|
56 |
And I click on "Manage courses" "button"
|
|
|
57 |
And I should see "Course 1"
|
|
|
58 |
|
|
|
59 |
Scenario: Users with permissions to create but not to manage courses and is not enrolled in any existing course
|
|
|
60 |
Given the following "permission overrides" exist:
|
|
|
61 |
| capability | permission | role | contextlevel | reference |
|
|
|
62 |
| moodle/category:manage | Prohibit | manager | System | |
|
|
|
63 |
And the following "course" exists:
|
|
|
64 |
| fullname | Course 1 |
|
|
|
65 |
| shortname | C1 |
|
|
|
66 |
When I am on the "My courses" page logged in as "manager"
|
|
|
67 |
Then I should see "You're not enrolled in any course"
|
|
|
68 |
Then I should not see "To view all courses on this sie, go to Manage courses"
|
|
|
69 |
And "Manage courses" "button" should not exist
|
|
|
70 |
And "Create course" "button" should exist
|
|
|
71 |
And I click on "Create course" "button"
|
|
|
72 |
And I should see "Add a new course"
|
|
|
73 |
|
|
|
74 |
@accessibility
|
|
|
75 |
Scenario: Evaluate the accessibility of the My courses (zero state)
|
|
|
76 |
When I am on the "My courses" page logged in as "manager"
|
|
|
77 |
Then the page should meet accessibility standards
|