@axe-core/watcher
Advanced tools
Comparing version 3.16.0 to 3.17.0-rc.0ab6db97
@@ -11,3 +11,3 @@ import type { Debugger } from 'debug'; | ||
constructor({ debugLoggerName }: ControllerParams); | ||
start(): Promise<void>; | ||
start(): void; | ||
stop(): Promise<void>; | ||
@@ -14,0 +14,0 @@ analyze({ __Method, __UserRequestedAnalyze }?: { |
@@ -6,3 +6,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const updateAutoAnalyze_1 = __importDefault(require("./utils/updateAutoAnalyze")); | ||
const sendResultsToServer_1 = __importDefault(require("./sendResultsToServer")); | ||
@@ -15,40 +14,35 @@ const createDebugger_1 = __importDefault(require("./createDebugger")); | ||
} | ||
async start() { | ||
(0, updateAutoAnalyze_1.default)(true); | ||
start() { | ||
this.debugLogger(`Start: Invoked`); | ||
this.isStopped = false; | ||
await this.executeScript(() => { | ||
if (!['http:', 'https:', 'file:'].includes(window.location.protocol)) { | ||
return Promise.resolve(); | ||
} | ||
return new Promise(resolve => { | ||
const fn = () => { | ||
window.removeEventListener('axe:start-auto-mode-done', fn); | ||
resolve(); | ||
}; | ||
window.addEventListener('axe:start-auto-mode-done', fn); | ||
const event = new CustomEvent('axe:start-auto-mode'); | ||
window.dispatchEvent(event); | ||
}); | ||
}); | ||
} | ||
async stop() { | ||
(0, updateAutoAnalyze_1.default)(false); | ||
this.isStopped = true; | ||
await this.executeScript(() => { | ||
this.debugLogger(`Stop: Invoked (${this.isStopped ? 'not analyzing' : 'may analyze implicitly'})`); | ||
if (this.isStopped) { | ||
return; | ||
} | ||
const result = await this.executeScript(() => { | ||
if (!['http:', 'https:', 'file:'].includes(window.location.protocol)) { | ||
return Promise.resolve(); | ||
return Promise.resolve({ message: 'Skipped - Invalid protocol' }); | ||
} | ||
return new Promise(resolve => { | ||
const fn = () => { | ||
window.removeEventListener('axe:stop-auto-mode-done', fn); | ||
resolve(); | ||
const fn = (event) => { | ||
window.removeEventListener('axe:manual-mode-analyze-done', fn); | ||
resolve(event.detail); | ||
}; | ||
window.addEventListener('axe:stop-auto-mode-done', fn); | ||
const event = new CustomEvent('axe:stop-auto-mode'); | ||
window.addEventListener('axe:manual-mode-analyze-done', fn); | ||
const event = new CustomEvent('axe:manual-mode-analyze', { | ||
detail: { userRequestedAnalyze: false } | ||
}); | ||
window.dispatchEvent(event); | ||
}); | ||
}); | ||
this.debugLogger(`Stop: ${result.message}`); | ||
this.isStopped = true; | ||
} | ||
async analyze({ __Method, __UserRequestedAnalyze = true } = {}) { | ||
this.debugLogger(`Analyze: Invoked${__Method ? ` - ${__Method}` : ''}`); | ||
this.debugLogger(`Analyze: Invoked${__Method ? ` - ${__Method}` : ''}`, { | ||
isStopped: this.isStopped, | ||
__UserRequestedAnalyze | ||
}); | ||
if (this.isStopped && !__UserRequestedAnalyze) { | ||
@@ -61,3 +55,3 @@ this.debugLogger('Analyze: Skipped', { | ||
} | ||
const result = await this.executeScript((userRequestedAnalyze) => { | ||
const result = await this.executeScript(({ userRequestedAnalyze, isStopped }) => { | ||
if (!['http:', 'https:', 'file:'].includes(window.location.protocol)) { | ||
@@ -73,12 +67,15 @@ return Promise.resolve({ message: 'Skipped - Invalid protocol' }); | ||
const event = new CustomEvent('axe:manual-mode-analyze', { | ||
detail: { userRequestedAnalyze } | ||
detail: { userRequestedAnalyze, isStopped } | ||
}); | ||
window.dispatchEvent(event); | ||
}); | ||
}, __UserRequestedAnalyze); | ||
}, { | ||
userRequestedAnalyze: __UserRequestedAnalyze, | ||
isStopped: this.isStopped | ||
}); | ||
this.debugLogger(`Analyze: ${result.message}`); | ||
} | ||
async flush() { | ||
this.debugLogger('Flush: Invoked (may analyze implicitly)'); | ||
const results = await this.executeScript(() => { | ||
this.debugLogger(`Flush: Invoked (${this.isStopped ? 'auto-analysis stopped' : 'may analyze implicitly'})`); | ||
const results = await this.executeScript((isStopped) => { | ||
if (!['http:', 'https:', 'file:'].includes(window.location.protocol)) { | ||
@@ -99,6 +96,8 @@ return Promise.resolve([]); | ||
window.addEventListener('axe:flush-end', onFlushEnd); | ||
const event = new CustomEvent('axe:flush-start'); | ||
const event = new CustomEvent('axe:flush-start', { | ||
detail: { isStopped } | ||
}); | ||
window.dispatchEvent(event); | ||
}); | ||
}); | ||
}, this.isStopped); | ||
this.debugLogger(`Flush: Received ${results.length} results`); | ||
@@ -105,0 +104,0 @@ await (0, sendResultsToServer_1.default)({ |
import { type Configuration } from './utils/writeVariables'; | ||
export declare const cypressConfigRunFlag = "__AXE_WATCHER_CYPRESS_CONFIG_RUN"; | ||
export declare const cypressConfigAutoAnalyzeFlag = "__AXE_WATCHER_AUTO_ANALYZE"; | ||
/** | ||
@@ -3,0 +5,0 @@ * Create a Cypress config that uses the axe Watcher extension. |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.cypressConfig = void 0; | ||
exports.cypressConfig = exports.cypressConfigAutoAnalyzeFlag = exports.cypressConfigRunFlag = void 0; | ||
const sendResultsToServer_1 = __importDefault(require("./sendResultsToServer")); | ||
@@ -15,4 +15,6 @@ const EventForwarder_1 = __importDefault(require("./EventForwarder")); | ||
const createDebugger_1 = __importDefault(require("./createDebugger")); | ||
const checkUserArgs_1 = require("./utils/checkUserArgs"); | ||
const debugLogger = (0, createDebugger_1.default)('CypressController'); | ||
const cypressConfigRunFlag = '__AXE_WATCHER_CYPRESS_CONFIG_RUN'; | ||
exports.cypressConfigRunFlag = '__AXE_WATCHER_CYPRESS_CONFIG_RUN'; | ||
exports.cypressConfigAutoAnalyzeFlag = '__AXE_WATCHER_AUTO_ANALYZE'; | ||
const cypressConfig = (config) => { | ||
@@ -36,3 +38,3 @@ var _a; | ||
userConfig.e2e.env = Object.assign({}, userConfig.e2e.env, { | ||
[cypressConfigRunFlag]: true | ||
[exports.cypressConfigRunFlag]: true | ||
}); | ||
@@ -42,3 +44,3 @@ } | ||
userConfig.env = Object.assign({}, userConfig.env, { | ||
[cypressConfigRunFlag]: true | ||
[exports.cypressConfigRunFlag]: true | ||
}); | ||
@@ -51,2 +53,5 @@ } | ||
} | ||
userConfig.env = Object.assign({}, userConfig.env, { | ||
[exports.cypressConfigAutoAnalyzeFlag]: axe.autoAnalyze === undefined ? true : axe.autoAnalyze | ||
}); | ||
return { | ||
@@ -63,3 +68,3 @@ ...userConfig, | ||
userNodeEventConfig.env = Object.assign({}, userNodeEventConfig.env, { | ||
[cypressConfigRunFlag]: true | ||
[exports.cypressConfigRunFlag]: true | ||
}); | ||
@@ -93,2 +98,3 @@ } | ||
const existingArgs = launchOptions.args; | ||
(0, checkUserArgs_1.checkUserArgs)(existingArgs); | ||
launchOptions.args = (0, mergeChromeArgs_1.default)(existingArgs, { | ||
@@ -95,0 +101,0 @@ disableOtherExtensions: false |
@@ -5,3 +5,4 @@ "use strict"; | ||
const cypressConfigRunFlag = '__AXE_WATCHER_CYPRESS_CONFIG_RUN'; | ||
let isStopped = false; | ||
const cypressConfigAutoAnalyzeFlag = '__AXE_WATCHER_AUTO_ANALYZE'; | ||
let isStopped = !Cypress.env(cypressConfigAutoAnalyzeFlag); | ||
exports.WRAPPED_COMMANDS = [ | ||
@@ -79,3 +80,5 @@ 'blur', | ||
function axeWatcherFlushCommand() { | ||
logDebugAxeWatcher({ message: 'Flush: Invoked (may analyze implicitly)' }); | ||
logDebugAxeWatcher({ | ||
message: `Flush: Invoked (${isStopped ? 'will not' : 'may'} analyze implicitly)` | ||
}); | ||
cy.window().then(win => { | ||
@@ -97,3 +100,5 @@ if (!shouldAnalyzeLocation(win.location)) { | ||
win.addEventListener('axe:result', onAxeResult); | ||
const event = new CustomEvent('axe:flush-start'); | ||
const event = new CustomEvent('axe:flush-start', { | ||
detail: { isStopped } | ||
}); | ||
win.dispatchEvent(event); | ||
@@ -109,13 +114,25 @@ }).then(results => { | ||
}; | ||
function axeWatcherAnalyzeCommand({ __Method, __UserRequestedAnalyze = true } = {}) { | ||
function axeWatcherAnalyzeCommand(subject, { __Method, __UserRequestedAnalyze = true } = {}) { | ||
const userRequestedAnalyze = __UserRequestedAnalyze; | ||
const message = userRequestedAnalyze | ||
? 'User requested analysis' | ||
: `Invoked${__Method ? ` - ${__Method}` : ''}`; | ||
logDebugAxeWatcher({ | ||
message: `Analyze: Invoked${__Method ? ` - ${__Method}` : ''}` | ||
message: `Analyze: ${message}` | ||
}); | ||
const userRequestedAnalyze = __UserRequestedAnalyze; | ||
cy.window().then(win => { | ||
if (!shouldAnalyzeLocation(win.location)) { | ||
return Promise.resolve({ message: `Skipped - Invalid protocol` }); | ||
logDebugAxeWatcher({ | ||
message: `Analyze: Skipped - invalid protocol` | ||
}); | ||
return Promise.resolve({ | ||
message: `Skipped - Invalid protocol`, | ||
subject | ||
}); | ||
} | ||
if (isStopped && !userRequestedAnalyze) { | ||
return Promise.resolve({ message: `Skipped (Manual mode)` }); | ||
logDebugAxeWatcher({ | ||
message: `Analyze: Skipped - manual mode` | ||
}); | ||
return Promise.resolve({ message: `Skipped (Manual mode)`, subject }); | ||
} | ||
@@ -125,7 +142,7 @@ return new Promise(resolve => { | ||
win.removeEventListener('axe:manual-mode-analyze-done', fn); | ||
resolve(event.detail); | ||
resolve({ message: event.detail.message, subject }); | ||
}; | ||
win.addEventListener('axe:manual-mode-analyze-done', fn); | ||
const event = new CustomEvent('axe:manual-mode-analyze', { | ||
detail: { userRequestedAnalyze } | ||
detail: { userRequestedAnalyze, isCypress: true } | ||
}); | ||
@@ -135,38 +152,43 @@ win.dispatchEvent(event); | ||
logDebugAxeWatcher({ message: `Analyze: ${result === null || result === void 0 ? void 0 : result.message}` }); | ||
if (result === null || result === void 0 ? void 0 : result.subject) { | ||
return result.subject; | ||
} | ||
}); | ||
}); | ||
} | ||
function axeWatcherStartCommand() { | ||
cy.window().then(win => { | ||
if (!shouldAnalyzeLocation(win.location)) { | ||
return Promise.resolve(); | ||
} | ||
return new Promise(resolve => { | ||
const fn = () => { | ||
win.removeEventListener('axe:start-auto-mode-done', fn); | ||
resolve(); | ||
}; | ||
win.addEventListener('axe:start-auto-mode-done', fn); | ||
const event = new CustomEvent('axe:start-auto-mode'); | ||
win.dispatchEvent(event); | ||
}).then(() => { | ||
isStopped = false; | ||
}); | ||
function axeWatcherStartCommand(subject) { | ||
cy.window().then(() => { | ||
logDebugAxeWatcher({ message: `Start: Invoked` }); | ||
isStopped = false; | ||
return Promise.resolve(subject); | ||
}); | ||
} | ||
function axeWatcherStopCommand() { | ||
function axeWatcherStopCommand(subject) { | ||
logDebugAxeWatcher({ message: `Stop: Invoked` }); | ||
cy.window().then(win => { | ||
if (!shouldAnalyzeLocation(win.location)) { | ||
return Promise.resolve(); | ||
logDebugAxeWatcher({ | ||
message: `Stop: Skipped - invalid protocol` | ||
}); | ||
return Promise.resolve({ | ||
message: `Skipped - Invalid protocol`, | ||
subject | ||
}); | ||
} | ||
return new Promise(resolve => { | ||
const fn = () => { | ||
win.removeEventListener('axe:stop-auto-mode-done', fn); | ||
resolve(); | ||
const fn = (event) => { | ||
win.removeEventListener('axe:manual-mode-analyze-done', fn); | ||
resolve({ message: event.detail.message, subject }); | ||
}; | ||
win.addEventListener('axe:stop-auto-mode-done', fn); | ||
const event = new CustomEvent('axe:stop-auto-mode'); | ||
win.addEventListener('axe:manual-mode-analyze-done', fn); | ||
const event = new CustomEvent('axe:manual-mode-analyze', { | ||
detail: { isCypress: true } | ||
}); | ||
win.dispatchEvent(event); | ||
}).then(() => { | ||
}).then(result => { | ||
logDebugAxeWatcher({ message: `Stop: ${result === null || result === void 0 ? void 0 : result.message}` }); | ||
isStopped = true; | ||
if (result === null || result === void 0 ? void 0 : result.subject) { | ||
return result.subject; | ||
} | ||
}); | ||
@@ -176,11 +198,11 @@ }); | ||
if (!doesCypressCommandExist('axeAnalyze')) { | ||
Cypress.Commands.add('axeAnalyze', axeWatcherAnalyzeCommand); | ||
Cypress.Commands.add('axeWatcherAnalyze', { prevSubject: 'optional' }, axeWatcherAnalyzeCommand); | ||
} | ||
Cypress.Commands.add('axeFlush', axeWatcherFlushCommand); | ||
Cypress.Commands.add('axeStop', axeWatcherStopCommand); | ||
Cypress.Commands.add('axeStart', axeWatcherStartCommand); | ||
Cypress.Commands.add('axeWatcherAnalyze', axeWatcherAnalyzeCommand); | ||
Cypress.Commands.add('axeWatcherStart', axeWatcherStartCommand); | ||
Cypress.Commands.add('axeWatcherStop', axeWatcherStopCommand); | ||
Cypress.Commands.add('axeStop', { prevSubject: 'optional' }, axeWatcherStopCommand); | ||
Cypress.Commands.add('axeStart', { prevSubject: 'optional' }, axeWatcherStartCommand); | ||
Cypress.Commands.add('axeWatcherAnalyze', { prevSubject: 'optional' }, axeWatcherAnalyzeCommand); | ||
Cypress.Commands.add('axeWatcherStart', { prevSubject: 'optional' }, axeWatcherStartCommand); | ||
Cypress.Commands.add('axeWatcherStop', { prevSubject: 'optional' }, axeWatcherStopCommand); | ||
Cypress.Commands.add('axeWatcherFlush', axeWatcherFlushCommand); | ||
//# sourceMappingURL=cypressCommands.js.map |
@@ -6,3 +6,3 @@ /*! Copyright Deque 2021-2023 All Rights Reserved */ | ||
export { playwrightConfig, PlaywrightController, wrapPlaywright, wrapPlaywrightPage } from './playwright'; | ||
export { default as playwrightTest } from './playwrightTest'; | ||
export { default as playwrightTest, type PageWithAxeWatcher as PlaywrightTestPageWithAxeWatcher } from './playwrightTest'; | ||
export { cypressConfig } from './cypress'; |
@@ -14,3 +14,3 @@ import type { LaunchOptions, Page, BrowserContext } from 'playwright-core'; | ||
private driver; | ||
constructor(driver: Page); | ||
constructor(driver: Page, isStopped?: boolean); | ||
protected executeScript<T>(fn: string | (() => Promise<T>), ...args: unknown[]): Promise<T>; | ||
@@ -17,0 +17,0 @@ } |
@@ -12,5 +12,8 @@ "use strict"; | ||
const writeVariables_1 = __importDefault(require("./utils/writeVariables")); | ||
const checkUserArgs_1 = require("./utils/checkUserArgs"); | ||
const assertVariablesWereWritten_1 = require("./utils/assertVariablesWereWritten"); | ||
function playwrightConfig(opts) { | ||
const { axe, ...config } = opts; | ||
let { args = [] } = config; | ||
(0, checkUserArgs_1.checkUserArgs)(args); | ||
(0, writeVariables_1.default)(axe); | ||
@@ -29,5 +32,7 @@ if (config.headless) { | ||
class PlaywrightController extends Controller_1.default { | ||
constructor(driver) { | ||
constructor(driver, isStopped = false) { | ||
super({ debugLoggerName: 'PlaywrightController' }); | ||
(0, assertVariablesWereWritten_1.assertVariablesWereWritten)('Playwright', 'playwrightConfig()'); | ||
this.driver = driver; | ||
this.isStopped = isStopped; | ||
} | ||
@@ -34,0 +39,0 @@ async executeScript(fn, ...args) { |
@@ -1,4 +0,10 @@ | ||
import type { TestType, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, Expect } from '@playwright/test'; | ||
import { type Options } from './playwright'; | ||
type Test = TestType<PlaywrightTestArgs & PlaywrightTestOptions, PlaywrightWorkerArgs & PlaywrightWorkerOptions>; | ||
import type { TestType, Page, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, Expect } from '@playwright/test'; | ||
import { PlaywrightController, type Options } from './playwright'; | ||
export type PageWithAxeWatcher = Page & { | ||
axeWatcher: PlaywrightController; | ||
}; | ||
type Test = TestType<PlaywrightTestArgs & PlaywrightTestOptions & Fixtures, PlaywrightWorkerArgs & PlaywrightWorkerOptions>; | ||
type Fixtures = { | ||
page: PageWithAxeWatcher; | ||
}; | ||
interface ReturnValue { | ||
@@ -5,0 +11,0 @@ test: Test; |
@@ -9,2 +9,3 @@ "use strict"; | ||
const writeVariables_1 = __importDefault(require("./utils/writeVariables")); | ||
const checkUserArgs_1 = require("./utils/checkUserArgs"); | ||
const playwrightTest = (options) => { | ||
@@ -22,2 +23,4 @@ let controller = null; | ||
} | ||
const isStopped = typeof axe.autoAnalyze === 'undefined' ? false : !axe.autoAnalyze; | ||
(0, checkUserArgs_1.checkUserArgs)(config.args || []); | ||
(0, writeVariables_1.default)(axe); | ||
@@ -36,10 +39,12 @@ const test = base.extend({ | ||
page: async ({ page }, use) => { | ||
controller = new playwright_1.PlaywrightController(page); | ||
page = (0, playwright_1.wrapPlaywrightPage)(page, controller); | ||
controller = page.axeWatcher; | ||
if (!controller) { | ||
controller = new playwright_1.PlaywrightController(page, isStopped); | ||
page.axeWatcher = controller; | ||
page = (0, playwright_1.wrapPlaywrightPage)(page, controller); | ||
} | ||
await use(page); | ||
await controller.flush(); | ||
} | ||
}); | ||
test.afterEach(async () => { | ||
await (controller === null || controller === void 0 ? void 0 : controller.flush()); | ||
}); | ||
const expect = test.expect; | ||
@@ -46,0 +51,0 @@ return { test, expect }; |
@@ -12,4 +12,5 @@ import type { Browser, BrowserContext, ElementHandle, Frame, FrameLocator, JSHandle, Keyboard, Locator, Mouse, Page, Touchscreen } from 'playwright-core'; | ||
export declare const wrapJSHandle: (jsHandle: PossiblyWrapped<JSHandle>, controller: PlaywrightController) => JSHandle; | ||
export declare const wrapSmartHandle: (smartHandle: PossiblyWrapped<JSHandle | ElementHandle>, controller: PlaywrightController) => JSHandle | ElementHandle; | ||
export declare const wrapKeyboard: (keyboard: PossiblyWrapped<Keyboard>, controller: PlaywrightController) => Keyboard; | ||
export declare const wrapMouse: (mouse: PossiblyWrapped<Mouse>, controller: PlaywrightController) => Mouse; | ||
export declare const wrapTouchscreen: (touchscreen: PossiblyWrapped<Touchscreen>, controller: PlaywrightController) => Touchscreen; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.wrapTouchscreen = exports.wrapMouse = exports.wrapKeyboard = exports.wrapJSHandle = exports.wrapLocator = exports.wrapFrameLocator = exports.wrapFrame = exports.wrapElementHandle = exports.wrapPage = exports.wrapBrowser = exports.wrapBrowserContext = void 0; | ||
exports.wrapTouchscreen = exports.wrapMouse = exports.wrapKeyboard = exports.wrapSmartHandle = exports.wrapJSHandle = exports.wrapLocator = exports.wrapFrameLocator = exports.wrapFrame = exports.wrapElementHandle = exports.wrapPage = exports.wrapBrowser = exports.wrapBrowserContext = void 0; | ||
const proxyHandlers_1 = require("./utils/proxyHandlers"); | ||
@@ -100,2 +100,5 @@ const wrapBrowserContext = (browserContext, controller) => { | ||
}; | ||
case 'addScriptTag': | ||
case 'addStyleTag': | ||
return (0, proxyHandlers_1.proxiedGetFuncWithAnalyzeWrapped)(target, prop, controller); | ||
case 'waitForSelector': | ||
@@ -111,4 +114,2 @@ return async (...args) => { | ||
case '$eval': | ||
case 'addScriptTag': | ||
case 'addStyleTag': | ||
case 'bringToFront': | ||
@@ -149,3 +150,3 @@ case 'check': | ||
const handle = await target[prop](...args); | ||
return (0, exports.wrapJSHandle)(handle, controller); | ||
return (0, exports.wrapSmartHandle)(handle, controller); | ||
}; | ||
@@ -281,3 +282,3 @@ case 'frame': | ||
const el = await target.evaluateHandle(...args); | ||
return (0, exports.wrapJSHandle)(el, controller); | ||
return (0, exports.wrapSmartHandle)(el, controller); | ||
}; | ||
@@ -440,3 +441,3 @@ case 'childFrames': | ||
const handle = await target.evaluateHandle(...args); | ||
return (0, exports.wrapJSHandle)(handle, controller); | ||
return (0, exports.wrapSmartHandle)(handle, controller); | ||
}; | ||
@@ -499,3 +500,3 @@ case 'and': | ||
const handle = await target.evaluateHandle(...args); | ||
return (0, exports.wrapJSHandle)(handle, controller); | ||
return (0, exports.wrapSmartHandle)(handle, controller); | ||
}; | ||
@@ -511,2 +512,9 @@ default: | ||
exports.wrapJSHandle = wrapJSHandle; | ||
const wrapSmartHandle = (smartHandle, controller) => { | ||
if ('$' in smartHandle) { | ||
return (0, exports.wrapElementHandle)(smartHandle, controller); | ||
} | ||
return (0, exports.wrapJSHandle)(smartHandle, controller); | ||
}; | ||
exports.wrapSmartHandle = wrapSmartHandle; | ||
const wrapKeyboard = (keyboard, controller) => { | ||
@@ -513,0 +521,0 @@ if ((0, proxyHandlers_1.isWrapped)(keyboard)) { |
@@ -12,2 +12,4 @@ "use strict"; | ||
const writeVariables_1 = __importDefault(require("./utils/writeVariables")); | ||
const checkUserArgs_1 = require("./utils/checkUserArgs"); | ||
const assertVariablesWereWritten_1 = require("./utils/assertVariablesWereWritten"); | ||
function headlessNotSupportedError(config) { | ||
@@ -25,2 +27,3 @@ if (!(config === null || config === void 0 ? void 0 : config.headless) || config.headless === 'new') { | ||
let { args = [] } = config; | ||
(0, checkUserArgs_1.checkUserArgs)(args); | ||
(0, writeVariables_1.default)(axe); | ||
@@ -39,2 +42,3 @@ headlessNotSupportedError(config); | ||
super({ debugLoggerName: 'PuppeteerController' }); | ||
(0, assertVariablesWereWritten_1.assertVariablesWereWritten)('Puppeteer', 'puppeteerConfig()'); | ||
this.driver = driver; | ||
@@ -41,0 +45,0 @@ } |
import type Controller from '../Controller'; | ||
import { type PlaywrightController } from '../playwright'; | ||
declare const kWrapped: unique symbol; | ||
@@ -11,3 +12,4 @@ export type PossiblyWrapped<T> = T & { | ||
export declare const proxiedGetFuncWithAnalyze: <T>(target: T, prop: keyof T, controller: Controller) => (...args: unknown[]) => Promise<unknown>; | ||
export declare const proxiedGetFuncWithAnalyzeWrapped: <T>(target: T, prop: keyof T, controller: PlaywrightController) => (...args: unknown[]) => Promise<unknown>; | ||
export declare const proxiedGetWithoutAnalyze: <T>(target: T, prop: keyof T) => unknown; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.proxiedGetWithoutAnalyze = exports.proxiedGetFuncWithAnalyze = exports.markAsWrapped = exports.isWrapped = void 0; | ||
exports.proxiedGetWithoutAnalyze = exports.proxiedGetFuncWithAnalyzeWrapped = exports.proxiedGetFuncWithAnalyze = exports.markAsWrapped = exports.isWrapped = void 0; | ||
const playwrightWrapping_1 = require("../playwrightWrapping"); | ||
const kWrapped = Symbol('axe watcher wrapped'); | ||
@@ -29,2 +30,14 @@ const isWrapped = (o) => { | ||
exports.proxiedGetFuncWithAnalyze = proxiedGetFuncWithAnalyze; | ||
const proxiedGetFuncWithAnalyzeWrapped = (target, prop, controller) => async (...args) => { | ||
await controller.analyze({ | ||
__Method: prop, | ||
__UserRequestedAnalyze: false | ||
}); | ||
const result = await target[prop].call(target, ...args); | ||
if (!result) { | ||
return null; | ||
} | ||
return (0, playwrightWrapping_1.wrapElementHandle)(result, controller); | ||
}; | ||
exports.proxiedGetFuncWithAnalyzeWrapped = proxiedGetFuncWithAnalyzeWrapped; | ||
const proxiedGetWithoutAnalyze = (target, prop) => { | ||
@@ -31,0 +44,0 @@ const original = target[prop]; |
@@ -15,2 +15,4 @@ "use strict"; | ||
const mergeChromeArgs_1 = __importDefault(require("./utils/mergeChromeArgs")); | ||
const checkUserArgs_1 = require("./utils/checkUserArgs"); | ||
const assertVariablesWereWritten_1 = require("./utils/assertVariablesWereWritten"); | ||
const noop = () => { | ||
@@ -26,2 +28,3 @@ }; | ||
} | ||
(0, checkUserArgs_1.checkUserArgs)(args); | ||
return { | ||
@@ -62,2 +65,3 @@ ...options, | ||
} | ||
(0, checkUserArgs_1.checkUserArgs)(args); | ||
chromeOpts.args = (0, mergeChromeArgs_1.default)(args, { disableOtherExtensions: false }); | ||
@@ -89,2 +93,3 @@ const { onPrepare = noop, onComplete = noop } = config; | ||
super({ debugLoggerName: 'WdioController' }); | ||
(0, assertVariablesWereWritten_1.assertVariablesWereWritten)('WDIO', 'wdioConfig()'); | ||
this.driver = driver; | ||
@@ -91,0 +96,0 @@ } |
@@ -12,2 +12,4 @@ "use strict"; | ||
const mergeChromeArgs_1 = __importDefault(require("./utils/mergeChromeArgs")); | ||
const checkUserArgs_1 = require("./utils/checkUserArgs"); | ||
const assertVariablesWereWritten_1 = require("./utils/assertVariablesWereWritten"); | ||
var webdriverWrapping_1 = require("./webdriverWrapping"); | ||
@@ -22,2 +24,3 @@ Object.defineProperty(exports, "wrapWebdriver", { enumerable: true, get: function () { return webdriverWrapping_1.wrapDriver; } }); | ||
const existingArgs = (((_a = opts === null || opts === void 0 ? void 0 : opts.options_) === null || _a === void 0 ? void 0 : _a.args) || []); | ||
(0, checkUserArgs_1.checkUserArgs)(existingArgs); | ||
opts.options_.args = (0, mergeChromeArgs_1.default)(existingArgs, { | ||
@@ -34,2 +37,3 @@ disableOtherExtensions: false | ||
super({ debugLoggerName: 'WebdriverController' }); | ||
(0, assertVariablesWereWritten_1.assertVariablesWereWritten)('WebDriver', 'webdriverConfig()'); | ||
this.driver = driver; | ||
@@ -36,0 +40,0 @@ } |
@@ -1,2 +0,2 @@ | ||
/*! axe v4.10.0 | ||
/*! axe v4.10.1 | ||
* Copyright (c) 2015 - 2024 Deque Systems, Inc. | ||
@@ -3,0 +3,0 @@ * |
{ | ||
"name": "@axe-core/watcher", | ||
"version": "3.16.0", | ||
"version": "3.17.0-rc.0ab6db97", | ||
"description": "", | ||
@@ -28,3 +28,3 @@ "license": "UNLICENSED", | ||
"devDependencies": { | ||
"@deque/advanced-rule-recorder": "^1.23.0-next.c02eede3", | ||
"@deque/advanced-rule-recorder": "^1.24.0-next.3be02ec6", | ||
"@playwright/test": "^1.45.0", | ||
@@ -45,3 +45,3 @@ "@types/body-parser": "^1.19.2", | ||
"@wdio/types": "^9.0.4", | ||
"axe-core": "^4.10.0", | ||
"axe-core": "^4.10.1", | ||
"axe-test-fixtures": "github:dequelabs/axe-test-fixtures#v1", | ||
@@ -54,3 +54,3 @@ "body-parser": "^1.20.1", | ||
"express": "^4.18.2", | ||
"jsdom": "^24.0.0", | ||
"jsdom": "^25.0.1", | ||
"mocha": "^10.4.0", | ||
@@ -65,3 +65,3 @@ "morgan": "^1.10.0", | ||
"selenium-webdriver": "^4.11.1", | ||
"sinon": "^18.0.0", | ||
"sinon": "^19.0.2", | ||
"tempy": "1", | ||
@@ -72,2 +72,2 @@ "ts-node": "^10.9.1", | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2185284
99
3266
2