@@ -25,10 +25,6 @@ test.describe("Room list filters and sort", () => {
25
25
return page . getByRole ( "listbox" , { name : "Room list filters" } ) ;
26
26
}
27
27
28
- function getSecondaryFilters ( page : Page ) : Locator {
29
- return page . getByRole ( "button" , { name : "Filter" } ) ;
30
- }
31
-
32
28
function getRoomOptionsMenu ( page : Page ) : Locator {
33
29
return page . getByRole ( "button" , { name : "Room Options" } ) ;
34
30
}
@@ -181,6 +177,33 @@ test.describe("Room list filters and sort", () => {
181
177
await app . client . evaluate ( async ( client , id ) => {
182
178
await client . setRoomTag ( id , "m.lowpriority" , { order : 0.5 } ) ;
183
179
} , lowPrioId ) ;
180
+
181
+ await bot . createRoom ( {
182
+ name : "invited room" ,
183
+ invite : [ user . userId ] ,
184
+ is_direct : true ,
185
+ } ) ;
186
+
187
+ const mentionRoomId = await app . client . createRoom ( { name : "room with mention" } ) ;
188
+ await app . client . inviteUser ( mentionRoomId , bot . credentials . userId ) ;
189
+ await bot . joinRoom ( mentionRoomId ) ;
190
+
191
+ const clientBot = await bot . prepareClient ( ) ;
192
+ await clientBot . evaluate (
193
+ async ( client , { mentionRoomId, userId } ) => {
194
+ await client . sendMessage ( mentionRoomId , {
195
+ // @ts -ignore ignore usage of MsgType.text
196
+ "msgtype" : "m.text" ,
197
+ "body" : "User" ,
198
+ "format" : "org.matrix.custom.html" ,
199
+ "formatted_body" : `<a href="https://matrix.to/#/${ userId } ">User</a>` ,
200
+ "m.mentions" : {
201
+ user_ids : [ userId ] ,
202
+ } ,
203
+ } ) ;
204
+ } ,
205
+ { mentionRoomId, userId : user . userId } ,
206
+ ) ;
184
207
} ) ;
185
208
186
209
test ( "should filter the list (with primary filters)" , { tag : "@screenshot" } , async ( { page, app, user } ) => {
@@ -197,7 +220,7 @@ test.describe("Room list filters and sort", () => {
197
220
// only one room should be visible
198
221
await expect ( roomList . getByRole ( "gridcell" , { name : "unread dm" } ) ) . toBeVisible ( ) ;
199
222
await expect ( roomList . getByRole ( "gridcell" , { name : "unread room" } ) ) . toBeVisible ( ) ;
200
- expect ( await roomList . locator ( "role=gridcell" ) . count ( ) ) . toBe ( 2 ) ;
223
+ expect ( await roomList . locator ( "role=gridcell" ) . count ( ) ) . toBe ( 4 ) ;
201
224
await expect ( primaryFilters ) . toMatchScreenshot ( "unread-primary-filters.png" ) ;
202
225
203
226
await primaryFilters . getByRole ( "option" , { name : "Favourite" } ) . click ( ) ;
@@ -206,24 +229,23 @@ test.describe("Room list filters and sort", () => {
206
229
207
230
await primaryFilters . getByRole ( "option" , { name : "People" } ) . click ( ) ;
208
231
await expect ( roomList . getByRole ( "gridcell" , { name : "unread dm" } ) ) . toBeVisible ( ) ;
209
- expect ( await roomList . locator ( "role=gridcell" ) . count ( ) ) . toBe ( 1 ) ;
232
+ await expect ( roomList . getByRole ( "gridcell" , { name : "invited room" } ) ) . toBeVisible ( ) ;
233
+ expect ( await roomList . locator ( "role=gridcell" ) . count ( ) ) . toBe ( 2 ) ;
210
234
211
235
await primaryFilters . getByRole ( "option" , { name : "Rooms" } ) . click ( ) ;
212
236
await expect ( roomList . getByRole ( "gridcell" , { name : "unread room" } ) ) . toBeVisible ( ) ;
213
237
await expect ( roomList . getByRole ( "gridcell" , { name : "favourite room" } ) ) . toBeVisible ( ) ;
214
238
await expect ( roomList . getByRole ( "gridcell" , { name : "empty room" } ) ) . toBeVisible ( ) ;
215
- expect ( await roomList . locator ( "role=gridcell" ) . count ( ) ) . toBe ( 4 ) ;
216
- } ) ;
217
-
218
- test ( "should filter the list (with secondary filters)" , { tag : "@screenshot" } , async ( { page, app, user } ) => {
219
- const roomList = getRoomList ( page ) ;
220
- const secondaryFilters = getSecondaryFilters ( page ) ;
221
- await secondaryFilters . click ( ) ;
239
+ await expect ( roomList . getByRole ( "gridcell" , { name : "room with mention" } ) ) . toBeVisible ( ) ;
240
+ await expect ( roomList . getByRole ( "gridcell" , { name : "Low prio room" } ) ) . toBeVisible ( ) ;
241
+ expect ( await roomList . locator ( "role=gridcell" ) . count ( ) ) . toBe ( 5 ) ;
222
242
223
- await expect ( page . getByRole ( "menu" , { name : "Filter" } ) ) . toMatchScreenshot ( "filter-menu.png" ) ;
243
+ await primaryFilters . getByRole ( "option" , { name : "Mentions" } ) . click ( ) ;
244
+ await expect ( roomList . getByRole ( "gridcell" , { name : "room with mention" } ) ) . toBeVisible ( ) ;
245
+ expect ( await roomList . locator ( "role=gridcell" ) . count ( ) ) . toBe ( 1 ) ;
224
246
225
- await page . getByRole ( "menuitem " , { name : "Low priority " } ) . click ( ) ;
226
- await expect ( roomList . getByRole ( "gridcell" , { name : "Low prio room" } ) ) . toBeVisible ( ) ;
247
+ await primaryFilters . getByRole ( "option " , { name : "Invites " } ) . click ( ) ;
248
+ await expect ( roomList . getByRole ( "gridcell" , { name : "invited room" } ) ) . toBeVisible ( ) ;
227
249
expect ( await roomList . locator ( "role=gridcell" ) . count ( ) ) . toBe ( 1 ) ;
228
250
} ) ;
229
251
0 commit comments