Skip to content

Commit 4602758

Browse files
committed
test: run axe on the router tree grid and paused navigations
Seed a router page with a nested config and two navigations, so the axe run reaches the Config tree grid, collapsed and expanded, and the Navigations view while paused, at full width and at 360px.
1 parent 62e4d49 commit 4602758

1 file changed

Lines changed: 84 additions & 0 deletions

File tree

‎scripts/panel-axe.mjs‎

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,65 @@ const errorGroup = (id, extra = {}) => ({
196196
owner: { id: 'c1-7', name: 'TripCard' },
197197
...extra,
198198
});
199+
// The Routes tab with a nested live config and a few navigations, for the tree grid
200+
// and the Pause control of the Navigations view.
201+
const routeNode = (id, path, extra = {}) => ({
202+
id,
203+
path,
204+
fullPath: path,
205+
kind: 'component',
206+
...extra,
207+
});
208+
const ROUTER_SEED = {
209+
pages: [
210+
{
211+
pageId: 'p1',
212+
reportedAt: now,
213+
generation: 1,
214+
activeIds: ['trips', 'trip'],
215+
snapshot: {
216+
url: '/trips/42',
217+
queryParams: {},
218+
fragment: null,
219+
root: { path: '', url: '', outlet: 'primary', params: {}, data: {}, children: [] },
220+
},
221+
config: [
222+
routeNode('trips', 'trips', {
223+
component: 'TripList',
224+
title: 'Trips',
225+
children: [
226+
routeNode('trip', 'trips/:id', {
227+
component: 'TripDetail',
228+
guards: { canActivate: ['authGuard'] },
229+
children: [routeNode('edit', 'trips/:id/edit', { component: 'TripEdit' })],
230+
}),
231+
],
232+
}),
233+
routeNode('about', 'about', { component: 'About' }),
234+
{ id: 'home', path: '', fullPath: '', kind: 'redirect', redirectTo: 'trips' },
235+
],
236+
navigations: [
237+
{
238+
id: 1,
239+
url: '/trips',
240+
trigger: 'imperative',
241+
startedAt: now - 9_000,
242+
endedAt: now - 8_960,
243+
outcome: 'succeeded',
244+
},
245+
{
246+
id: 2,
247+
url: '/trips/42',
248+
trigger: 'imperative',
249+
startedAt: now - 4_000,
250+
endedAt: now - 3_950,
251+
outcome: 'succeeded',
252+
},
253+
],
254+
},
255+
],
256+
};
257+
199258
const ERRORS_SEED = {
200259
pages: {
201260
tab1: {
@@ -526,6 +585,7 @@ const SEEDS = {
526585
'pangular:plugins': PLUGINS_SEED,
527586
'pangular:tanstack-query': QUERIES_SEED,
528587
'pangular:forms': FORMS_SEED,
588+
'pangular:router': ROUTER_SEED,
529589
};
530590

531591
/**
@@ -1153,6 +1213,30 @@ try {
11531213
} catch (error) {
11541214
failures.push(`${colorScheme} Capacitor: the seeded app did not show (${error.message})`);
11551215
}
1216+
const routes = await seeded.newPage();
1217+
routes.on('pageerror', (error) =>
1218+
failures.push(`${colorScheme} Routes: page error ${error.message}`),
1219+
);
1220+
await routes.goto(`${base}#tab=routes`);
1221+
await routes.locator('.status.connected').waitFor();
1222+
try {
1223+
await routes.locator('#router-tab-routes').click({ timeout: 15_000 });
1224+
const rows = routes.locator('table[role="treegrid"] tr.tree-row');
1225+
await rows.first().waitFor();
1226+
await check(routes, `${colorScheme} Routes config tree grid`);
1227+
await noOverflow(routes, `${colorScheme} Routes config tree grid`);
1228+
await rows.first().focus();
1229+
await routes.keyboard.press('ArrowLeft');
1230+
await routes.locator('table[role="treegrid"] tr.tree-row[aria-expanded="false"]').waitFor();
1231+
await check(routes, `${colorScheme} Routes config tree grid collapsed`);
1232+
await routes.locator('#router-tab-navigations').click();
1233+
await routes.locator('app-live-controls button').click();
1234+
await routes.locator('app-live-controls .pending').waitFor();
1235+
await check(routes, `${colorScheme} Routes navigations paused`);
1236+
await noOverflow(routes, `${colorScheme} Routes navigations paused`);
1237+
} catch (error) {
1238+
failures.push(`${colorScheme} Routes: the seeded config did not show (${error.message})`);
1239+
}
11561240
const errors = await seeded.newPage();
11571241
errors.on('pageerror', (error) =>
11581242
failures.push(`${colorScheme} Errors: page error ${error.message}`),

0 commit comments

Comments
 (0)