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