@memberjunction/react-test-harness 6.3.0-edge.1 → 6.3.0-edge.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -2
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/accessibility-audit.d.ts +137 -0
- package/dist/lib/accessibility-audit.d.ts.map +1 -0
- package/dist/lib/accessibility-audit.js +301 -0
- package/dist/lib/accessibility-audit.js.map +1 -0
- package/dist/lib/browser-context.d.ts +70 -0
- package/dist/lib/browser-context.d.ts.map +1 -1
- package/dist/lib/browser-context.js +135 -7
- package/dist/lib/browser-context.js.map +1 -1
- package/dist/lib/component-runner.d.ts +41 -0
- package/dist/lib/component-runner.d.ts.map +1 -1
- package/dist/lib/component-runner.js +87 -3
- package/dist/lib/component-runner.js.map +1 -1
- package/dist/lib/network-policy.d.ts +67 -0
- package/dist/lib/network-policy.d.ts.map +1 -0
- package/dist/lib/network-policy.js +150 -0
- package/dist/lib/network-policy.js.map +1 -0
- package/dist/lib/network-proxy.d.ts +33 -0
- package/dist/lib/network-proxy.d.ts.map +1 -0
- package/dist/lib/network-proxy.js +126 -0
- package/dist/lib/network-proxy.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -15
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @memberjunction/react-test-harness
|
|
2
2
|
|
|
3
|
-
Automated test harness for MemberJunction interactive React components. Provides static analysis (linting) with
|
|
3
|
+
Automated test harness for MemberJunction interactive React components. Provides static analysis (linting) with extensible rules across JSX and TSX modes, type checking, constraint validation, browser-based rendering via Playwright, axe-core WCAG accessibility auditing, and a CLI for running test suites.
|
|
4
4
|
|
|
5
5
|
## Quick Start
|
|
6
6
|
|
|
@@ -38,6 +38,22 @@ console.log('Rendered:', result.success);
|
|
|
38
38
|
console.log('Errors:', result.errors);
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
+
### Accessibility Auditing (`axe-core`)
|
|
42
|
+
|
|
43
|
+
Run WCAG 2.0/2.1 A/AA audits offline on a Playwright page (failing on `'serious'` and `'critical'` impacts by default) or enable `accessibilityAudit: true` on `ComponentExecutionOptions`:
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import { RunAccessibilityAudit } from '@memberjunction/react-test-harness';
|
|
47
|
+
|
|
48
|
+
const audit = await RunAccessibilityAudit(page, {
|
|
49
|
+
failOnImpacts: ['serious', 'critical'],
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
if (!audit.passed) {
|
|
53
|
+
console.error(audit.summary);
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
41
57
|
### Connecting to an existing browser
|
|
42
58
|
|
|
43
59
|
By default the harness launches its own throwaway Chromium. You can instead attach
|
|
@@ -134,7 +150,9 @@ See [LINTER-ARCHITECTURE.md](LINTER-ARCHITECTURE.md) for comprehensive documenta
|
|
|
134
150
|
- SQL dialect configuration
|
|
135
151
|
- Test fixture organization
|
|
136
152
|
|
|
137
|
-
## Lint Rules (
|
|
153
|
+
## Lint Rules (58)
|
|
154
|
+
|
|
155
|
+
When linting `codeLanguage: 'tsx'` specs, `ComponentLinter` skips the 20 legacy AST type-inference rules and validates types via `TypeCheckTsxComponentSpec` while keeping structural, data-access, hook, and security rules (`no-unsafe-eval-or-dom`) active.
|
|
138
156
|
|
|
139
157
|
### Data Access (5 rules)
|
|
140
158
|
- `runview-call-validation` — RunView/RunViews call-site validation
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export { ReactTestHarness, TestHarnessOptions } from './lib/test-harness.js';
|
|
2
2
|
export { BrowserManager, BrowserContextOptions, ClassifyConnectEndpoint } from './lib/browser-context.js';
|
|
3
|
-
export {
|
|
3
|
+
export { NetworkAllowlist, NetworkAccessMode, HostOfUrl, RedactUrl, BROWSER_LAUNCH_ARGS, DISABLE_WEBRTC_SCRIPT } from './lib/network-policy.js';
|
|
4
|
+
export { AllowlistProxy } from './lib/network-proxy.js';
|
|
5
|
+
export { ComponentRunner, ComponentExecutionOptions, ComponentExecutionResult, DataCapOptions, DataAccessRecord, DEFAULT_RUN_VIEW_MAX_ROWS, DEFAULT_RUN_QUERY_MAX_ROWS, DescribeQueryTarget, DescribeViewTarget, ResolveQueryTarget, ResolveViewTarget, DataAccessIdentity, LibraryNetworkUrls, CoreRuntimeNetworkUrls, NETWORK_REQUEST_BLOCKED_RULE, } from './lib/component-runner.js';
|
|
4
6
|
export { AssertionHelpers } from './lib/assertion-helpers.js';
|
|
7
|
+
export { RunAccessibilityAudit, runAccessibilityAudit, ResolveAxeCoreScriptPath, ToHarnessAccessibilityViolations, AccessibilityAuditError, DEFAULT_FAIL_ON_IMPACTS, DEFAULT_ACCESSIBILITY_TAGS, type AccessibilityImpact, type AccessibilityAuditNode, type AccessibilityAuditViolation, type AccessibilityAuditCounts, type AccessibilityAuditRawResults, type AccessibilityPageDriver, type AccessibilityAuditRunnerInput, type AccessibilityAuditRunner, type AccessibilityAuditOptions, type AccessibilityAuditResult, } from './lib/accessibility-audit.js';
|
|
5
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACvG,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,SAAS,EAAE,SAAS,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7I,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,wBAAwB,EACxB,cAAc,EACd,gBAAgB,EAEhB,yBAAyB,EACzB,0BAA0B,EAE1B,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAElB,kBAAkB,EAClB,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,gCAAgC,EAChC,uBAAuB,EACvB,uBAAuB,EACvB,0BAA0B,EAC1B,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EACjC,KAAK,uBAAuB,EAC5B,KAAK,6BAA6B,EAClC,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,GAC9B,MAAM,2BAA2B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
export { ReactTestHarness } from './lib/test-harness.js';
|
|
2
2
|
export { BrowserManager, ClassifyConnectEndpoint } from './lib/browser-context.js';
|
|
3
|
+
export { NetworkAllowlist, HostOfUrl, RedactUrl, BROWSER_LAUNCH_ARGS, DISABLE_WEBRTC_SCRIPT } from './lib/network-policy.js';
|
|
4
|
+
export { AllowlistProxy } from './lib/network-proxy.js';
|
|
3
5
|
// Export the component runner that uses the real React runtime UMD bundle
|
|
4
6
|
export { ComponentRunner,
|
|
5
7
|
// Exported so callers can reason about the ceiling they are overriding.
|
|
6
8
|
DEFAULT_RUN_VIEW_MAX_ROWS, DEFAULT_RUN_QUERY_MAX_ROWS,
|
|
7
9
|
// Identity resolution for the data bridges, mirroring how RunView/RunQuery resolve a target.
|
|
8
|
-
DescribeQueryTarget, DescribeViewTarget, ResolveQueryTarget, ResolveViewTarget,
|
|
10
|
+
DescribeQueryTarget, DescribeViewTarget, ResolveQueryTarget, ResolveViewTarget,
|
|
11
|
+
// The page's network allowlist: which library URLs it allows, and the rule of a blocked request.
|
|
12
|
+
LibraryNetworkUrls, CoreRuntimeNetworkUrls, NETWORK_REQUEST_BLOCKED_RULE, } from './lib/component-runner.js';
|
|
9
13
|
export { AssertionHelpers } from './lib/assertion-helpers.js';
|
|
14
|
+
export { RunAccessibilityAudit, runAccessibilityAudit, ResolveAxeCoreScriptPath, ToHarnessAccessibilityViolations, AccessibilityAuditError, DEFAULT_FAIL_ON_IMPACTS, DEFAULT_ACCESSIBILITY_TAGS, } from './lib/accessibility-audit.js';
|
|
10
15
|
// NOTE: The lint engine API (ComponentLinter, LintResult, Violation, BaseLintRule,
|
|
11
16
|
// LibraryLintCache, CompiledLibraryRules, CompiledValidator, LinterOptions) was
|
|
12
17
|
// previously re-exported here for back-compat after the 5.37 extraction. Those
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAsB,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAyB,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACvG,0EAA0E;AAC1E,OAAO,EACL,eAAe;AAKf,wEAAwE;AACxE,yBAAyB,EACzB,0BAA0B;AAC1B,6FAA6F;AAC7F,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAsB,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAyB,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACvG,OAAO,EAAE,gBAAgB,EAAqB,SAAS,EAAE,SAAS,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7I,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,0EAA0E;AAC1E,OAAO,EACL,eAAe;AAKf,wEAAwE;AACxE,yBAAyB,EACzB,0BAA0B;AAC1B,6FAA6F;AAC7F,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB;AAEjB,iGAAiG;AACjG,kBAAkB,EAClB,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,gCAAgC,EAChC,uBAAuB,EACvB,uBAAuB,EACvB,0BAA0B,GAW3B,MAAM,2BAA2B,CAAC;AAEnC,mFAAmF;AACnF,gFAAgF;AAChF,+EAA+E;AAC/E,mFAAmF;AACnF,QAAQ;AACR,EAAE;AACF,4CAA4C;AAC5C,2FAA2F;AAC3F,iFAAiF"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import type axe from 'axe-core';
|
|
2
|
+
import type { Violation } from '@memberjunction/react-linter';
|
|
3
|
+
/**
|
|
4
|
+
* Supported axe-core impact severity levels ordered from lowest to highest.
|
|
5
|
+
*/
|
|
6
|
+
export type AccessibilityImpact = 'minor' | 'moderate' | 'serious' | 'critical';
|
|
7
|
+
/**
|
|
8
|
+
* Default impact thresholds that cause {@link RunAccessibilityAudit} to fail.
|
|
9
|
+
*/
|
|
10
|
+
export declare const DEFAULT_FAIL_ON_IMPACTS: readonly AccessibilityImpact[];
|
|
11
|
+
/**
|
|
12
|
+
* Default WCAG rule-tag set applied when callers do not override `tags`.
|
|
13
|
+
*/
|
|
14
|
+
export declare const DEFAULT_ACCESSIBILITY_TAGS: readonly string[];
|
|
15
|
+
/**
|
|
16
|
+
* Simplified DOM node detail reported for an axe-core rule violation.
|
|
17
|
+
*/
|
|
18
|
+
export interface AccessibilityAuditNode {
|
|
19
|
+
html: string;
|
|
20
|
+
target: string[];
|
|
21
|
+
failureSummary?: string;
|
|
22
|
+
impact?: AccessibilityImpact | null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Normalized accessibility violation derived from axe-core results.
|
|
26
|
+
*/
|
|
27
|
+
export interface AccessibilityAuditViolation {
|
|
28
|
+
id: string;
|
|
29
|
+
impact: AccessibilityImpact | null;
|
|
30
|
+
description: string;
|
|
31
|
+
help: string;
|
|
32
|
+
helpUrl: string;
|
|
33
|
+
tags: string[];
|
|
34
|
+
nodes: AccessibilityAuditNode[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Aggregated counts for blocking/non-blocking violations, passes, and incomplete checks.
|
|
38
|
+
*/
|
|
39
|
+
export interface AccessibilityAuditCounts {
|
|
40
|
+
critical: number;
|
|
41
|
+
serious: number;
|
|
42
|
+
moderate: number;
|
|
43
|
+
minor: number;
|
|
44
|
+
unknownImpact: number;
|
|
45
|
+
totalViolations: number;
|
|
46
|
+
blockingViolations: number;
|
|
47
|
+
warningViolations: number;
|
|
48
|
+
passes: number;
|
|
49
|
+
incomplete: number;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Subset of axe-core result arrays consumed by {@link RunAccessibilityAudit}.
|
|
53
|
+
*/
|
|
54
|
+
export type AccessibilityAuditRawResults = Pick<axe.AxeResults, 'violations' | 'passes' | 'incomplete'>;
|
|
55
|
+
/**
|
|
56
|
+
* Minimal page evaluation driver satisfied by Playwright's `Page` and deterministic test doubles.
|
|
57
|
+
*/
|
|
58
|
+
export interface AccessibilityPageDriver {
|
|
59
|
+
evaluate<TArg, TResult>(pageFunction: (arg: TArg) => TResult | Promise<TResult>, arg: TArg): Promise<TResult>;
|
|
60
|
+
addScriptTag(options: {
|
|
61
|
+
content?: string;
|
|
62
|
+
path?: string;
|
|
63
|
+
}): Promise<object>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Normalized input passed into an {@link AccessibilityAuditRunner}.
|
|
67
|
+
*/
|
|
68
|
+
export interface AccessibilityAuditRunnerInput {
|
|
69
|
+
context?: axe.SerialContextObject;
|
|
70
|
+
runOptions: axe.RunOptions;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Custom runner hook allowing alternative axe-core transports or unit-test stubs.
|
|
74
|
+
*/
|
|
75
|
+
export type AccessibilityAuditRunner = (page: AccessibilityPageDriver, input: AccessibilityAuditRunnerInput) => Promise<AccessibilityAuditRawResults>;
|
|
76
|
+
/**
|
|
77
|
+
* Options controlling rule selection, scope, and pass/fail thresholds for {@link RunAccessibilityAudit}.
|
|
78
|
+
*/
|
|
79
|
+
export interface AccessibilityAuditOptions {
|
|
80
|
+
/** CSS selectors included in the audit scope. Defaults to the entire document. */
|
|
81
|
+
include?: string[];
|
|
82
|
+
/** CSS selectors excluded from the audit scope. */
|
|
83
|
+
exclude?: string[];
|
|
84
|
+
/** WCAG/axe tags evaluated (`wcag2a`, `wcag2aa`, etc.). Pass empty array to run all enabled rules. */
|
|
85
|
+
tags?: string[];
|
|
86
|
+
/** Specific axe rule IDs to disable. */
|
|
87
|
+
disabledRules?: string[];
|
|
88
|
+
/** Specific axe rule IDs to explicitly enable. */
|
|
89
|
+
enabledRules?: string[];
|
|
90
|
+
/** Impact severities considered blocking failures. Defaults to `['serious', 'critical']`. */
|
|
91
|
+
failOnImpacts?: readonly AccessibilityImpact[];
|
|
92
|
+
/** Throw {@link AccessibilityAuditError} immediately when blocking violations exist. Defaults to `false`. */
|
|
93
|
+
throwOnFailure?: boolean;
|
|
94
|
+
/** Optional runner override (primarily for deterministic offline unit tests). */
|
|
95
|
+
axeRunner?: AccessibilityAuditRunner;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Structured report returned by {@link RunAccessibilityAudit}.
|
|
99
|
+
*/
|
|
100
|
+
export interface AccessibilityAuditResult {
|
|
101
|
+
passed: boolean;
|
|
102
|
+
failOnImpacts: AccessibilityImpact[];
|
|
103
|
+
blockingViolations: AccessibilityAuditViolation[];
|
|
104
|
+
warningViolations: AccessibilityAuditViolation[];
|
|
105
|
+
allViolations: AccessibilityAuditViolation[];
|
|
106
|
+
passesCount: number;
|
|
107
|
+
incompleteCount: number;
|
|
108
|
+
counts: AccessibilityAuditCounts;
|
|
109
|
+
summary: string;
|
|
110
|
+
axeSourceResolved: boolean;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Error thrown by {@link RunAccessibilityAudit} when `throwOnFailure` is enabled and blocking violations exist.
|
|
114
|
+
*/
|
|
115
|
+
export declare class AccessibilityAuditError extends Error {
|
|
116
|
+
readonly result: AccessibilityAuditResult;
|
|
117
|
+
constructor(result: AccessibilityAuditResult);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Resolves the local filesystem path to the installed `axe-core` browser bundle (`axe.min.js` or `axe.js`).
|
|
121
|
+
*/
|
|
122
|
+
export declare function ResolveAxeCoreScriptPath(): string;
|
|
123
|
+
/**
|
|
124
|
+
* Runs a deterministic `axe-core` accessibility audit against a rendered browser page.
|
|
125
|
+
* Injects the bundled `axe-core` script offline when needed and classifies `'serious'`
|
|
126
|
+
* and `'critical'` violations as blocking failures by default.
|
|
127
|
+
*/
|
|
128
|
+
export declare function RunAccessibilityAudit(page: AccessibilityPageDriver, options?: AccessibilityAuditOptions): Promise<AccessibilityAuditResult>;
|
|
129
|
+
/**
|
|
130
|
+
* Converts blocking and non-blocking axe audit findings into standard test-harness {@link Violation} entries.
|
|
131
|
+
*/
|
|
132
|
+
export declare function ToHarnessAccessibilityViolations(audit: AccessibilityAuditResult): Violation[];
|
|
133
|
+
/**
|
|
134
|
+
* @deprecated Use {@link RunAccessibilityAudit}.
|
|
135
|
+
*/
|
|
136
|
+
export declare function runAccessibilityAudit(page: AccessibilityPageDriver, options?: AccessibilityAuditOptions): Promise<AccessibilityAuditResult>;
|
|
137
|
+
//# sourceMappingURL=accessibility-audit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accessibility-audit.d.ts","sourceRoot":"","sources":["../../src/lib/accessibility-audit.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAI9D;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,SAAS,mBAAmB,EAGjE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,EAAE,SAAS,MAAM,EAKvD,CAAC;AAWF;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,sBAAsB,EAAE,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,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@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
const _require = createRequire(import.meta.url);
|
|
5
|
+
/**
|
|
6
|
+
* Default impact thresholds that cause {@link RunAccessibilityAudit} to fail.
|
|
7
|
+
*/
|
|
8
|
+
export const DEFAULT_FAIL_ON_IMPACTS = [
|
|
9
|
+
'serious',
|
|
10
|
+
'critical',
|
|
11
|
+
];
|
|
12
|
+
/**
|
|
13
|
+
* Default WCAG rule-tag set applied when callers do not override `tags`.
|
|
14
|
+
*/
|
|
15
|
+
export const DEFAULT_ACCESSIBILITY_TAGS = [
|
|
16
|
+
'wcag2a',
|
|
17
|
+
'wcag2aa',
|
|
18
|
+
'wcag21a',
|
|
19
|
+
'wcag21aa',
|
|
20
|
+
];
|
|
21
|
+
const IMPACT_ORDER = {
|
|
22
|
+
critical: 0,
|
|
23
|
+
serious: 1,
|
|
24
|
+
moderate: 2,
|
|
25
|
+
minor: 3,
|
|
26
|
+
};
|
|
27
|
+
const UNKNOWN_IMPACT_RANK = 4; // Fallback sort rank after 'minor' (index 3)
|
|
28
|
+
/**
|
|
29
|
+
* Error thrown by {@link RunAccessibilityAudit} when `throwOnFailure` is enabled and blocking violations exist.
|
|
30
|
+
*/
|
|
31
|
+
export class AccessibilityAuditError extends Error {
|
|
32
|
+
constructor(result) {
|
|
33
|
+
super(result.summary);
|
|
34
|
+
this.name = 'AccessibilityAuditError';
|
|
35
|
+
this.result = result;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
let cachedAxeScriptSource = null;
|
|
39
|
+
/**
|
|
40
|
+
* Resolves the local filesystem path to the installed `axe-core` browser bundle (`axe.min.js` or `axe.js`).
|
|
41
|
+
*/
|
|
42
|
+
export function ResolveAxeCoreScriptPath() {
|
|
43
|
+
const pkgJsonPath = _require.resolve('axe-core/package.json');
|
|
44
|
+
const pkgDir = path.dirname(pkgJsonPath);
|
|
45
|
+
const minifiedPath = path.join(pkgDir, 'axe.min.js');
|
|
46
|
+
if (existsSync(minifiedPath)) {
|
|
47
|
+
return minifiedPath;
|
|
48
|
+
}
|
|
49
|
+
const unminifiedPath = path.join(pkgDir, 'axe.js');
|
|
50
|
+
if (existsSync(unminifiedPath)) {
|
|
51
|
+
return unminifiedPath;
|
|
52
|
+
}
|
|
53
|
+
throw new Error(`Unable to locate axe.min.js or axe.js inside ${pkgDir}`);
|
|
54
|
+
}
|
|
55
|
+
function loadAxeCoreScriptSource() {
|
|
56
|
+
if (cachedAxeScriptSource === null) {
|
|
57
|
+
const scriptPath = ResolveAxeCoreScriptPath();
|
|
58
|
+
cachedAxeScriptSource = readFileSync(scriptPath, 'utf-8');
|
|
59
|
+
}
|
|
60
|
+
return cachedAxeScriptSource;
|
|
61
|
+
}
|
|
62
|
+
function buildAxeContext(options) {
|
|
63
|
+
const include = options.include?.filter((selector) => selector.trim().length > 0);
|
|
64
|
+
const exclude = options.exclude?.filter((selector) => selector.trim().length > 0);
|
|
65
|
+
if (include && include.length > 0 && exclude && exclude.length > 0) {
|
|
66
|
+
return { include, exclude };
|
|
67
|
+
}
|
|
68
|
+
if (include && include.length > 0) {
|
|
69
|
+
return { include };
|
|
70
|
+
}
|
|
71
|
+
if (exclude && exclude.length > 0) {
|
|
72
|
+
return { exclude };
|
|
73
|
+
}
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
function buildAxeRunOptions(options) {
|
|
77
|
+
const runOptions = {
|
|
78
|
+
resultTypes: ['violations', 'passes', 'incomplete'],
|
|
79
|
+
};
|
|
80
|
+
const tags = options.tags === undefined ? [...DEFAULT_ACCESSIBILITY_TAGS] : options.tags;
|
|
81
|
+
if (tags.length > 0) {
|
|
82
|
+
runOptions.runOnly = {
|
|
83
|
+
type: 'tag',
|
|
84
|
+
values: [...tags],
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const rules = {};
|
|
88
|
+
for (const ruleId of options.enabledRules ?? []) {
|
|
89
|
+
if (ruleId.trim().length > 0) {
|
|
90
|
+
rules[ruleId] = { enabled: true };
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
for (const ruleId of options.disabledRules ?? []) {
|
|
94
|
+
if (ruleId.trim().length > 0) {
|
|
95
|
+
rules[ruleId] = { enabled: false };
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (Object.keys(rules).length > 0) {
|
|
99
|
+
runOptions.rules = rules;
|
|
100
|
+
}
|
|
101
|
+
return runOptions;
|
|
102
|
+
}
|
|
103
|
+
function normalizeImpact(impact) {
|
|
104
|
+
switch (impact) {
|
|
105
|
+
case 'critical':
|
|
106
|
+
case 'serious':
|
|
107
|
+
case 'moderate':
|
|
108
|
+
case 'minor':
|
|
109
|
+
return impact;
|
|
110
|
+
default:
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function impactRank(impact) {
|
|
115
|
+
return impact === null ? UNKNOWN_IMPACT_RANK : IMPACT_ORDER[impact];
|
|
116
|
+
}
|
|
117
|
+
function formatTargetSelector(target) {
|
|
118
|
+
return target.map((item) => (Array.isArray(item) ? item.join(' ') : item));
|
|
119
|
+
}
|
|
120
|
+
function normalizeViolation(violation) {
|
|
121
|
+
const nodes = violation.nodes.map((node) => ({
|
|
122
|
+
html: node.html,
|
|
123
|
+
target: formatTargetSelector(node.target),
|
|
124
|
+
failureSummary: node.failureSummary,
|
|
125
|
+
impact: normalizeImpact(node.impact),
|
|
126
|
+
}));
|
|
127
|
+
return {
|
|
128
|
+
id: violation.id,
|
|
129
|
+
impact: normalizeImpact(violation.impact),
|
|
130
|
+
description: violation.description,
|
|
131
|
+
help: violation.help,
|
|
132
|
+
helpUrl: violation.helpUrl,
|
|
133
|
+
tags: [...violation.tags],
|
|
134
|
+
nodes,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function compareViolations(a, b) {
|
|
138
|
+
const rankDiff = impactRank(a.impact) - impactRank(b.impact);
|
|
139
|
+
if (rankDiff !== 0) {
|
|
140
|
+
return rankDiff;
|
|
141
|
+
}
|
|
142
|
+
return a.id.localeCompare(b.id);
|
|
143
|
+
}
|
|
144
|
+
const defaultAxeRunner = async (page, input) => {
|
|
145
|
+
const hasAxe = await page.evaluate((_unused) => typeof window.axe?.run === 'function', null);
|
|
146
|
+
if (!hasAxe) {
|
|
147
|
+
const scriptSource = loadAxeCoreScriptSource();
|
|
148
|
+
await page.addScriptTag({ content: scriptSource });
|
|
149
|
+
}
|
|
150
|
+
return page.evaluate(async (payload) => {
|
|
151
|
+
const axeGlobal = window.axe;
|
|
152
|
+
if (!axeGlobal) {
|
|
153
|
+
throw new Error('axe-core failed to initialize inside the target browser page.');
|
|
154
|
+
}
|
|
155
|
+
const results = payload.context
|
|
156
|
+
? await axeGlobal.run(payload.context, payload.runOptions)
|
|
157
|
+
: await axeGlobal.run(document, payload.runOptions);
|
|
158
|
+
return {
|
|
159
|
+
violations: results.violations,
|
|
160
|
+
passes: results.passes,
|
|
161
|
+
incomplete: results.incomplete,
|
|
162
|
+
};
|
|
163
|
+
}, input);
|
|
164
|
+
};
|
|
165
|
+
function buildSummary(passed, blockingViolations, warningViolations, passesCount) {
|
|
166
|
+
if (passed && warningViolations.length === 0) {
|
|
167
|
+
return `Accessibility audit passed (${passesCount} rule passes, 0 violations).`;
|
|
168
|
+
}
|
|
169
|
+
if (passed) {
|
|
170
|
+
const warnIds = warningViolations.map((v) => `${v.id}(${v.impact ?? 'unknown'})`).join(', ');
|
|
171
|
+
return `Accessibility audit passed with ${warningViolations.length} non-blocking violation(s): ${warnIds}.`;
|
|
172
|
+
}
|
|
173
|
+
const blockDetails = blockingViolations
|
|
174
|
+
.map((v) => {
|
|
175
|
+
const firstTarget = v.nodes[0]?.target.join(', ') || 'document';
|
|
176
|
+
return `${v.id}[${v.impact ?? 'unknown'}] @ ${firstTarget}`;
|
|
177
|
+
})
|
|
178
|
+
.join('; ');
|
|
179
|
+
return `Accessibility audit failed with ${blockingViolations.length} blocking violation(s): ${blockDetails}`;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Runs a deterministic `axe-core` accessibility audit against a rendered browser page.
|
|
183
|
+
* Injects the bundled `axe-core` script offline when needed and classifies `'serious'`
|
|
184
|
+
* and `'critical'` violations as blocking failures by default.
|
|
185
|
+
*/
|
|
186
|
+
export async function RunAccessibilityAudit(page, options = {}) {
|
|
187
|
+
const failOnImpacts = options.failOnImpacts && options.failOnImpacts.length > 0
|
|
188
|
+
? [...options.failOnImpacts]
|
|
189
|
+
: [...DEFAULT_FAIL_ON_IMPACTS];
|
|
190
|
+
const failOnSet = new Set(failOnImpacts);
|
|
191
|
+
let axeSourceResolved = false;
|
|
192
|
+
try {
|
|
193
|
+
axeSourceResolved = ResolveAxeCoreScriptPath().length > 0;
|
|
194
|
+
}
|
|
195
|
+
catch {
|
|
196
|
+
axeSourceResolved = false;
|
|
197
|
+
}
|
|
198
|
+
const runnerInput = {
|
|
199
|
+
context: buildAxeContext(options),
|
|
200
|
+
runOptions: buildAxeRunOptions(options),
|
|
201
|
+
};
|
|
202
|
+
const runner = options.axeRunner ?? defaultAxeRunner;
|
|
203
|
+
const rawResults = await runner(page, runnerInput);
|
|
204
|
+
const normalized = rawResults.violations.map(normalizeViolation).sort(compareViolations);
|
|
205
|
+
const blockingViolations = [];
|
|
206
|
+
const warningViolations = [];
|
|
207
|
+
let critical = 0;
|
|
208
|
+
let serious = 0;
|
|
209
|
+
let moderate = 0;
|
|
210
|
+
let minor = 0;
|
|
211
|
+
let unknownImpact = 0;
|
|
212
|
+
for (const violation of normalized) {
|
|
213
|
+
switch (violation.impact) {
|
|
214
|
+
case 'critical':
|
|
215
|
+
critical++;
|
|
216
|
+
break;
|
|
217
|
+
case 'serious':
|
|
218
|
+
serious++;
|
|
219
|
+
break;
|
|
220
|
+
case 'moderate':
|
|
221
|
+
moderate++;
|
|
222
|
+
break;
|
|
223
|
+
case 'minor':
|
|
224
|
+
minor++;
|
|
225
|
+
break;
|
|
226
|
+
default:
|
|
227
|
+
unknownImpact++;
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
if (violation.impact !== null && failOnSet.has(violation.impact)) {
|
|
231
|
+
blockingViolations.push(violation);
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
warningViolations.push(violation);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
const passesCount = rawResults.passes.length;
|
|
238
|
+
const incompleteCount = rawResults.incomplete.length;
|
|
239
|
+
const passed = blockingViolations.length === 0;
|
|
240
|
+
const counts = {
|
|
241
|
+
critical,
|
|
242
|
+
serious,
|
|
243
|
+
moderate,
|
|
244
|
+
minor,
|
|
245
|
+
unknownImpact,
|
|
246
|
+
totalViolations: normalized.length,
|
|
247
|
+
blockingViolations: blockingViolations.length,
|
|
248
|
+
warningViolations: warningViolations.length,
|
|
249
|
+
passes: passesCount,
|
|
250
|
+
incomplete: incompleteCount,
|
|
251
|
+
};
|
|
252
|
+
const result = {
|
|
253
|
+
passed,
|
|
254
|
+
failOnImpacts,
|
|
255
|
+
blockingViolations,
|
|
256
|
+
warningViolations,
|
|
257
|
+
allViolations: normalized,
|
|
258
|
+
passesCount,
|
|
259
|
+
incompleteCount,
|
|
260
|
+
counts,
|
|
261
|
+
summary: buildSummary(passed, blockingViolations, warningViolations, passesCount),
|
|
262
|
+
axeSourceResolved,
|
|
263
|
+
};
|
|
264
|
+
if (!passed && options.throwOnFailure) {
|
|
265
|
+
throw new AccessibilityAuditError(result);
|
|
266
|
+
}
|
|
267
|
+
return result;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Converts blocking and non-blocking axe audit findings into standard test-harness {@link Violation} entries.
|
|
271
|
+
*/
|
|
272
|
+
export function ToHarnessAccessibilityViolations(audit) {
|
|
273
|
+
return audit.allViolations.map((violation) => {
|
|
274
|
+
const severity = violation.impact === 'critical'
|
|
275
|
+
? 'critical'
|
|
276
|
+
: violation.impact === 'serious'
|
|
277
|
+
? 'high'
|
|
278
|
+
: violation.impact === 'moderate'
|
|
279
|
+
? 'medium'
|
|
280
|
+
: 'low';
|
|
281
|
+
const firstNode = violation.nodes[0];
|
|
282
|
+
const targetSuffix = firstNode?.target.length
|
|
283
|
+
? ` (selector: ${firstNode.target.join(', ')})`
|
|
284
|
+
: '';
|
|
285
|
+
return {
|
|
286
|
+
rule: `a11y/${violation.id}`,
|
|
287
|
+
severity,
|
|
288
|
+
message: `${violation.help}${targetSuffix} — ${violation.helpUrl}`,
|
|
289
|
+
line: 0,
|
|
290
|
+
column: 0,
|
|
291
|
+
source: 'test-harness',
|
|
292
|
+
};
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* @deprecated Use {@link RunAccessibilityAudit}.
|
|
297
|
+
*/
|
|
298
|
+
export function runAccessibilityAudit(page, options = {}) {
|
|
299
|
+
return RunAccessibilityAudit(page, options);
|
|
300
|
+
}
|
|
301
|
+
//# sourceMappingURL=accessibility-audit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accessibility-audit.js","sourceRoot":"","sources":["../../src/lib/accessibility-audit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAIlC,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAOhD;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAmC;IACrE,SAAS;IACT,UAAU;CACX,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAsB;IAC3D,QAAQ;IACR,SAAS;IACT,SAAS;IACT,UAAU;CACX,CAAC;AAEF,MAAM,YAAY,GAAkD;IAClE,QAAQ,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CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;YAC/C,CAAC,CAAC,EAAE,CAAC;QACP,OAAO;YACL,IAAI,EAAE,QAAQ,SAAS,CAAC,EAAE,EAAE;YAC5B,QAAQ;YACR,OAAO,EAAE,GAAG,SAAS,CAAC,IAAI,GAAG,YAAY,MAAM,SAAS,CAAC,OAAO,EAAE;YAClE,IAAI,EAAE,CAAC;YACP,MAAM,EAAE,CAAC;YACT,MAAM,EAAE,cAAc;SACvB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACnC,IAA6B,EAC7B,UAAqC,EAAE;IAEvC,OAAO,qBAAqB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Page } from 'playwright';
|
|
2
|
+
import { NetworkAccessMode } from './network-policy.js';
|
|
2
3
|
export interface BrowserContextOptions {
|
|
3
4
|
headless?: boolean;
|
|
4
5
|
viewport?: {
|
|
@@ -35,8 +36,27 @@ export interface BrowserContextOptions {
|
|
|
35
36
|
* Note: this breaks per-test isolation — parallel harness instances would share
|
|
36
37
|
* one context. Viewport/locale/userAgent options are ignored when reusing a
|
|
37
38
|
* context (they only apply to contexts the harness creates).
|
|
39
|
+
*
|
|
40
|
+
* A reused context is NOT a network sandbox: only the pages the harness opens are routed,
|
|
41
|
+
* and the context gets neither the allowlisting proxy nor the context-wide route, because
|
|
42
|
+
* both would filter the user's own tabs. A popup a component opens is not routed at all.
|
|
43
|
+
* Use it for debugging trusted components only, never for generated code.
|
|
38
44
|
*/
|
|
39
45
|
reuseExistingContext?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* What the test page may reach on the network. Defaults to `'allowlist'`: only the origins of
|
|
48
|
+
* the runtime and component-library CDN URLs (fallbacks included), plus `allowedNetworkHosts`.
|
|
49
|
+
* Requests anywhere else are aborted and reported, WebSockets are closed, service workers are
|
|
50
|
+
* blocked, WebRTC is removed, and a context the harness creates sends its traffic through an
|
|
51
|
+
* allowlisting proxy that refuses what routing never sees. `'unrestricted'` turns all of it off;
|
|
52
|
+
* use it only for local debugging, never for generated code.
|
|
53
|
+
*/
|
|
54
|
+
networkAccess?: NetworkAccessMode;
|
|
55
|
+
/**
|
|
56
|
+
* Extra hosts the test page may reach. A URL allows its origin only; a bare host name allows
|
|
57
|
+
* that host on any port, and 'host:port' that port only.
|
|
58
|
+
*/
|
|
59
|
+
allowedNetworkHosts?: string[];
|
|
40
60
|
}
|
|
41
61
|
/**
|
|
42
62
|
* Decide whether a connect endpoint refers to a CDP browser or a Playwright server.
|
|
@@ -54,9 +74,53 @@ export declare class BrowserManager {
|
|
|
54
74
|
private connected;
|
|
55
75
|
/** True when WE created the context (so close() is allowed to close it). */
|
|
56
76
|
private ownsContext;
|
|
77
|
+
/** Hosts the test page may reach, shared by every page this manager opens. */
|
|
78
|
+
private readonly network;
|
|
79
|
+
/** The requests each page tried that the allowlist refused, as redacted URLs. */
|
|
80
|
+
private readonly blockedByPage;
|
|
81
|
+
/** Origins one page alone may reach, such as the URL {@link NavigateTo} was asked to open. */
|
|
82
|
+
private readonly allowedByPage;
|
|
83
|
+
/**
|
|
84
|
+
* Every origin any page alone was allowed. The proxy cannot tell pages apart, so it allows these
|
|
85
|
+
* for all of them; routing still keeps each to its own page.
|
|
86
|
+
*/
|
|
87
|
+
private readonly allowedForSomePage;
|
|
88
|
+
/** The allowlisting proxy of a context the harness created, while it is open. */
|
|
89
|
+
private proxy;
|
|
57
90
|
constructor(options?: BrowserContextOptions);
|
|
91
|
+
/** True unless the caller turned the network filter off. */
|
|
92
|
+
private get filtersNetwork();
|
|
93
|
+
/** Let the test page reach the host of each URL (runtime and library CDN URLs). */
|
|
94
|
+
AllowNetworkUrls(urls: readonly string[]): void;
|
|
95
|
+
/** Let `page` alone reach the origin of each URL; other pages keep the shared allowlist. */
|
|
96
|
+
AllowNetworkUrlsForPage(page: Page, urls: readonly string[]): void;
|
|
97
|
+
/**
|
|
98
|
+
* The requests the proxy refused, oldest first, as origin + path. These bypassed request routing
|
|
99
|
+
* (a Speculation Rules prefetch, a WebRTC TURN connection), so no page is known for them, and
|
|
100
|
+
* they can include the browser's own background traffic.
|
|
101
|
+
*/
|
|
102
|
+
GetProxyBlockedRequests(): string[];
|
|
103
|
+
/** The requests `page` tried that were blocked, as origin + path (query strings dropped). */
|
|
104
|
+
GetBlockedRequests(page: Page): string[];
|
|
105
|
+
/** Creates a context the harness owns: with the filter on, its traffic goes through the proxy. */
|
|
106
|
+
private createContext;
|
|
58
107
|
/** Options applied when the harness creates its own browser context. */
|
|
59
108
|
private contextOptions;
|
|
109
|
+
/**
|
|
110
|
+
* Context-wide guards for a context the harness created: the WebRTC script reaches every page
|
|
111
|
+
* in it, popups included, and the route catches requests no page route sees. Never installed on
|
|
112
|
+
* a reused external context, where they would act on the user's own tabs.
|
|
113
|
+
*/
|
|
114
|
+
private guardContext;
|
|
115
|
+
/** Opens a page whose requests go through the allowlist, recording what it refuses. */
|
|
116
|
+
private openPage;
|
|
117
|
+
/**
|
|
118
|
+
* Lets an allowed request through and aborts any other, recording it for the page it came from.
|
|
119
|
+
* The context-wide route passes no page, so it looks the page up from the request's frame.
|
|
120
|
+
*/
|
|
121
|
+
private routeRequest;
|
|
122
|
+
/** The harness page a request came from, or null for a request no harness page owns. */
|
|
123
|
+
private harnessPageOf;
|
|
60
124
|
/** Resolve whether to reuse the existing context (option → env-var fallback). */
|
|
61
125
|
private shouldReuseExistingContext;
|
|
62
126
|
Initialize(): Promise<void>;
|
|
@@ -65,7 +129,13 @@ export declare class BrowserManager {
|
|
|
65
129
|
GetPage(): Promise<Page>;
|
|
66
130
|
/** @deprecated Use {@link GetPage}. */
|
|
67
131
|
getPage(): Promise<Page>;
|
|
132
|
+
/** Opens a fresh page at `url`. The page alone may reach that URL's origin. */
|
|
68
133
|
NavigateTo(url: string): Promise<void>;
|
|
134
|
+
/**
|
|
135
|
+
* Closes a page from {@link GetPage}. Its routes are removed first, so a request still paused
|
|
136
|
+
* in them is dropped rather than failing once the page is gone.
|
|
137
|
+
*/
|
|
138
|
+
ClosePage(page: Page): Promise<void>;
|
|
69
139
|
/** @deprecated Use {@link NavigateTo}. */
|
|
70
140
|
navigateTo(url: string): Promise<void>;
|
|
71
141
|
EvaluateInPage<T>(fn: (...args: any[]) => T, ...args: any[]): Promise<T>;
|