22 * Accessibility audit for Cmdr views and dialogs using axe-core.
33 *
44 * Injects axe-core into the real Tauri webview via tauriPage.evaluate(),
5- * runs a WCAG audit on each view/dialog, and fails on critical violations .
5+ * runs a WCAG audit on each view/dialog, and fails on any violation .
66 *
77 * Dialog tests scope the audit to the dialog element itself, avoiding noise
88 * from the page behind the overlay.
@@ -139,9 +139,8 @@ test('main explorer view', async ({ tauriPage }) => {
139139 test . setTimeout ( 120_000 )
140140 await ensureAppReady ( tauriPage )
141141
142- const { critical, serious } = await runAxeAudit ( tauriPage , 'Main explorer' )
143- expect ( critical , `Found ${ critical . length } critical violation(s) in main explorer` ) . toHaveLength ( 0 )
144- expect ( serious , `Found ${ serious . length } serious violation(s) in main explorer` ) . toHaveLength ( 0 )
142+ const { all } = await runAxeAudit ( tauriPage , 'Main explorer' )
143+ expect ( all , `Found ${ all . length } violation(s) in main explorer` ) . toHaveLength ( 0 )
145144} )
146145
147146test ( 'Copy dialog' , async ( { tauriPage } ) => {
@@ -152,10 +151,9 @@ test('Copy dialog', async ({ tauriPage }) => {
152151 await tauriPage . keyboard . press ( 'F5' )
153152 await tauriPage . waitForSelector ( TRANSFER_DIALOG , 5000 )
154153
155- const { critical , serious } = await runAxeAudit ( tauriPage , 'Copy dialog' , TRANSFER_DIALOG )
154+ const { all } = await runAxeAudit ( tauriPage , 'Copy dialog' , TRANSFER_DIALOG )
156155 await dismissDialog ( tauriPage )
157- expect ( critical , `Found ${ critical . length } critical violation(s) in Copy dialog` ) . toHaveLength ( 0 )
158- expect ( serious , `Found ${ serious . length } serious violation(s) in Copy dialog` ) . toHaveLength ( 0 )
156+ expect ( all , `Found ${ all . length } violation(s) in Copy dialog` ) . toHaveLength ( 0 )
159157} )
160158
161159test ( 'Delete dialog' , async ( { tauriPage } ) => {
@@ -167,10 +165,9 @@ test('Delete dialog', async ({ tauriPage }) => {
167165 const deleteDialog = '[data-dialog-id="delete-confirmation"]'
168166 await tauriPage . waitForSelector ( deleteDialog , 5000 )
169167
170- const { critical , serious } = await runAxeAudit ( tauriPage , 'Delete dialog' , deleteDialog )
168+ const { all } = await runAxeAudit ( tauriPage , 'Delete dialog' , deleteDialog )
171169 await dismissDialog ( tauriPage )
172- expect ( critical , `Found ${ critical . length } critical violation(s) in Delete dialog` ) . toHaveLength ( 0 )
173- expect ( serious , `Found ${ serious . length } serious violation(s) in Delete dialog` ) . toHaveLength ( 0 )
170+ expect ( all , `Found ${ all . length } violation(s) in Delete dialog` ) . toHaveLength ( 0 )
174171} )
175172
176173test ( 'Move dialog' , async ( { tauriPage } ) => {
@@ -181,10 +178,9 @@ test('Move dialog', async ({ tauriPage }) => {
181178 await tauriPage . keyboard . press ( 'F6' )
182179 await tauriPage . waitForSelector ( TRANSFER_DIALOG , 5000 )
183180
184- const { critical , serious } = await runAxeAudit ( tauriPage , 'Move dialog' , TRANSFER_DIALOG )
181+ const { all } = await runAxeAudit ( tauriPage , 'Move dialog' , TRANSFER_DIALOG )
185182 await dismissDialog ( tauriPage )
186- expect ( critical , `Found ${ critical . length } critical violation(s) in Move dialog` ) . toHaveLength ( 0 )
187- expect ( serious , `Found ${ serious . length } serious violation(s) in Move dialog` ) . toHaveLength ( 0 )
183+ expect ( all , `Found ${ all . length } violation(s) in Move dialog` ) . toHaveLength ( 0 )
188184} )
189185
190186test ( 'About dialog' , async ( { tauriPage } ) => {
@@ -194,10 +190,9 @@ test('About dialog', async ({ tauriPage }) => {
194190 await executeViaCommandPalette ( tauriPage , 'About Cmdr' )
195191 await tauriPage . waitForSelector ( '[data-dialog-id="about"]' , 5000 )
196192
197- const { critical , serious } = await runAxeAudit ( tauriPage , 'About dialog' , '[data-dialog-id="about"]' )
193+ const { all } = await runAxeAudit ( tauriPage , 'About dialog' , '[data-dialog-id="about"]' )
198194 await dismissDialog ( tauriPage )
199- expect ( critical , `Found ${ critical . length } critical violation(s) in About dialog` ) . toHaveLength ( 0 )
200- expect ( serious , `Found ${ serious . length } serious violation(s) in About dialog` ) . toHaveLength ( 0 )
195+ expect ( all , `Found ${ all . length } violation(s) in About dialog` ) . toHaveLength ( 0 )
201196} )
202197
203198test ( 'License dialog' , async ( { tauriPage } ) => {
@@ -207,10 +202,9 @@ test('License dialog', async ({ tauriPage }) => {
207202 await executeViaCommandPalette ( tauriPage , 'license' )
208203 await tauriPage . waitForSelector ( '[data-dialog-id="license"]' , 5000 )
209204
210- const { critical , serious } = await runAxeAudit ( tauriPage , 'License dialog' , '[data-dialog-id="license"]' )
205+ const { all } = await runAxeAudit ( tauriPage , 'License dialog' , '[data-dialog-id="license"]' )
211206 await dismissDialog ( tauriPage )
212- expect ( critical , `Found ${ critical . length } critical violation(s) in License dialog` ) . toHaveLength ( 0 )
213- expect ( serious , `Found ${ serious . length } serious violation(s) in License dialog` ) . toHaveLength ( 0 )
207+ expect ( all , `Found ${ all . length } violation(s) in License dialog` ) . toHaveLength ( 0 )
214208} )
215209
216210test ( 'Command palette' , async ( { tauriPage } ) => {
@@ -219,14 +213,13 @@ test('Command palette', async ({ tauriPage }) => {
219213
220214 await openCommandPalette ( tauriPage )
221215
222- const { critical , serious } = await runAxeAudit ( tauriPage , 'Command palette' , '.palette-overlay' )
216+ const { all } = await runAxeAudit ( tauriPage , 'Command palette' , '.palette-overlay' )
223217
224218 // Dismiss the palette
225219 await tauriPage . keyboard . press ( 'Escape' )
226220 await pollUntil ( tauriPage , async ( ) => ! ( await tauriPage . isVisible ( '.palette-overlay' ) ) , 3000 )
227221
228- expect ( critical , `Found ${ critical . length } critical violation(s) in command palette` ) . toHaveLength ( 0 )
229- expect ( serious , `Found ${ serious . length } serious violation(s) in command palette` ) . toHaveLength ( 0 )
222+ expect ( all , `Found ${ all . length } violation(s) in command palette` ) . toHaveLength ( 0 )
230223} )
231224
232225test ( 'Search dialog' , async ( { tauriPage } ) => {
@@ -235,14 +228,13 @@ test('Search dialog', async ({ tauriPage }) => {
235228
236229 await openSearchDialog ( tauriPage )
237230
238- const { critical , serious } = await runAxeAudit ( tauriPage , 'Search dialog' , '.search-overlay' )
231+ const { all } = await runAxeAudit ( tauriPage , 'Search dialog' , '.search-overlay' )
239232
240233 // Dismiss the search dialog
241234 await tauriPage . keyboard . press ( 'Escape' )
242235 await pollUntil ( tauriPage , async ( ) => ! ( await tauriPage . isVisible ( '.search-overlay' ) ) , 3000 )
243236
244- expect ( critical , `Found ${ critical . length } critical violation(s) in search dialog` ) . toHaveLength ( 0 )
245- expect ( serious , `Found ${ serious . length } serious violation(s) in search dialog` ) . toHaveLength ( 0 )
237+ expect ( all , `Found ${ all . length } violation(s) in search dialog` ) . toHaveLength ( 0 )
246238} )
247239
248240test ( 'Settings: all sections' , async ( { tauriPage } ) => {
@@ -276,8 +268,7 @@ test('Settings: all sections', async ({ tauriPage }) => {
276268 { name : 'Advanced' , path : [ 'Advanced' ] , sectionId : 'advanced' } ,
277269 ]
278270
279- const allCritical : { section : string ; violations : AxeViolation [ ] } [ ] = [ ]
280- const allSerious : { section : string ; violations : AxeViolation [ ] } [ ] = [ ]
271+ const allViolations : { section : string ; violations : AxeViolation [ ] } [ ] = [ ]
281272
282273 for ( const section of sections ) {
283274 // Click sidebar to navigate to the section
@@ -301,22 +292,15 @@ test('Settings: all sections', async ({ tauriPage }) => {
301292 continue
302293 }
303294
304- const { critical, serious } = await runAxeAudit ( tauriPage , `Settings: ${ section . name } ` )
305- if ( critical . length > 0 ) {
306- allCritical . push ( { section : section . name , violations : critical } )
307- }
308- if ( serious . length > 0 ) {
309- allSerious . push ( { section : section . name , violations : serious } )
295+ const { all } = await runAxeAudit ( tauriPage , `Settings: ${ section . name } ` )
296+ if ( all . length > 0 ) {
297+ allViolations . push ( { section : section . name , violations : all } )
310298 }
311299 }
312300
313- const totalCritical = allCritical . reduce ( ( sum , s ) => sum + s . violations . length , 0 )
314- const failedSections = allCritical . map ( ( s ) => `${ s . section } (${ s . violations . length } )` ) . join ( ', ' )
315- expect ( totalCritical , `Critical violations in settings: ${ failedSections } ` ) . toBe ( 0 )
316-
317- const totalSerious = allSerious . reduce ( ( sum , s ) => sum + s . violations . length , 0 )
318- const failedSeriousSections = allSerious . map ( ( s ) => `${ s . section } (${ s . violations . length } )` ) . join ( ', ' )
319- expect ( totalSerious , `Serious violations in settings: ${ failedSeriousSections } ` ) . toBe ( 0 )
301+ const totalViolations = allViolations . reduce ( ( sum , s ) => sum + s . violations . length , 0 )
302+ const failedSections = allViolations . map ( ( s ) => `${ s . section } (${ s . violations . length } )` ) . join ( ', ' )
303+ expect ( totalViolations , `Violations in settings: ${ failedSections } ` ) . toBe ( 0 )
320304} )
321305
322306test ( 'File viewer with text file' , async ( { tauriPage } ) => {
@@ -329,7 +313,6 @@ test('File viewer with text file', async ({ tauriPage }) => {
329313 await tauriPage . waitForSelector ( '.viewer-container' , 15000 )
330314 await tauriPage . waitForSelector ( '.file-content' , 10000 )
331315
332- const { critical, serious } = await runAxeAudit ( tauriPage , 'File viewer' )
333- expect ( critical , `Found ${ critical . length } critical violation(s) in file viewer` ) . toHaveLength ( 0 )
334- expect ( serious , `Found ${ serious . length } serious violation(s) in file viewer` ) . toHaveLength ( 0 )
316+ const { all } = await runAxeAudit ( tauriPage , 'File viewer' )
317+ expect ( all , `Found ${ all . length } violation(s) in file viewer` ) . toHaveLength ( 0 )
335318} )
0 commit comments