Skip to content
Closed
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
4 changes: 4 additions & 0 deletions .github/actions/find/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ configuration option.
[`colorScheme`](https://playwright.dev/docs/api/class-browser#browser-new-context-option-color-scheme)
configuration option.

#### `ignore_https_errors`

**Optional** Bool - whether to ignore HTTPS errors when scanning URLs with self-signed certificates.

#### `include_screenshots`

**Optional** Bool - whether to capture screenshots of scanned pages and include links to them in the issue
Expand Down
5 changes: 5 additions & 0 deletions .github/actions/find/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ inputs:
color_scheme:
description: 'Playwright colorScheme setting: https://playwright.dev/docs/api/class-browser#browser-new-context-option-color-scheme'
required: false
ignore_https_errors:
description: 'Whether to ignore HTTPS errors when scanning URLs with self-signed certificates'
required: false
default: 'false'

outputs:
findings_file:
description: 'Path to a JSON file containing the list of potential accessibility gaps'
Expand Down
2 changes: 2 additions & 0 deletions .github/actions/find/src/findForUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export async function findForUrl(
includeScreenshots: boolean = false,
reducedMotion?: ReducedMotionPreference,
colorScheme?: ColorSchemePreference,
ignoreHttpsErrors: boolean = false,
): Promise<Finding[]> {
const {url, excludeSelectors, waitForSelectors} = urlConfig
const browser = await playwright.chromium.launch({
Expand All @@ -33,6 +34,7 @@ export async function findForUrl(
...(authContext?.toPlaywrightBrowserContextOptions() ?? {}),
...(reducedMotion ? {reducedMotion} : {}),
...(colorScheme ? {colorScheme} : {}),
...(ignoreHttpsErrors ? {ignoreHTTPSErrors: true} : {}),
}
let context: playwright.BrowserContext | undefined
try {
Expand Down
14 changes: 13 additions & 1 deletion .github/actions/find/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default async function () {
const urls = loadUrls({urlConfigs})
const reducedMotion = loadReducedMotion()
const colorScheme = loadColorScheme()
const ignoreHttpsErrors = loadIgnoreHttpsErrors()

const actualUrls = urlConfigs || urls || []

Expand All @@ -22,7 +23,14 @@ export default async function () {
for (const urlConfig of actualUrls) {
const {url} = urlConfig
core.info(`Preparing to scan ${url}`)
const findingsForUrl = await findForUrl(urlConfig, authContext, includeScreenshots, reducedMotion, colorScheme)
const findingsForUrl = await findForUrl(
urlConfig,
authContext,
includeScreenshots,
reducedMotion,
colorScheme,
ignoreHttpsErrors,
)
if (findingsForUrl.length === 0) {
core.info(`No accessibility gaps were found on ${url}`)
continue
Expand Down Expand Up @@ -108,3 +116,7 @@ function loadColorScheme() {

return colorSchemeInput as ColorSchemePreference
}

function loadIgnoreHttpsErrors() {
return core.getInput('ignore_https_errors', {required: false}).toLowerCase() === 'true'
}
31 changes: 31 additions & 0 deletions .github/actions/find/tests/findForUrl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,4 +392,35 @@ describe('findForUrl', () => {
expect(await categoryFor(['wcag2a', 'experimental'])).toBe('experimental')
})
})

describe('when ignoreHttpsErrors is enabled', () => {
it('forwards ignoreHTTPSErrors to the browser context', async () => {
actionInput = ''
clearAll()

await findForUrl({url: 'test.com'}, undefined, false, undefined, undefined, true)

expect(playwrightMocks.browserNewContext).toHaveBeenCalledWith({ignoreHTTPSErrors: true})
})
})

describe('when ignoreHttpsErrors is not enabled', () => {
it('does not forward ignoreHTTPSErrors by default', async () => {
actionInput = ''
clearAll()

await findForUrl({url: 'test.com'})

expect(playwrightMocks.browserNewContext).toHaveBeenCalledWith({})
})

it('does not forward ignoreHTTPSErrors when explicitly disabled', async () => {
actionInput = ''
clearAll()

await findForUrl({url: 'test.com'}, undefined, false, undefined, undefined, false)

expect(playwrightMocks.browserNewContext).toHaveBeenCalledWith({})
})
})
})
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
# dry_run: false # Optional: Set to true to scan and log what would be filed without creating/closing issues or writing the cache
# reduced_motion: no-preference # Optional: Playwright reduced motion configuration option
# color_scheme: light # Optional: Playwright color scheme configuration option
# ignore_https_errors: false # Optional: Set to true to ignore HTTPS errors when scanning URLs with self-signed certificates
# scans: '["axe","accesslint","reflow-scan"]' # Optional: An array of scans (or plugins) to be performed. Built-in engines are 'axe' and 'accesslint'; any other entry is a plugin name. If not provided, only Axe will be performed.
# url_configs: '[{"url":"https://example.com","excludeSelectors":["iframe","#widget"],"waitForSelectors":["#app","[data-ready]"]}]' # Optional: Per-URL config with CSS selectors to exclude from Axe or wait for before scanning. When provided, takes precedence over 'urls'.
```
Expand Down Expand Up @@ -137,6 +138,7 @@ Trigger the workflow manually or automatically based on your configuration. The
| `file_experimental_issues` | No | Whether to file issues for experimental findings (checks that are not yet stable). Set to `false` to suppress new experimental issues; existing ones are left untouched. Default: `true` | `false` |
| `reduced_motion` | No | Playwright `reducedMotion` setting for scan contexts. Allowed values: `reduce`, `no-preference` | `reduce` |
| `color_scheme` | No | Playwright `colorScheme` setting for scan contexts. Allowed values: `light`, `dark`, `no-preference` | `dark` |
| `ignore_https_errors` | No | Whether to ignore HTTPS errors when scanning URLs with self-signed certificates. Default: `false` | `true` |
| `scans` | No | An array of scans (or plugins) to be performed. Built-in engines are `axe` and `accesslint`; any other entry is treated as a plugin name. If not provided, only Axe will be performed. | `'["axe", "accesslint", ...other plugins]'` |
| `dry_run` | No | When `true`, scan and log the issues that _would_ be filed without opening, closing, reopening, or assigning any issues — and without writing to the `gh-cache` branch. Useful for safely previewing results. Default: `false` | `true` |
| `url_configs` | No | A stringified JSON array of URL config objects. Each object must have a `url` field and may have `excludeSelectors` (selectors to exclude from Axe) and `waitForSelectors` (selectors that must become visible within 30 seconds before scanning). When provided, takes precedence over the `urls` input. | `'[{"url":"https://example.com","excludeSelectors":["iframe","#widget"],"waitForSelectors":["#app"]}]'` |
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ inputs:
color_scheme:
description: 'Playwright colorScheme setting: https://playwright.dev/docs/api/class-browser#browser-new-context-option-color-scheme'
required: false
ignore_https_errors:
description: 'Whether to ignore HTTPS errors when scanning URLs with self-signed certificates'
required: false
default: 'false'
scans:
description: "Stringified JSON array of scans to perform. Core engines and local plugins use string names. Allowlisted NPM plugins use an object with 'name', 'package', and optional 'version'. If not provided, only Axe will be performed"
required: false
Expand Down Expand Up @@ -133,6 +137,7 @@ runs:
include_screenshots: ${{ inputs.include_screenshots }}
reduced_motion: ${{ inputs.reduced_motion }}
color_scheme: ${{ inputs.color_scheme }}
ignore_https_errors: ${{ inputs.ignore_https_errors }}
scans: ${{ inputs.scans }}
- name: File
id: file
Expand Down
Loading