Skip to content

Commit 6973d28

Browse files
authored
Merge branch 'main' into joyce/document_questions
2 parents 9c319b7 + 410526b commit 6973d28

File tree

17 files changed

+94
-32
lines changed

17 files changed

+94
-32
lines changed

.github/actions/auth/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/actions/auth/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"playwright": "^1.58.2"
1818
},
1919
"devDependencies": {
20-
"@types/node": "^25.3.0",
20+
"@types/node": "^25.3.3",
2121
"typescript": "^5.9.3"
2222
}
2323
}

.github/actions/file/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/actions/file/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"@octokit/plugin-throttling": "^11.0.3"
1919
},
2020
"devDependencies": {
21-
"@types/node": "^25.3.0",
21+
"@types/node": "^25.3.3",
2222
"typescript": "^5.9.3"
2323
}
2424
}

.github/actions/find/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@ https://primer.style/octicons/
1919

2020
**Optional** Stringified JSON object containing `username`, `password`, `cookies`, and/or `localStorage` from an authenticated session. For example: `{"username":"some-user","password":"correct-horse-battery-staple","cookies":[{"name":"theme-preference","value":"light","domain":"primer.style","path":"/"}],"localStorage":{"https://primer.style":{"theme-preference":"light"}}}`
2121

22+
#### `reduced_motion`
23+
24+
**Optional** Playwright
25+
[`reducedMotion`](https://playwright.dev/docs/api/class-browser#browser-new-context-option-reduced-motion)
26+
configuration option.
27+
28+
#### `color_scheme`
29+
30+
**Optional** Playwright
31+
[`colorScheme`](https://playwright.dev/docs/api/class-browser#browser-new-context-option-color-scheme)
32+
configuration option.
33+
2234
### Outputs
2335

2436
#### `findings`

.github/actions/find/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ inputs:
1313
description: "Whether to capture screenshots of scanned pages and include links to them in the issue"
1414
required: false
1515
default: "false"
16+
reduced_motion:
17+
description: "Playwright reducedMotion setting: https://playwright.dev/docs/api/class-browser#browser-new-page-option-reduced-motion"
18+
required: false
19+
color_scheme:
20+
description: "Playwright colorScheme setting: https://playwright.dev/docs/api/class-browser#browser-new-context-option-color-scheme"
21+
required: false
1622

1723
outputs:
1824
findings:

.github/actions/find/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/actions/find/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"playwright": "^1.58.2"
1919
},
2020
"devDependencies": {
21-
"@types/node": "^25.3.0",
21+
"@types/node": "^25.3.3",
2222
"typescript": "^5.9.3"
2323
}
2424
}

.github/actions/find/src/findForUrl.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type {Finding} from './types.d.js'
1+
import type {ColorSchemePreference, Finding, ReducedMotionPreference} from './types.d.js'
22
import {AxeBuilder} from '@axe-core/playwright'
33
import playwright from 'playwright'
44
import {AuthContext} from './AuthContext.js'
@@ -8,12 +8,18 @@ export async function findForUrl(
88
url: string,
99
authContext?: AuthContext,
1010
includeScreenshots: boolean = false,
11+
reducedMotion?: ReducedMotionPreference,
12+
colorScheme?: ColorSchemePreference,
1113
): Promise<Finding[]> {
1214
const browser = await playwright.chromium.launch({
1315
headless: true,
1416
executablePath: process.env.CI ? '/usr/bin/google-chrome' : undefined,
1517
})
16-
const contextOptions = authContext?.toPlaywrightBrowserContextOptions() ?? {}
18+
const contextOptions = {
19+
...(authContext?.toPlaywrightBrowserContextOptions() ?? {}),
20+
...(reducedMotion ? {reducedMotion} : {}),
21+
...(colorScheme ? {colorScheme} : {}),
22+
}
1723
const context = await browser.newContext(contextOptions)
1824
const page = await context.newPage()
1925
await page.goto(url)

.github/actions/find/src/index.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type {AuthContextInput} from './types.js'
1+
import type {AuthContextInput, ColorSchemePreference, ReducedMotionPreference} from './types.js'
22
import * as core from '@actions/core'
33
import {AuthContext} from './AuthContext.js'
44
import {findForUrl} from './findForUrl.js'
@@ -11,11 +11,31 @@ export default async function () {
1111
const authContext = new AuthContext(authContextInput)
1212

1313
const includeScreenshots = core.getInput('include_screenshots', {required: false}) !== 'false'
14+
const reducedMotionInput = core.getInput('reduced_motion', {required: false})
15+
let reducedMotion: ReducedMotionPreference | undefined
16+
if (reducedMotionInput) {
17+
if (!['reduce', 'no-preference', null].includes(reducedMotionInput)) {
18+
throw new Error(
19+
"Input 'reduced_motion' must be one of: 'reduce', 'no-preference', or null per Playwright documentation.",
20+
)
21+
}
22+
reducedMotion = reducedMotionInput as ReducedMotionPreference
23+
}
24+
const colorSchemeInput = core.getInput('color_scheme', {required: false})
25+
let colorScheme: ColorSchemePreference | undefined
26+
if (colorSchemeInput) {
27+
if (!['light', 'dark', 'no-preference', null].includes(colorSchemeInput)) {
28+
throw new Error(
29+
"Input 'color_scheme' must be one of: 'light', 'dark', 'no-preference', or null per Playwright documentation.",
30+
)
31+
}
32+
colorScheme = colorSchemeInput as ColorSchemePreference
33+
}
1434

1535
const findings = []
1636
for (const url of urls) {
1737
core.info(`Preparing to scan ${url}`)
18-
const findingsForUrl = await findForUrl(url, authContext, includeScreenshots)
38+
const findingsForUrl = await findForUrl(url, authContext, includeScreenshots, reducedMotion, colorScheme)
1939
if (findingsForUrl.length === 0) {
2040
core.info(`No accessibility gaps were found on ${url}`)
2141
continue

0 commit comments

Comments
 (0)