Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
"yjs": "^13.6.33"
},
"devDependencies": {
"@axe-core/playwright": "^4.14.0",
"@nextcloud/babel-config": "^2.0.0",
"@nextcloud/browserslist-config": "^3.1.2",
"@nextcloud/e2e-test-server": "^0.6.1",
Expand Down
199 changes: 199 additions & 0 deletions playwright/e2e/accessibility.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import { mergeTests } from '@playwright/test'
import { test as accessibilityTest, expect } from '../support/fixtures/accessibility'

Check failure on line 7 in playwright/e2e/accessibility.spec.ts

View workflow job for this annotation

GitHub Actions / NPM lint

The relative import should probably have the file extension ".ts"
import { test as editorTest } from '../support/fixtures/editor'

Check failure on line 8 in playwright/e2e/accessibility.spec.ts

View workflow job for this annotation

GitHub Actions / NPM lint

The relative import should probably have the file extension ".ts"
import { test as uploadFileTest } from '../support/fixtures/upload-file'

Check failure on line 9 in playwright/e2e/accessibility.spec.ts

View workflow job for this annotation

GitHub Actions / NPM lint

The relative import should probably have the file extension ".ts"
import {
formatViolations,
getAccessibilitySummary,
violationFingerprints,
} from '../support/utils/accessibility'

Check failure on line 14 in playwright/e2e/accessibility.spec.ts

View workflow job for this annotation

GitHub Actions / NPM lint

The relative import should probably have the file extension ".ts"

const test = mergeTests(accessibilityTest, editorTest, uploadFileTest)

test.describe('Editor Accessibility', () => {
test('should not have automatically detectable accessibility violations on the full page', async ({
page,
open,
makeAxeBuilder,
}, testInfo) => {
await open()

// Wait for the editor to be fully loaded
await page.waitForSelector('.text-editor', { state: 'visible' })

// Run the accessibility scan
const accessibilityScanResults = await makeAxeBuilder().analyze()

// Attach the full scan results for debugging
await testInfo.attach('accessibility-scan-results', {
body: JSON.stringify(accessibilityScanResults, null, 2),
contentType: 'application/json',
})

// Attach a summary for quick overview
const summary = getAccessibilitySummary(accessibilityScanResults)
await testInfo.attach('accessibility-summary', {
body: JSON.stringify(summary, null, 2),
contentType: 'application/json',
})

// Snapshot test for violations to track changes over time
expect(
violationFingerprints(accessibilityScanResults),
formatViolations(accessibilityScanResults),
).toMatchSnapshot('accessibility-violations.json')

Check failure on line 49 in playwright/e2e/accessibility.spec.ts

View workflow job for this annotation

GitHub Actions / playwright (1, 3)

[chromium] › playwright/e2e/accessibility.spec.ts:19:2 › Editor Accessibility › should not have automatically detectable accessibility violations on the full page

1) [chromium] › playwright/e2e/accessibility.spec.ts:19:2 › Editor Accessibility › should not have automatically detectable accessibility violations on the full page Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: Found 2 accessibility violation(s): Rule: color-contrast (serious) Description: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds Help: Elements must meet minimum color contrast ratio thresholds Help URL: https://dequeuniversity.com/rules/axe/4.14/color-contrast?application=playwright Affected elements: - .suggestions--button.button-vue--secondary[data-v-3df841b1=""]:nth-child(1) > .button-vue__wrapper[data-v-47ce59a3=""] > .button-vue__text[data-v-47ce59a3=""] - button[title=""] > .button-vue__wrapper[data-v-47ce59a3=""] > .button-vue__text[data-v-47ce59a3=""] - .suggestions--button.button-vue--secondary[data-v-3df841b1=""]:nth-child(3) > .button-vue__wrapper[data-v-47ce59a3=""] > .button-vue__text[data-v-47ce59a3=""] - .suggestions--button.button-vue--secondary[data-v-3df841b1=""]:nth-child(4) > .button-vue__wrapper[data-v-47ce59a3=""] > .button-vue__text[data-v-47ce59a3=""] --- Rule: role-img-alt (serious) Description: Ensure [role="img"] and [role="image"] elements have alternative text Help: [role="img"] and [role="image"] elements must have alternative text Help URL: https://dequeuniversity.com/rules/axe/4.14/role-img-alt?application=playwright Affected elements: - .material-design-icon[data-v-2ff3d40c=""][aria-label=""] expect(string).toMatchSnapshot(expected) failed @@ -1,12 +1,31 @@ [ { - "rule": "label", - "description": "Ensure every form element has a label", + "rule": "color-contrast", + "description": "Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds", "targets": [ [ - "input[data-cy-upload-picker-input=\"\"]" + ".suggestions--button.button-vue--secondary[data-v-3df841b1=\"\"]:nth-child(1) > .button-vue__wrapper[data-v-47ce59a3=\"\"] > .button-vue__text[data-v-47ce59a3=\"\"]" + ], + [ + "button[title=\"\"] > .button-vue__wrapper[data-v-47ce59a3=\"\"] > .button-vue__text[data-v-47ce59a3=\"\"]" + ], + [ + ".suggestions--button.button-vue--secondary[data-v-3df841b1=\"\"]:nth-child(3) > .button-vue__wrapper[data-v-47ce59a3=\"\"] > .button-vue__text[data-v-47ce59a3=\"\"]" + ], + [ + ".suggestions--button.button-vue--secondary[data-v-3df841b1=\"\"]:nth-child(4) > .button-vue__wrapper[data-v-47ce59a3=\"\"] > .button-vue__text[data-v-47ce59a3=\"\"]" ] ], - "impact": "critical" + "impact": "serious" + }, + { + "rule": "role-img-alt", + "description": "Ensure [role=\"img\"] and [role=\"image\"] elements have alternative text", + "targets": [ + [ + ".material-design-icon[data-v-2ff3d40c=\"\"][aria-label=\"\"]" + ] + ], + "impact": "serious" } ] Snapshot: accessibility-violations.json 47 | violationFingerprints(accessibilityScanResults), 48 | formatViolations(accessibilityScanResults), > 49 | ).toMatchSnapshot('accessibility-violations.json') | ^ 50 | }) 51 | 52 | test('should not have accessibility violations in the editor content area', async ({ at /home/runner/actions-runner/_work/text/text/playwright/e2e/accessibility.spec.ts:49:5

Check failure on line 49 in playwright/e2e/accessibility.spec.ts

View workflow job for this annotation

GitHub Actions / playwright (1, 3)

[chromium] › playwright/e2e/accessibility.spec.ts:19:2 › Editor Accessibility › should not have automatically detectable accessibility violations on the full page

1) [chromium] › playwright/e2e/accessibility.spec.ts:19:2 › Editor Accessibility › should not have automatically detectable accessibility violations on the full page Error: Found 2 accessibility violation(s): Rule: color-contrast (serious) Description: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds Help: Elements must meet minimum color contrast ratio thresholds Help URL: https://dequeuniversity.com/rules/axe/4.14/color-contrast?application=playwright Affected elements: - .suggestions--button.button-vue--secondary[data-v-3df841b1=""]:nth-child(1) > .button-vue__wrapper[data-v-47ce59a3=""] > .button-vue__text[data-v-47ce59a3=""] - button[title=""] > .button-vue__wrapper[data-v-47ce59a3=""] > .button-vue__text[data-v-47ce59a3=""] - .suggestions--button.button-vue--secondary[data-v-3df841b1=""]:nth-child(3) > .button-vue__wrapper[data-v-47ce59a3=""] > .button-vue__text[data-v-47ce59a3=""] - .suggestions--button.button-vue--secondary[data-v-3df841b1=""]:nth-child(4) > .button-vue__wrapper[data-v-47ce59a3=""] > .button-vue__text[data-v-47ce59a3=""] --- Rule: role-img-alt (serious) Description: Ensure [role="img"] and [role="image"] elements have alternative text Help: [role="img"] and [role="image"] elements must have alternative text Help URL: https://dequeuniversity.com/rules/axe/4.14/role-img-alt?application=playwright Affected elements: - .material-design-icon[data-v-2ff3d40c=""][aria-label=""] expect(string).toMatchSnapshot(expected) failed @@ -1,12 +1,31 @@ [ { - "rule": "label", - "description": "Ensure every form element has a label", + "rule": "color-contrast", + "description": "Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds", "targets": [ [ - "input[data-cy-upload-picker-input=\"\"]" + ".suggestions--button.button-vue--secondary[data-v-3df841b1=\"\"]:nth-child(1) > .button-vue__wrapper[data-v-47ce59a3=\"\"] > .button-vue__text[data-v-47ce59a3=\"\"]" + ], + [ + "button[title=\"\"] > .button-vue__wrapper[data-v-47ce59a3=\"\"] > .button-vue__text[data-v-47ce59a3=\"\"]" + ], + [ + ".suggestions--button.button-vue--secondary[data-v-3df841b1=\"\"]:nth-child(3) > .button-vue__wrapper[data-v-47ce59a3=\"\"] > .button-vue__text[data-v-47ce59a3=\"\"]" + ], + [ + ".suggestions--button.button-vue--secondary[data-v-3df841b1=\"\"]:nth-child(4) > .button-vue__wrapper[data-v-47ce59a3=\"\"] > .button-vue__text[data-v-47ce59a3=\"\"]" ] ], - "impact": "critical" + "impact": "serious" + }, + { + "rule": "role-img-alt", + "description": "Ensure [role=\"img\"] and [role=\"image\"] elements have alternative text", + "targets": [ + [ + ".material-design-icon[data-v-2ff3d40c=\"\"][aria-label=\"\"]" + ] + ], + "impact": "serious" } ] Snapshot: accessibility-violations.json 47 | violationFingerprints(accessibilityScanResults), 48 | formatViolations(accessibilityScanResults), > 49 | ).toMatchSnapshot('accessibility-violations.json') | ^ 50 | }) 51 | 52 | test('should not have accessibility violations in the editor content area', async ({ at /home/runner/actions-runner/_work/text/text/playwright/e2e/accessibility.spec.ts:49:5
})

test('should not have accessibility violations in the editor content area', async ({
page,
open,
makeAxeBuilder,
editor,
}, testInfo) => {
await open()
await editor.type('Test content')

// Wait for the editor to be ready
await page.waitForSelector('.text-editor', { state: 'visible' })

// Scan only the editor content area
const accessibilityScanResults = await makeAxeBuilder()
.include('.text-editor')
.analyze()

await testInfo.attach('editor-content-scan-results', {
body: JSON.stringify(accessibilityScanResults, null, 2),
contentType: 'application/json',
})

expect(
violationFingerprints(accessibilityScanResults),
formatViolations(accessibilityScanResults),
).toMatchSnapshot('editor-content-violations.json')

Check failure on line 77 in playwright/e2e/accessibility.spec.ts

View workflow job for this annotation

GitHub Actions / playwright (1, 3)

[chromium] › playwright/e2e/accessibility.spec.ts:52:2 › Editor Accessibility › should not have accessibility violations in the editor content area

2) [chromium] › playwright/e2e/accessibility.spec.ts:52:2 › Editor Accessibility › should not have accessibility violations in the editor content area Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: Found 1 accessibility violation(s): Rule: role-img-alt (serious) Description: Ensure [role="img"] and [role="image"] elements have alternative text Help: [role="img"] and [role="image"] elements must have alternative text Help URL: https://dequeuniversity.com/rules/axe/4.14/role-img-alt?application=playwright Affected elements: - .material-design-icon[data-v-2ff3d40c=""][aria-label=""] expect(string).toMatchSnapshot(expected) failed @@ -1,1 +1,12 @@ -[] +[ + { + "rule": "role-img-alt", + "description": "Ensure [role=\"img\"] and [role=\"image\"] elements have alternative text", + "targets": [ + [ + ".material-design-icon[data-v-2ff3d40c=\"\"][aria-label=\"\"]" + ] + ], + "impact": "serious" + } +] Snapshot: editor-content-violations.json 75 | violationFingerprints(accessibilityScanResults), 76 | formatViolations(accessibilityScanResults), > 77 | ).toMatchSnapshot('editor-content-violations.json') | ^ 78 | }) 79 | 80 | test('should not have accessibility violations in the menu bar', async ({ at /home/runner/actions-runner/_work/text/text/playwright/e2e/accessibility.spec.ts:77:5

Check failure on line 77 in playwright/e2e/accessibility.spec.ts

View workflow job for this annotation

GitHub Actions / playwright (1, 3)

[chromium] › playwright/e2e/accessibility.spec.ts:52:2 › Editor Accessibility › should not have accessibility violations in the editor content area

2) [chromium] › playwright/e2e/accessibility.spec.ts:52:2 › Editor Accessibility › should not have accessibility violations in the editor content area Error: Found 1 accessibility violation(s): Rule: role-img-alt (serious) Description: Ensure [role="img"] and [role="image"] elements have alternative text Help: [role="img"] and [role="image"] elements must have alternative text Help URL: https://dequeuniversity.com/rules/axe/4.14/role-img-alt?application=playwright Affected elements: - .material-design-icon[data-v-2ff3d40c=""][aria-label=""] expect(string).toMatchSnapshot(expected) failed @@ -1,1 +1,12 @@ -[] +[ + { + "rule": "role-img-alt", + "description": "Ensure [role=\"img\"] and [role=\"image\"] elements have alternative text", + "targets": [ + [ + ".material-design-icon[data-v-2ff3d40c=\"\"][aria-label=\"\"]" + ] + ], + "impact": "serious" + } +] Snapshot: editor-content-violations.json 75 | violationFingerprints(accessibilityScanResults), 76 | formatViolations(accessibilityScanResults), > 77 | ).toMatchSnapshot('editor-content-violations.json') | ^ 78 | }) 79 | 80 | test('should not have accessibility violations in the menu bar', async ({ at /home/runner/actions-runner/_work/text/text/playwright/e2e/accessibility.spec.ts:77:5
})

test('should not have accessibility violations in the menu bar', async ({
page,
open,
makeAxeBuilder,
}, testInfo) => {
await open()

// Wait for the menu bar to be visible
await page.waitForSelector('.text-menubar', { state: 'visible' })

// Scan only the menu bar
const accessibilityScanResults = await makeAxeBuilder()
.include('.text-menubar')
.analyze()

await testInfo.attach('menubar-scan-results', {
body: JSON.stringify(accessibilityScanResults, null, 2),
contentType: 'application/json',
})

expect(
violationFingerprints(accessibilityScanResults),
formatViolations(accessibilityScanResults),
).toMatchSnapshot('menubar-violations.json')

Check failure on line 103 in playwright/e2e/accessibility.spec.ts

View workflow job for this annotation

GitHub Actions / playwright (1, 3)

[chromium] › playwright/e2e/accessibility.spec.ts:80:2 › Editor Accessibility › should not have accessibility violations in the menu bar

3) [chromium] › playwright/e2e/accessibility.spec.ts:80:2 › Editor Accessibility › should not have accessibility violations in the menu bar Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: Found 1 accessibility violation(s): Rule: role-img-alt (serious) Description: Ensure [role="img"] and [role="image"] elements have alternative text Help: [role="img"] and [role="image"] elements must have alternative text Help URL: https://dequeuniversity.com/rules/axe/4.14/role-img-alt?application=playwright Affected elements: - .material-design-icon[data-v-2ff3d40c=""][aria-label=""] expect(string).toMatchSnapshot(expected) failed @@ -1,1 +1,12 @@ -[] +[ + { + "rule": "role-img-alt", + "description": "Ensure [role=\"img\"] and [role=\"image\"] elements have alternative text", + "targets": [ + [ + ".material-design-icon[data-v-2ff3d40c=\"\"][aria-label=\"\"]" + ] + ], + "impact": "serious" + } +] Snapshot: menubar-violations.json 101 | violationFingerprints(accessibilityScanResults), 102 | formatViolations(accessibilityScanResults), > 103 | ).toMatchSnapshot('menubar-violations.json') | ^ 104 | }) 105 | 106 | test('should have proper keyboard navigation support', async ({ at /home/runner/actions-runner/_work/text/text/playwright/e2e/accessibility.spec.ts:103:5

Check failure on line 103 in playwright/e2e/accessibility.spec.ts

View workflow job for this annotation

GitHub Actions / playwright (1, 3)

[chromium] › playwright/e2e/accessibility.spec.ts:80:2 › Editor Accessibility › should not have accessibility violations in the menu bar

3) [chromium] › playwright/e2e/accessibility.spec.ts:80:2 › Editor Accessibility › should not have accessibility violations in the menu bar Error: Found 1 accessibility violation(s): Rule: role-img-alt (serious) Description: Ensure [role="img"] and [role="image"] elements have alternative text Help: [role="img"] and [role="image"] elements must have alternative text Help URL: https://dequeuniversity.com/rules/axe/4.14/role-img-alt?application=playwright Affected elements: - .material-design-icon[data-v-2ff3d40c=""][aria-label=""] expect(string).toMatchSnapshot(expected) failed @@ -1,1 +1,12 @@ -[] +[ + { + "rule": "role-img-alt", + "description": "Ensure [role=\"img\"] and [role=\"image\"] elements have alternative text", + "targets": [ + [ + ".material-design-icon[data-v-2ff3d40c=\"\"][aria-label=\"\"]" + ] + ], + "impact": "serious" + } +] Snapshot: menubar-violations.json 101 | violationFingerprints(accessibilityScanResults), 102 | formatViolations(accessibilityScanResults), > 103 | ).toMatchSnapshot('menubar-violations.json') | ^ 104 | }) 105 | 106 | test('should have proper keyboard navigation support', async ({ at /home/runner/actions-runner/_work/text/text/playwright/e2e/accessibility.spec.ts:103:5
})

test('should have proper keyboard navigation support', async ({
page,
open,
makeAxeBuilder,
}, testInfo) => {
await open()

// Wait for the editor to be fully loaded
await page.waitForSelector('.text-editor', { state: 'visible' })

// Check for keyboard-specific accessibility issues
const accessibilityScanResults = await makeAxeBuilder()
// Focus on keyboard accessibility rules (WCAG only, not best-practice)
.withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'])
.analyze()

await testInfo.attach('keyboard-navigation-scan-results', {
body: JSON.stringify(accessibilityScanResults, null, 2),
contentType: 'application/json',
})

// Check that interactive elements are keyboard accessible
expect(
violationFingerprints(accessibilityScanResults),
formatViolations(accessibilityScanResults),
).toMatchSnapshot('keyboard-navigation-violations.json')

Check failure on line 131 in playwright/e2e/accessibility.spec.ts

View workflow job for this annotation

GitHub Actions / playwright (1, 3)

[chromium] › playwright/e2e/accessibility.spec.ts:106:2 › Editor Accessibility › should have proper keyboard navigation support

4) [chromium] › playwright/e2e/accessibility.spec.ts:106:2 › Editor Accessibility › should have proper keyboard navigation support Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: Found 1 accessibility violation(s): Rule: role-img-alt (serious) Description: Ensure [role="img"] and [role="image"] elements have alternative text Help: [role="img"] and [role="image"] elements must have alternative text Help URL: https://dequeuniversity.com/rules/axe/4.14/role-img-alt?application=playwright Affected elements: - .material-design-icon[data-v-2ff3d40c=""][aria-label=""] expect(string).toMatchSnapshot(expected) failed @@ -1,12 +1,12 @@ [ { - "rule": "label", - "description": "Ensure every form element has a label", + "rule": "role-img-alt", + "description": "Ensure [role=\"img\"] and [role=\"image\"] elements have alternative text", "targets": [ [ - "input[data-cy-upload-picker-input=\"\"]" + ".material-design-icon[data-v-2ff3d40c=\"\"][aria-label=\"\"]" ] ], - "impact": "critical" + "impact": "serious" } ] Snapshot: keyboard-navigation-violations.json 129 | violationFingerprints(accessibilityScanResults), 130 | formatViolations(accessibilityScanResults), > 131 | ).toMatchSnapshot('keyboard-navigation-violations.json') | ^ 132 | }) 133 | 134 | test('should have proper ARIA labels on interactive elements', async ({ at /home/runner/actions-runner/_work/text/text/playwright/e2e/accessibility.spec.ts:131:5

Check failure on line 131 in playwright/e2e/accessibility.spec.ts

View workflow job for this annotation

GitHub Actions / playwright (1, 3)

[chromium] › playwright/e2e/accessibility.spec.ts:106:2 › Editor Accessibility › should have proper keyboard navigation support

4) [chromium] › playwright/e2e/accessibility.spec.ts:106:2 › Editor Accessibility › should have proper keyboard navigation support Error: Found 1 accessibility violation(s): Rule: role-img-alt (serious) Description: Ensure [role="img"] and [role="image"] elements have alternative text Help: [role="img"] and [role="image"] elements must have alternative text Help URL: https://dequeuniversity.com/rules/axe/4.14/role-img-alt?application=playwright Affected elements: - .material-design-icon[data-v-2ff3d40c=""][aria-label=""] expect(string).toMatchSnapshot(expected) failed @@ -1,12 +1,12 @@ [ { - "rule": "label", - "description": "Ensure every form element has a label", + "rule": "role-img-alt", + "description": "Ensure [role=\"img\"] and [role=\"image\"] elements have alternative text", "targets": [ [ - "input[data-cy-upload-picker-input=\"\"]" + ".material-design-icon[data-v-2ff3d40c=\"\"][aria-label=\"\"]" ] ], - "impact": "critical" + "impact": "serious" } ] Snapshot: keyboard-navigation-violations.json 129 | violationFingerprints(accessibilityScanResults), 130 | formatViolations(accessibilityScanResults), > 131 | ).toMatchSnapshot('keyboard-navigation-violations.json') | ^ 132 | }) 133 | 134 | test('should have proper ARIA labels on interactive elements', async ({ at /home/runner/actions-runner/_work/text/text/playwright/e2e/accessibility.spec.ts:131:5
})

test('should have proper ARIA labels on interactive elements', async ({
page,
open,
makeAxeBuilder,
editor,
}, testInfo) => {
await open()

// Open a menu to check its accessibility
const boldButton = editor.getMenu('Bold')
await expect(boldButton).toBeVisible()

// Wait for all menu items to be rendered
await page.waitForSelector('[role="button"], button', { state: 'attached' })

// Scan for ARIA-related issues
const accessibilityScanResults = await makeAxeBuilder()
.withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'])
.analyze()

await testInfo.attach('aria-labels-scan-results', {
body: JSON.stringify(accessibilityScanResults, null, 2),
contentType: 'application/json',
})

expect(
violationFingerprints(accessibilityScanResults),
formatViolations(accessibilityScanResults),
).toMatchSnapshot('aria-labels-violations.json')

Check failure on line 162 in playwright/e2e/accessibility.spec.ts

View workflow job for this annotation

GitHub Actions / playwright (1, 3)

[chromium] › playwright/e2e/accessibility.spec.ts:134:2 › Editor Accessibility › should have proper ARIA labels on interactive elements

5) [chromium] › playwright/e2e/accessibility.spec.ts:134:2 › Editor Accessibility › should have proper ARIA labels on interactive elements Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: Found 1 accessibility violation(s): Rule: role-img-alt (serious) Description: Ensure [role="img"] and [role="image"] elements have alternative text Help: [role="img"] and [role="image"] elements must have alternative text Help URL: https://dequeuniversity.com/rules/axe/4.14/role-img-alt?application=playwright Affected elements: - .material-design-icon[data-v-2ff3d40c=""][aria-label=""] expect(string).toMatchSnapshot(expected) failed @@ -1,12 +1,12 @@ [ { - "rule": "label", - "description": "Ensure every form element has a label", + "rule": "role-img-alt", + "description": "Ensure [role=\"img\"] and [role=\"image\"] elements have alternative text", "targets": [ [ - "input[data-cy-upload-picker-input=\"\"]" + ".material-design-icon[data-v-2ff3d40c=\"\"][aria-label=\"\"]" ] ], - "impact": "critical" + "impact": "serious" } ] Snapshot: aria-labels-violations.json 160 | violationFingerprints(accessibilityScanResults), 161 | formatViolations(accessibilityScanResults), > 162 | ).toMatchSnapshot('aria-labels-violations.json') | ^ 163 | }) 164 | 165 | test('should maintain accessibility after text formatting', async ({ at /home/runner/actions-runner/_work/text/text/playwright/e2e/accessibility.spec.ts:162:5

Check failure on line 162 in playwright/e2e/accessibility.spec.ts

View workflow job for this annotation

GitHub Actions / playwright (1, 3)

[chromium] › playwright/e2e/accessibility.spec.ts:134:2 › Editor Accessibility › should have proper ARIA labels on interactive elements

5) [chromium] › playwright/e2e/accessibility.spec.ts:134:2 › Editor Accessibility › should have proper ARIA labels on interactive elements Error: Found 1 accessibility violation(s): Rule: role-img-alt (serious) Description: Ensure [role="img"] and [role="image"] elements have alternative text Help: [role="img"] and [role="image"] elements must have alternative text Help URL: https://dequeuniversity.com/rules/axe/4.14/role-img-alt?application=playwright Affected elements: - .material-design-icon[data-v-2ff3d40c=""][aria-label=""] expect(string).toMatchSnapshot(expected) failed @@ -1,12 +1,12 @@ [ { - "rule": "label", - "description": "Ensure every form element has a label", + "rule": "role-img-alt", + "description": "Ensure [role=\"img\"] and [role=\"image\"] elements have alternative text", "targets": [ [ - "input[data-cy-upload-picker-input=\"\"]" + ".material-design-icon[data-v-2ff3d40c=\"\"][aria-label=\"\"]" ] ], - "impact": "critical" + "impact": "serious" } ] Snapshot: aria-labels-violations.json 160 | violationFingerprints(accessibilityScanResults), 161 | formatViolations(accessibilityScanResults), > 162 | ).toMatchSnapshot('aria-labels-violations.json') | ^ 163 | }) 164 | 165 | test('should maintain accessibility after text formatting', async ({ at /home/runner/actions-runner/_work/text/text/playwright/e2e/accessibility.spec.ts:162:5
})

test('should maintain accessibility after text formatting', async ({
page,
open,
makeAxeBuilder,
editor,
}, testInfo) => {
await open()

// Type some text and format it
await editor.type('Format me')
const CtrlOrCmd = process.platform === 'darwin' ? 'Meta' : 'Control'
await editor.content.press(CtrlOrCmd + '+a')
await editor.getMenu('Bold').click()
await editor.getMenu('Italic').click()

// Wait for formatting to be applied
await page.waitForSelector('strong', { state: 'attached' })
await page.waitForSelector('em', { state: 'attached' })

// Scan after formatting operations
const accessibilityScanResults = await makeAxeBuilder()
.include('.text-editor')
.analyze()

await testInfo.attach('formatted-content-scan-results', {
body: JSON.stringify(accessibilityScanResults, null, 2),
contentType: 'application/json',
})

expect(
violationFingerprints(accessibilityScanResults),
formatViolations(accessibilityScanResults),
).toMatchSnapshot('formatted-content-violations.json')
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"rule": "label",
"description": "Ensure every form element has a label",
"targets": [
[
"input[data-cy-upload-picker-input=\"\"]"
]
],
"impact": "critical"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"rule": "label",
"description": "Ensure every form element has a label",
"targets": [
[
"input[data-cy-upload-picker-input=\"\"]"
]
],
"impact": "critical"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"rule": "label",
"description": "Ensure every form element has a label",
"targets": [
[
"input[data-cy-upload-picker-input=\"\"]"
]
],
"impact": "critical"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
28 changes: 28 additions & 0 deletions playwright/support/fixtures/accessibility.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import { test as base } from '@playwright/test'
import AxeBuilder from '@axe-core/playwright'

Check failure on line 7 in playwright/support/fixtures/accessibility.ts

View workflow job for this annotation

GitHub Actions / NPM lint

Expected "@axe-core/playwright" to come before "@playwright/test"

type AxeFixture = {
makeAxeBuilder: () => AxeBuilder
}

export const test = base.extend<AxeFixture>({
makeAxeBuilder: async ({ page }, use) => {
const makeAxeBuilder = () => new AxeBuilder({ page })
// Test against WCAG 2.0 and 2.1 Level A and AA
.withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'])

// Use legacy mode for compatibility with custom Playwright fixtures
// See: https://github.com/dequelabs/axe-core-npm/blob/develop/packages/playwright/error-handling.md
.setLegacyMode()


Check failure on line 23 in playwright/support/fixtures/accessibility.ts

View workflow job for this annotation

GitHub Actions / NPM lint

More than 1 blank line not allowed
await use(makeAxeBuilder)
},
})

export { expect } from '@playwright/test'
Loading
Loading