1 |
efrain |
1 |
@core_message @message_popup @javascript
|
|
|
2 |
Feature: Notification popover unread notifications
|
|
|
3 |
In order to be kept informed
|
|
|
4 |
As a user
|
|
|
5 |
I am notified about relevant events in Moodle
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| student1 | Student | 1 | student1@example.com |
|
|
|
11 |
| student2 | Student | 2 | student2@example.com |
|
|
|
12 |
# This should generate some notifications
|
|
|
13 |
And the following "notifications" exist:
|
|
|
14 |
| subject | userfrom | userto | timecreated | timeread |
|
|
|
15 |
| Test 01 | student2 | student1 | 1654587996 | null |
|
|
|
16 |
| Test 02 | student2 | student1 | 1654587997 | null |
|
|
|
17 |
|
|
|
18 |
Scenario: Notification popover shows correct unread count
|
|
|
19 |
Given I log in as "student1"
|
|
|
20 |
# Confirm the popover is saying 1 unread notifications.
|
|
|
21 |
And I should see "2" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
|
|
|
22 |
# Open the popover.
|
|
|
23 |
When I open the notification popover
|
|
|
24 |
# Confirm the notifications are visible.
|
|
|
25 |
Then I should see "Test 01" in the "#nav-notification-popover-container" "css_element"
|
|
|
26 |
And I should see "Test 02" in the "#nav-notification-popover-container" "css_element"
|
|
|
27 |
|
|
|
28 |
@_bug_phantomjs
|
|
|
29 |
Scenario: Clicking a notification marks it as read
|
|
|
30 |
Given I log in as "student1"
|
|
|
31 |
# Open the notifications.
|
|
|
32 |
When I open the notification popover
|
|
|
33 |
And I follow "Test 01"
|
|
|
34 |
And I open the notification popover
|
|
|
35 |
And I follow "Test 02"
|
|
|
36 |
|
|
|
37 |
# Confirm the count element is hidden (i.e. there are no unread notifications).
|
|
|
38 |
Then "[data-region='count-container']" "css_element" in the "#nav-notification-popover-container" "css_element" should not be visible
|
|
|
39 |
|
|
|
40 |
Scenario: Mark all notifications as read
|
|
|
41 |
Given I log in as "student1"
|
|
|
42 |
When I open the notification popover
|
|
|
43 |
And I click on "Mark all as read" "link" in the "#nav-notification-popover-container" "css_element"
|
|
|
44 |
# Refresh the page to make sure we send a new request for the unread count.
|
|
|
45 |
And I reload the page
|
|
|
46 |
# Confirm the count element is hidden (i.e. there are no unread notifications).
|
|
|
47 |
Then "[data-region='count-container']" "css_element" in the "#nav-notification-popover-container" "css_element" should not be visible
|