forked from abhinaba-ghosh/axe-playwright
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
93 lines (81 loc) · 2.28 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import { AxeResults, Check, ElementContext, ImpactValue, Locale, Result, Rule, RunOptions } from 'axe-core'
import { Page } from 'playwright'
export interface axeOptionsConfig {
axeOptions: RunOptions
}
export interface ConfigOptions {
branding?: {
brand?: string
application?: string
}
reporter?: 'v1' | 'v2' | 'no-passes'
checks?: Check[]
rules?: Rule[]
locale?: Locale
axeVersion?: string
}
/**
* Implement this interface to be able to specific custom reporting behaviour for checkA11y method.
* @see checkA11y
*/
export default interface Reporter {
report(violations: Result[]): Promise<void>
}
/**
* Default implementation of a reporter which prints a summary to the console.
*/
export class DefaultTerminalReporter implements Reporter {
constructor(detailedReport: boolean | undefined, includeHtml: boolean | undefined)
report(violations: Result[]): Promise<void>
}
export type Options = {
includedImpacts?: ImpactValue[]
detailedReport?: boolean
detailedReportOptions?: { html?: boolean }
} & axeOptionsConfig
declare module 'axe-core' {
interface Node {}
}
/**
* Injects axe into browser-context
*/
export function injectAxe(page: Page): Promise<void>
/**
* Performs accessibility checks in the web page
* @param page
* @param context
* @param options
* @param skipFailures
*/
export function checkA11y(
page: Page,
context?: ElementContext,
options?: Options,
skipFailures?: boolean,
): Promise<void>
/**
* configure different axe configurations
* @param page
* @param options
*/
export function configureAxe(page: Page, options?: ConfigOptions): Promise<void>
/**
* Runs axe-core tools on the relevant page and returns all results
* @param page
* @param context
* @param options
*/
export function getAxeResults(page: Page, context?: ElementContext, options?: RunOptions): Promise<AxeResults>
/**
* Runs axe-core tools on the relevant page and returns all accessibility violations detected on the page
* @param page
* @param context
* @param options
*/
export function getViolations(page: Page, context?: ElementContext, options?: RunOptions): Promise<Result[]>
/**
* Report violations given the reporter.
* @param violations
* @param reporter
*/
export function reportViolations(violations: Result[], reporter: Reporter): Promise<void>