|
| 1 | +@core @core_message @javascript |
| 2 | +Feature: Unread messages |
| 3 | + In order to know how many unread messages I have |
| 4 | + As a user |
| 5 | + I need to be able to view an unread message |
| 6 | + |
| 7 | + Background: |
| 8 | + Given the following "courses" exist: |
| 9 | + | fullname | shortname | category | groupmode | |
| 10 | + | Course 1 | C1 | 0 | 1 | |
| 11 | + And the following "users" exist: |
| 12 | + | username | firstname | lastname | email | |
| 13 | + | student1 | Student | 1 | student1@example.com | |
| 14 | + | student2 | Student | 2 | student2@example.com | |
| 15 | + And the following "course enrolments" exist: |
| 16 | + | user | course | role | |
| 17 | + | student1 | C1 | student | |
| 18 | + | student2 | C1 | student | |
| 19 | + And the following "groups" exist: |
| 20 | + | name | course | idnumber | enablemessaging | |
| 21 | + | New group | C1 | NG | 1 | |
| 22 | + And the following "group members" exist: |
| 23 | + | user | group | |
| 24 | + | student1 | NG | |
| 25 | + | student2 | NG | |
| 26 | + And the following config values are set as admin: |
| 27 | + | messaging | 1 | |
| 28 | + |
| 29 | + Scenario: Unread messages for group conversation |
| 30 | + Given I log in as "student1" |
| 31 | + When I open messaging |
| 32 | + Then "New group" "group_message" should exist |
| 33 | + And I select "New group" conversation in messaging |
| 34 | + And I send "Hi!" message in the message area |
| 35 | + And I should see "Hi!" in the "New group" "group_message_conversation" |
| 36 | + And I should see "##today##j F##" in the "New group" "group_message_conversation" |
| 37 | + And I log out |
| 38 | + And I log in as "student2" |
| 39 | + And I should see "1" in the "//*[@title='Toggle messaging drawer']/../*[@data-region='count-container']" "xpath_element" |
| 40 | + And I open messaging |
| 41 | + And I should see "1" in the "Group" "group_message_tab" |
| 42 | + And "New group" "group_message" should exist |
| 43 | + And I should see "1" in the "New group" "group_message" |
| 44 | + And I select "New group" conversation in messaging |
| 45 | + And I should see "Hi!" in the "New group" "group_message_conversation" |
| 46 | + And I should not see "1" in the "//*[@title='Toggle messaging drawer']/../*[@data-region='count-container']" "xpath_element" |
| 47 | + And I should not see "1" in the "Group" "group_message_tab" |
| 48 | + And I should not see "1" in the "New group" "group_message" |
| 49 | + |
| 50 | + Scenario: Unread messages for private conversation |
| 51 | + Given the following "private messages" exist: |
| 52 | + | user | contact | message | |
| 53 | + | student1 | student2 | Hi! | |
| 54 | + | student2 | student1 | What do you need? | |
| 55 | + When I log in as "student1" |
| 56 | + Then I should see "1" in the "//*[@title='Toggle messaging drawer']/../*[@data-region='count-container']" "xpath_element" |
| 57 | + And I open messaging |
| 58 | + And I should see "1" in the "Private" "group_message_tab" |
| 59 | + And "Student 2" "group_message" should exist |
| 60 | + And I should see "1" in the "Student 2" "group_message" |
| 61 | + And I select "Student 2" conversation in messaging |
| 62 | + And I should see "Hi!" in the "Student 2" "group_message_conversation" |
| 63 | + And I should not see "1" in the "//*[@title='Toggle messaging drawer']/../*[@data-region='count-container']" "xpath_element" |
| 64 | + And I should not see "1" in the "Private" "group_message_tab" |
| 65 | + And I should not see "1" in the "Student 2" "group_message" |
| 66 | + |
| 67 | + Scenario: Unread messages for starred conversation |
| 68 | + Given the following "private messages" exist: |
| 69 | + | user | contact | message | |
| 70 | + | student1 | student2 | Hi! | |
| 71 | + | student2 | student1 | What do you need? | |
| 72 | + And the following "favourite conversations" exist: |
| 73 | + | user | contact | |
| 74 | + | student1 | student2 | |
| 75 | + When I log in as "student1" |
| 76 | + Then I should see "1" in the "//*[@title='Toggle messaging drawer']/../*[@data-region='count-container']" "xpath_element" |
| 77 | + And I open messaging |
| 78 | + And I should see "1" in the "Starred" "group_message_tab" |
| 79 | + And "Student 2" "group_message" should exist |
| 80 | + And I should see "1" in the "Student 2" "group_message" |
| 81 | + And I select "Student 2" conversation in messaging |
| 82 | + And I should see "Hi!" in the "Student 2" "group_message_conversation" |
| 83 | + And I should not see "1" in the "//*[@title='Toggle messaging drawer']/../*[@data-region='count-container']" "xpath_element" |
| 84 | + And I should not see "1" in the "Starred" "group_message_tab" |
| 85 | + And I should not see "1" in the "Student 2" "group_message" |
0 commit comments