@@ -182,6 +182,52 @@ test.describe("Room list", () => {
182
182
await expect ( page . getByRole ( "heading" , { name : "1 notification" , level : 1 } ) ) . toBeVisible ( ) ;
183
183
} ) ;
184
184
} ) ;
185
+
186
+ test . describe . only ( "Keyboard navigation" , ( ) => {
187
+ test ( "should navigate to the room list" , async ( { page, app, user } ) => {
188
+ const roomListView = getRoomList ( page ) ;
189
+
190
+ const room29 = roomListView . getByRole ( "gridcell" , { name : "Open room room29" } ) ;
191
+ const room28 = roomListView . getByRole ( "gridcell" , { name : "Open room room28" } ) ;
192
+
193
+ await room29 . click ( ) ;
194
+ await expect ( room29 ) . toBeFocused ( ) ;
195
+
196
+ await page . keyboard . press ( "ArrowDown" ) ;
197
+ await expect ( room28 ) . toBeFocused ( ) ;
198
+ await expect ( room29 ) . not . toBeFocused ( ) ;
199
+
200
+ await page . keyboard . press ( "ArrowUp" ) ;
201
+ await expect ( room29 ) . toBeFocused ( ) ;
202
+ await expect ( room28 ) . not . toBeFocused ( ) ;
203
+ } ) ;
204
+
205
+ test ( "should navigate to the notification menu" , async ( { page, app, user } ) => {
206
+ const roomListView = getRoomList ( page ) ;
207
+ const room29 = roomListView . getByRole ( "gridcell" , { name : "Open room room29" } ) ;
208
+ const moreButton = room29 . getByRole ( "button" , { name : "More options" } ) ;
209
+ const notificationButton = room29 . getByRole ( "button" , { name : "Notification options" } ) ;
210
+
211
+ await room29 . click ( ) ;
212
+ await page . keyboard . press ( "Tab" ) ;
213
+ await expect ( moreButton ) . toBeFocused ( ) ;
214
+ await page . keyboard . press ( "Tab" ) ;
215
+ await expect ( notificationButton ) . toBeFocused ( ) ;
216
+
217
+ // Open the menu
218
+ await notificationButton . click ( ) ;
219
+ // Wait for the menu to be open
220
+ await expect ( page . getByRole ( "menuitem" , { name : "Match default settings" } ) ) . toHaveAttribute (
221
+ "aria-selected" ,
222
+ "true" ,
223
+ ) ;
224
+
225
+ // Close the menu
226
+ await page . keyboard . press ( "Escape" ) ;
227
+ // Focus should be back on the room list item
228
+ await expect ( room29 ) . toBeFocused ( ) ;
229
+ } ) ;
230
+ } ) ;
185
231
} ) ;
186
232
187
233
test . describe ( "Avatar decoration" , ( ) => {
0 commit comments