Skip to content

Commit 210c8b5

Browse files
committed
✅(e2e) update tests for list semantics and add keyboard nav test
Adapt selectors from grid/row to list/listitem and add a Tab+Enter test
1 parent f7bea69 commit 210c8b5

4 files changed

Lines changed: 29 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ and this project adheres to
1919
- ♿️(frontend) improve language picker accessibility #2069
2020
- ♿️(frontend) add aria-hidden to decorative icons in dropdown menu #2093
2121
- 🐛(backend) move lock table closer to the insert operation targeted
22+
- ♿️(frontend) replace ARIA grid pattern with list in docs grid #2131
2223

2324
### Fixed
2425

src/frontend/apps/e2e/__tests__/app-impress/doc-grid-move.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ test.describe('Doc grid dnd mobile', () => {
400400
await expect(page.getByTestId('docs-grid')).toBeVisible();
401401
await expect(page.getByTestId('grid-loader')).toBeHidden();
402402

403-
await expect(docsGrid.getByRole('row').first()).toBeVisible();
403+
await expect(docsGrid.getByRole('listitem').first()).toBeVisible();
404404
await expect(docsGrid.locator('.--docs--grid-droppable')).toHaveCount(0);
405405

406406
await createDoc(page, 'Draggable doc mobile', browserName, 1, true);

src/frontend/apps/e2e/__tests__/app-impress/doc-grid.spec.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ test.describe('Documents Grid mobile', () => {
7676
await expect(docsGrid).toBeVisible();
7777
await expect(page.getByTestId('grid-loader')).toBeHidden();
7878

79-
const rows = docsGrid.getByRole('row');
79+
const rows = docsGrid.getByRole('listitem');
8080
const row = rows.filter({
8181
hasText: 'My mocked document',
8282
});
@@ -289,6 +289,29 @@ test.describe('Documents Grid', () => {
289289
);
290290
});
291291

292+
test('opens a document with keyboard (Tab + Enter)', async ({
293+
page,
294+
browserName,
295+
}) => {
296+
await page.goto('/');
297+
298+
const [docTitle] = await createDoc(page, 'keyboard-nav-test', browserName);
299+
300+
await page.goto('/');
301+
await expect(page.getByTestId('grid-loader')).toBeHidden();
302+
303+
const row = await getGridRow(page, docTitle);
304+
const link = row.getByRole('link').first();
305+
306+
await link.focus();
307+
await expect(link).toBeFocused();
308+
309+
await page.keyboard.press('Enter');
310+
311+
await expect(page).toHaveURL(/\/docs\//);
312+
await verifyDocName(page, docTitle);
313+
});
314+
292315
test('checks the infinite scroll', async ({ page }) => {
293316
let docs: SmallDoc[];
294317
const responsePromisePage1 = page.waitForResponse((response) => {

src/frontend/apps/e2e/__tests__/app-impress/utils-common.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,11 @@ export const verifyDocName = async (page: Page, docName: string) => {
183183
};
184184

185185
export const getGridRow = async (page: Page, title: string) => {
186-
const docsGrid = page.getByRole('grid');
186+
const docsGrid = page.getByTestId('docs-grid');
187187
await expect(docsGrid).toBeVisible();
188188
await expect(page.getByTestId('grid-loader')).toBeHidden();
189189

190-
const rows = docsGrid.getByRole('row');
190+
const rows = docsGrid.getByRole('listitem');
191191

192192
const row = rows
193193
.filter({
@@ -215,7 +215,7 @@ export const goToGridDoc = async (
215215
await expect(docsGrid).toBeVisible();
216216
await expect(page.getByTestId('grid-loader')).toBeHidden();
217217

218-
const rows = docsGrid.getByRole('row');
218+
const rows = docsGrid.getByRole('listitem');
219219

220220
const row = title
221221
? rows.filter({

0 commit comments

Comments
 (0)