@axe-core/watcher 1.8.2 → 2.0.0-next.22e40cc8
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/dist/cypress.d.ts +0 -4
- package/dist/cypress.js +1 -58
- package/dist/cypress.js.map +1 -1
- package/dist/cypressCommands.d.ts +6 -0
- package/dist/cypressCommands.js +101 -21
- package/dist/cypressCommands.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/playwright.d.ts +6 -2
- package/dist/playwright.js +9 -2
- package/dist/playwright.js.map +1 -1
- package/dist/playwrightTest.d.ts +16 -0
- package/dist/playwrightTest.js +153 -0
- package/dist/playwrightTest.js.map +1 -0
- package/dist/playwrightWrapping.d.ts +20 -0
- package/dist/playwrightWrapping.js +867 -0
- package/dist/playwrightWrapping.js.map +1 -0
- package/extension/background.js +1 -1
- package/extension/content.js +1 -1
- package/extension/manifest.json +1 -1
- package/package.json +5 -4
package/dist/cypress.d.ts
CHANGED
|
@@ -6,7 +6,3 @@ import { Configuration } from './util';
|
|
|
6
6
|
* @param config Cypress config to extend
|
|
7
7
|
*/
|
|
8
8
|
export declare const cypressConfig: (config: Cypress.ConfigOptions & Configuration) => Cypress.ConfigOptions;
|
|
9
|
-
/** Methods we wrap on the provided `cy` instance. */
|
|
10
|
-
export declare const WRAPPED_METHODS: ReadonlyArray<keyof Cypress.cy>;
|
|
11
|
-
/** Wrap the given Cypress `cy` object, ensuring axe-core analysis is run after each command. */
|
|
12
|
-
export declare const wrapCy: (cy: Cypress.cy) => Cypress.cy;
|
package/dist/cypress.js
CHANGED
|
@@ -31,7 +31,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
31
31
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
32
32
|
};
|
|
33
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
-
exports.
|
|
34
|
+
exports.cypressConfig = void 0;
|
|
35
35
|
var uuid_1 = require("uuid");
|
|
36
36
|
var util_1 = require("./util");
|
|
37
37
|
/**
|
|
@@ -78,61 +78,4 @@ var cypressConfig = function (config) {
|
|
|
78
78
|
} }) });
|
|
79
79
|
};
|
|
80
80
|
exports.cypressConfig = cypressConfig;
|
|
81
|
-
/** Methods we wrap on the provided `cy` instance. */
|
|
82
|
-
exports.WRAPPED_METHODS = [
|
|
83
|
-
'blur',
|
|
84
|
-
'check',
|
|
85
|
-
'clear',
|
|
86
|
-
'click',
|
|
87
|
-
'dblclick',
|
|
88
|
-
'focus',
|
|
89
|
-
'get',
|
|
90
|
-
'go',
|
|
91
|
-
'invoke',
|
|
92
|
-
'reload',
|
|
93
|
-
'scrollIntoView',
|
|
94
|
-
'scrollTo',
|
|
95
|
-
'select',
|
|
96
|
-
'submit',
|
|
97
|
-
'trigger',
|
|
98
|
-
'type',
|
|
99
|
-
'uncheck',
|
|
100
|
-
'visit',
|
|
101
|
-
'wait'
|
|
102
|
-
];
|
|
103
|
-
/** Wrap the given Cypress `cy` object, ensuring axe-core analysis is run after each command. */
|
|
104
|
-
var wrapCy = function (cy) {
|
|
105
|
-
// We cannot wrap the `cy` instance itself, but instead, wrap its prototype.
|
|
106
|
-
// We don't have access to the $Chainer prototype, so use the returned value from `cy.wrap('')`.
|
|
107
|
-
var proto = Object.getPrototypeOf(cy.wrap(''));
|
|
108
|
-
var _loop_1 = function (method) {
|
|
109
|
-
var old = proto[method];
|
|
110
|
-
proto[method] = function () {
|
|
111
|
-
var _this = this;
|
|
112
|
-
var params = [];
|
|
113
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
114
|
-
params[_i] = arguments[_i];
|
|
115
|
-
}
|
|
116
|
-
return old.apply(this, params).then(function ($element) {
|
|
117
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
118
|
-
_this.window().then(function (win) {
|
|
119
|
-
if (win && !win.__AXE_WATCHER_HAS_VISITED) {
|
|
120
|
-
/**
|
|
121
|
-
* Set a flag on the Window to indicate that a wrapped method has been called.
|
|
122
|
-
* This is used to determine whether we should call `axeFlush` after the test.
|
|
123
|
-
*/
|
|
124
|
-
win.__AXE_WATCHER_HAS_VISITED = true;
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
return _this.axeAnalyze({ __UserRequestedAnalyze: false }).then(function () { return $element; });
|
|
128
|
-
});
|
|
129
|
-
};
|
|
130
|
-
};
|
|
131
|
-
for (var _i = 0, WRAPPED_METHODS_1 = exports.WRAPPED_METHODS; _i < WRAPPED_METHODS_1.length; _i++) {
|
|
132
|
-
var method = WRAPPED_METHODS_1[_i];
|
|
133
|
-
_loop_1(method);
|
|
134
|
-
}
|
|
135
|
-
return cy;
|
|
136
|
-
};
|
|
137
|
-
exports.wrapCy = wrapCy;
|
|
138
81
|
//# sourceMappingURL=cypress.js.map
|
package/dist/cypress.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cypress.js","sourceRoot":"","sources":["../src/cypress.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6BAAiC;AACjC,+BAMe;AAEf;;;;GAIG;AAEI,IAAM,aAAa,GAAG,UAC3B,MAA6C;IAErC,IAAA,GAAG,GAAoB,MAAM,IAA1B,EAAK,UAAU,UAAK,MAAM,EAA/B,OAAsB,CAAF,CAAW;IAErC,IAAA,qBAAc,wBACT,GAAG;QACN,+CAA+C;QAC/C,kFAAkF;QAClF,SAAS,EAAE,GAAG,CAAC,SAAS,IAAI,IAAA,SAAI,GAAE;QAClC,sDAAsD;QACtD,OAAO,EAAE,IAAI,IACb,CAAA;IACF,IAAA,oBAAa,EAAC;QACZ,UAAU,EAAE,IAAI;QAChB,aAAa,EAAE;YACb,0BAA0B;YAC1B,4BAA4B;YAC5B,4BAA4B;YAC5B,uBAAuB;SACxB;KACF,CAAC,CAAA;IAEF,6BACK,UAAU,KACb,GAAG,wBACE,UAAU,CAAC,GAAG,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AG,wBACE,UAAU,CAAC,GAAG,KACjB,eAAe,YAAC,EAAE;;gBAAE,cAAO;qBAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;oBAAP,6BAAO;;gBACzB,MAAA,MAAA,UAAU,CAAC,GAAG,0CAAE,eAAe,4EAAG,EAAE,GAAK,IAAI,SAAC,CAAA;gBAE9C,EAAE,CAAC,uBAAuB,EAAE,UAAC,OAAO,EAAE,aAAa;;oBACjD,0BAA0B;oBAC1B,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE;wBAC7B,IAAI,OAAO,CAAC,UAAU,EAAE;4BACtB,MAAM,IAAI,gCAAyB,EAAE,CAAA;yBACtC;wBAED,sBAAsB;wBACtB,CAAA,KAAA,aAAa,CAAC,IAAI,CAAA,CAAC,IAAI,WAAI,oBAAa,EAAC;qBAC1C;oBAED,OAAO,aAAa,CAAA;gBACtB,CAAC,CAAC,CAAA;YACJ,CAAC,OAEJ;AACH,CAAC,CAAA;AA9CY,QAAA,aAAa,iBA8CzB"}
|
|
@@ -14,6 +14,12 @@ declare global {
|
|
|
14
14
|
axeStart(): Chainable<void>;
|
|
15
15
|
/** Stop automatic analysis mode. */
|
|
16
16
|
axeStop(): Chainable<void>;
|
|
17
|
+
/** Access Cypress internal state */
|
|
18
|
+
state(state: any): any;
|
|
19
|
+
subject?: () => any;
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
22
|
}
|
|
23
|
+
declare type CypressMethod = keyof Cypress.Chainable;
|
|
24
|
+
/** Commands we wrap to help us identify new page states. */
|
|
25
|
+
export declare const WRAPPED_COMMANDS: ReadonlyArray<CypressMethod>;
|
package/dist/cypressCommands.js
CHANGED
|
@@ -1,27 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* istanbul ignore file: This file is basically untestable due to how Cypress works. Instead, it's covered by our E2E suite and manual testing. */
|
|
3
|
-
var __assign = (this && this.__assign) || function () {
|
|
4
|
-
__assign = Object.assign || function(t) {
|
|
5
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
-
s = arguments[i];
|
|
7
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
-
t[p] = s[p];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
return __assign.apply(this, arguments);
|
|
13
|
-
};
|
|
14
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
|
|
16
|
-
Cypress.Commands.overwrite('visit', function (originalFn, url, options) {
|
|
17
|
-
if (options === void 0) { options = {}; }
|
|
18
|
-
var oldOnBeforeLoad = options.onBeforeLoad || (function () { return undefined; });
|
|
19
|
-
options.onBeforeLoad = function (win) {
|
|
20
|
-
win.__AXE_WATCHER_HAS_VISITED = true;
|
|
21
|
-
oldOnBeforeLoad(win);
|
|
22
|
-
};
|
|
23
|
-
return originalFn(__assign(__assign({}, options), { url: url }));
|
|
24
|
-
});
|
|
4
|
+
exports.WRAPPED_COMMANDS = void 0;
|
|
25
5
|
/**
|
|
26
6
|
* Has the user stopped automatic mode.
|
|
27
7
|
*
|
|
@@ -101,4 +81,104 @@ Cypress.Commands.add('axeStop', function () {
|
|
|
101
81
|
});
|
|
102
82
|
});
|
|
103
83
|
});
|
|
84
|
+
/** Commands we wrap to help us identify new page states. */
|
|
85
|
+
exports.WRAPPED_COMMANDS = [
|
|
86
|
+
'blur',
|
|
87
|
+
'check',
|
|
88
|
+
'clear',
|
|
89
|
+
'click',
|
|
90
|
+
'dblclick',
|
|
91
|
+
'focus',
|
|
92
|
+
'go',
|
|
93
|
+
'reload',
|
|
94
|
+
'scrollIntoView',
|
|
95
|
+
'scrollTo',
|
|
96
|
+
'select',
|
|
97
|
+
'submit',
|
|
98
|
+
'trigger',
|
|
99
|
+
'type',
|
|
100
|
+
'uncheck',
|
|
101
|
+
'wait'
|
|
102
|
+
];
|
|
103
|
+
/**
|
|
104
|
+
* Wrapped commands queue an axe run before calling the original method. This can seem
|
|
105
|
+
* a little counter-intuitive, but the reason we do this is so that we make sure we wait
|
|
106
|
+
* for the existing page state to be analyzed before performing our action.
|
|
107
|
+
*
|
|
108
|
+
* We rely on future commands to detect any new page state created by the current command.
|
|
109
|
+
* The last command that runs relies on the flush to catch the last page state.
|
|
110
|
+
*/
|
|
111
|
+
exports.WRAPPED_COMMANDS.forEach(function (method) {
|
|
112
|
+
return Cypress.Commands.overwrite(method, function (originalFn) {
|
|
113
|
+
var _a, _b, _c;
|
|
114
|
+
var args = [];
|
|
115
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
116
|
+
args[_i - 1] = arguments[_i];
|
|
117
|
+
}
|
|
118
|
+
var currentCommand = (_b = (_a = cy.state('current')) === null || _a === void 0 ? void 0 : _a.attributes) === null || _b === void 0 ? void 0 : _b.name;
|
|
119
|
+
// Some commands, like "type" call other commands internally, like "click".
|
|
120
|
+
// We don't want to enqueue a run in these scenarios because it can cause
|
|
121
|
+
// promises to be returned from commands, which Cypress does not allow.
|
|
122
|
+
// See: https://github.com/cypress-io/cypress/issues/19086
|
|
123
|
+
if (currentCommand && currentCommand !== method) {
|
|
124
|
+
return originalFn.apply(void 0, args);
|
|
125
|
+
}
|
|
126
|
+
// Get the previous subject from the chain so we can pass it along to child commands.
|
|
127
|
+
var subject = (_c = cy.subject) === null || _c === void 0 ? void 0 : _c.call(cy);
|
|
128
|
+
cy.window()
|
|
129
|
+
.then(function (win) {
|
|
130
|
+
if (win && !win.__AXE_WATCHER_HAS_VISITED) {
|
|
131
|
+
/**
|
|
132
|
+
* Set a flag on the Window to indicate that a wrapped method has been called.
|
|
133
|
+
* This is used to determine whether we should call `axeFlush` after the test.
|
|
134
|
+
*/
|
|
135
|
+
win.__AXE_WATCHER_HAS_VISITED = true;
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
.axeAnalyze({ __UserRequestedAnalyze: false })
|
|
139
|
+
// Set the subject back to the previous subject
|
|
140
|
+
.then(function () { return subject; })
|
|
141
|
+
.then(function () { return originalFn.apply(void 0, args); });
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
/**
|
|
145
|
+
* The `visit` command is wrapped differently than the other commands. This is because
|
|
146
|
+
* we need to actually visit and load the page before we can run axe.
|
|
147
|
+
*
|
|
148
|
+
* We run the original visit command, wait for the extension to be initialized, and then
|
|
149
|
+
* queue an axe run.
|
|
150
|
+
*/
|
|
151
|
+
Cypress.Commands.overwrite('visit', function (originalFn) {
|
|
152
|
+
var args = [];
|
|
153
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
154
|
+
args[_i - 1] = arguments[_i];
|
|
155
|
+
}
|
|
156
|
+
// We use `cy.wrap(null)` here just to get into the Cypress command queue.
|
|
157
|
+
cy.wrap(null)
|
|
158
|
+
.then(function () {
|
|
159
|
+
return originalFn.apply(void 0, args);
|
|
160
|
+
})
|
|
161
|
+
.then(function (visitResult) {
|
|
162
|
+
cy.window()
|
|
163
|
+
.then(function (win) {
|
|
164
|
+
if (win && !win.__AXE_WATCHER_HAS_VISITED) {
|
|
165
|
+
/**
|
|
166
|
+
* Set a flag on the Window to indicate that a wrapped method has been called.
|
|
167
|
+
* This is used to determine whether we should call `axeFlush` after the test.
|
|
168
|
+
*/
|
|
169
|
+
win.__AXE_WATCHER_HAS_VISITED = true;
|
|
170
|
+
}
|
|
171
|
+
// Wait for watcher to initialize before continuing.
|
|
172
|
+
return new Promise(function (resolve) {
|
|
173
|
+
var fn = function () {
|
|
174
|
+
win.removeEventListener('axe:initialized', fn);
|
|
175
|
+
resolve();
|
|
176
|
+
};
|
|
177
|
+
win.addEventListener('axe:initialized', fn);
|
|
178
|
+
});
|
|
179
|
+
})
|
|
180
|
+
.axeAnalyze({ __UserRequestedAnalyze: false })
|
|
181
|
+
.then(function () { return visitResult; });
|
|
182
|
+
});
|
|
183
|
+
});
|
|
104
184
|
//# sourceMappingURL=cypressCommands.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cypressCommands.js","sourceRoot":"","sources":["../src/cypressCommands.ts"],"names":[],"mappings":";AAAA,kJAAkJ
|
|
1
|
+
{"version":3,"file":"cypressCommands.js","sourceRoot":"","sources":["../src/cypressCommands.ts"],"names":[],"mappings":";AAAA,kJAAkJ;;;AAmClJ;;;;;;;GAOG;AAEH,IAAI,SAAS,GAAG,KAAK,CAAA;AAErB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,EAAE;IAC/B,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,UAAA,GAAG;QAClB,6FAA6F;QAC7F,2FAA2F;QAC3F,gBAAgB;QAChB,IAAI,CAAC,GAAG,CAAC,yBAAyB,EAAE;YAClC,OAAM;SACP;QAED,OAAO,IAAI,OAAO,CAAO,UAAA,OAAO;YAC9B,IAAM,EAAE,GAAG;gBACT,GAAG,CAAC,mBAAmB,CAAC,eAAe,EAAE,EAAE,CAAC,CAAA;gBAC5C,8DAA8D;gBAC9D,GAAG,CAAC,yBAAyB,GAAG,KAAK,CAAA;gBACrC,OAAO,EAAE,CAAA;YACX,CAAC,CAAA;YACD,GAAG,CAAC,gBAAgB,CAAC,eAAe,EAAE,EAAE,CAAC,CAAA;YACzC,IAAM,KAAK,GAAG,IAAI,WAAW,CAAC,iBAAiB,CAAC,CAAA;YAChD,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;QAC1B,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,YAAY;AACZ,mGAAmG;AACnG,UAAC,EAAwD;QAAxD,qBAAsD,EAAE,KAAA,EAAtD,8BAA6B,EAA7B,sBAAsB,mBAAG,IAAI,KAAA;IAC9B,IAAI,CAAC,sBAAsB,IAAI,SAAS,EAAE;QACxC,OAAM;KACP;IAED,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,UAAA,GAAG;QAClB,OAAO,IAAI,OAAO,CAAO,UAAA,OAAO;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CAAC,CAAA;IAC5B,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,5 +2,6 @@
|
|
|
2
2
|
export { puppeteerConfig, PuppeteerController } from './puppeteer';
|
|
3
3
|
export { wdioConfig, wdioTestRunner, WdioController, wrapWdio } from './wdio';
|
|
4
4
|
export { webdriverConfig, WebdriverController } from './webdriver';
|
|
5
|
-
export { playwrightConfig, PlaywrightController } from './playwright';
|
|
6
|
-
export {
|
|
5
|
+
export { playwrightConfig, PlaywrightController, wrapPlaywright } from './playwright';
|
|
6
|
+
export { default as playwrightTest } from './playwrightTest';
|
|
7
|
+
export { cypressConfig } from './cypress';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*! Copyright Deque 2021-2022 All Rights Reserved */
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
3
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
7
|
+
exports.cypressConfig = exports.playwrightTest = exports.wrapPlaywright = exports.PlaywrightController = exports.playwrightConfig = exports.WebdriverController = exports.webdriverConfig = exports.wrapWdio = exports.WdioController = exports.wdioTestRunner = exports.wdioConfig = exports.PuppeteerController = exports.puppeteerConfig = void 0;
|
|
5
8
|
var puppeteer_1 = require("./puppeteer");
|
|
6
9
|
Object.defineProperty(exports, "puppeteerConfig", { enumerable: true, get: function () { return puppeteer_1.puppeteerConfig; } });
|
|
7
10
|
Object.defineProperty(exports, "PuppeteerController", { enumerable: true, get: function () { return puppeteer_1.PuppeteerController; } });
|
|
@@ -16,7 +19,9 @@ Object.defineProperty(exports, "WebdriverController", { enumerable: true, get: f
|
|
|
16
19
|
var playwright_1 = require("./playwright");
|
|
17
20
|
Object.defineProperty(exports, "playwrightConfig", { enumerable: true, get: function () { return playwright_1.playwrightConfig; } });
|
|
18
21
|
Object.defineProperty(exports, "PlaywrightController", { enumerable: true, get: function () { return playwright_1.PlaywrightController; } });
|
|
22
|
+
Object.defineProperty(exports, "wrapPlaywright", { enumerable: true, get: function () { return playwright_1.wrapPlaywright; } });
|
|
23
|
+
var playwrightTest_1 = require("./playwrightTest");
|
|
24
|
+
Object.defineProperty(exports, "playwrightTest", { enumerable: true, get: function () { return __importDefault(playwrightTest_1).default; } });
|
|
19
25
|
var cypress_1 = require("./cypress");
|
|
20
26
|
Object.defineProperty(exports, "cypressConfig", { enumerable: true, get: function () { return cypress_1.cypressConfig; } });
|
|
21
|
-
Object.defineProperty(exports, "wrapCy", { enumerable: true, get: function () { return cypress_1.wrapCy; } });
|
|
22
27
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,oDAAoD
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;;;;AAEpD,yCAAkE;AAAzD,4GAAA,eAAe,OAAA;AAAE,gHAAA,mBAAmB,OAAA;AAC7C,+BAA6E;AAApE,kGAAA,UAAU,OAAA;AAAE,sGAAA,cAAc,OAAA;AAAE,sGAAA,cAAc,OAAA;AAAE,gGAAA,QAAQ,OAAA;AAC7D,yCAAkE;AAAzD,4GAAA,eAAe,OAAA;AAAE,gHAAA,mBAAmB,OAAA;AAC7C,2CAIqB;AAHnB,8GAAA,gBAAgB,OAAA;AAChB,kHAAA,oBAAoB,OAAA;AACpB,4GAAA,cAAc,OAAA;AAEhB,mDAA4D;AAAnD,iIAAA,OAAO,OAAkB;AAClC,qCAAyC;AAAhC,wGAAA,aAAa,OAAA"}
|
package/dist/playwright.d.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import type { LaunchOptions, Page } from 'playwright';
|
|
1
|
+
import type { LaunchOptions, Page } from 'playwright-core';
|
|
2
2
|
import { Configuration } from './util';
|
|
3
3
|
import Controller from './Controller';
|
|
4
|
+
import { wrapBrowserContext } from './playwrightWrapping';
|
|
5
|
+
/** Options for configuring Playwright and @axe-core/watcher. */
|
|
6
|
+
export declare type Options = Configuration & LaunchOptions;
|
|
4
7
|
/**
|
|
5
8
|
* Creates a Playwright config that uses axe extension
|
|
6
9
|
*
|
|
7
10
|
* @param opts Playwright config to extend
|
|
8
11
|
*/
|
|
9
|
-
export declare function playwrightConfig(opts:
|
|
12
|
+
export declare function playwrightConfig(opts: Options): LaunchOptions;
|
|
10
13
|
export declare class PlaywrightController extends Controller {
|
|
11
14
|
private driver;
|
|
12
15
|
constructor(driver: Page);
|
|
13
16
|
protected executeScript(fn: string | (() => Promise<void>), ...args: unknown[]): Promise<void>;
|
|
14
17
|
}
|
|
18
|
+
export { wrapBrowserContext as wrapPlaywright };
|
package/dist/playwright.js
CHANGED
|
@@ -76,9 +76,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
76
76
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
77
77
|
};
|
|
78
78
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
79
|
-
exports.PlaywrightController = exports.playwrightConfig = void 0;
|
|
79
|
+
exports.wrapPlaywright = exports.PlaywrightController = exports.playwrightConfig = void 0;
|
|
80
80
|
var util_1 = require("./util");
|
|
81
81
|
var Controller_1 = __importDefault(require("./Controller"));
|
|
82
|
+
var playwrightWrapping_1 = require("./playwrightWrapping");
|
|
83
|
+
Object.defineProperty(exports, "wrapPlaywright", { enumerable: true, get: function () { return playwrightWrapping_1.wrapBrowserContext; } });
|
|
84
|
+
var uuid_1 = require("uuid");
|
|
82
85
|
/**
|
|
83
86
|
* Creates a Playwright config that uses axe extension
|
|
84
87
|
*
|
|
@@ -87,7 +90,11 @@ var Controller_1 = __importDefault(require("./Controller"));
|
|
|
87
90
|
function playwrightConfig(opts) {
|
|
88
91
|
var axe = opts.axe, config = __rest(opts, ["axe"]);
|
|
89
92
|
var _a = config.args, args = _a === void 0 ? [] : _a;
|
|
90
|
-
(0, util_1.writeVariables)(axe)
|
|
93
|
+
(0, util_1.writeVariables)(__assign(__assign({}, axe), {
|
|
94
|
+
/** Ensure the session ID persists between tabs.
|
|
95
|
+
* We cannot allow the extension to generate an ID,
|
|
96
|
+
* as each tab would get its own */
|
|
97
|
+
sessionId: axe.sessionId || (0, uuid_1.v4)() }));
|
|
91
98
|
if (config.headless) {
|
|
92
99
|
throw new util_1.HeadlessNotSupportedError();
|
|
93
100
|
}
|
package/dist/playwright.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playwright.js","sourceRoot":"","sources":["../src/playwright.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+BAKe;AACf,4DAAqC;
|
|
1
|
+
{"version":3,"file":"playwright.js","sourceRoot":"","sources":["../src/playwright.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+BAKe;AACf,4DAAqC;AACrC,2DAAyD;AAqD1B,+FArDtB,uCAAkB,OAqDkB;AApD7C,6BAAiC;AAKjC;;;;GAIG;AAEH,SAAgB,gBAAgB,CAAC,IAAa;IACpC,IAAA,GAAG,GAAgB,IAAI,IAApB,EAAK,MAAM,UAAK,IAAI,EAAzB,OAAkB,CAAF,CAAS;IACzB,IAAA,KAAc,MAAM,KAAX,EAAT,IAAI,mBAAG,EAAE,KAAA,CAAW;IAE1B,IAAA,qBAAc,wBACT,GAAG;QACN;;2CAEmC;QACnC,SAAS,EAAE,GAAG,CAAC,SAAS,IAAI,IAAA,SAAI,GAAE,IAClC,CAAA;IAEF,IAAI,MAAM,CAAC,QAAQ,EAAE;QACnB,MAAM,IAAI,gCAAyB,EAAE,CAAA;KACtC;IAED,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,oBAAa,CAAC,CAAA;IAEjC,6BACK,MAAM,KACT,QAAQ,EAAE,KAAK,EACf,IAAI,MAAA,IACL;AACH,CAAC;AAvBD,4CAuBC;AAED;IAA0C,wCAAU;IAGlD,8BAAY,MAAY;QAAxB,YACE,iBAAO,SAER;QADC,KAAI,CAAC,MAAM,GAAG,MAAM,CAAA;;IACtB,CAAC;IAEe,4CAAa,GAA7B,UACE,EAAkC;QAClC,cAAkB;aAAlB,UAAkB,EAAlB,qBAAkB,EAAlB,IAAkB;YAAlB,6BAAkB;;;;;4BAElB,qBAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,EAAA;;wBAApC,SAAoC,CAAA;;;;;KACrC;IACH,2BAAC;AAAD,CAAC,AAdD,CAA0C,oBAAU,GAcnD;AAdY,oDAAoB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TestType, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, Expect } from '@playwright/test';
|
|
2
|
+
import { type Options } from './playwright';
|
|
3
|
+
declare type Test = TestType<PlaywrightTestArgs & PlaywrightTestOptions, PlaywrightWorkerArgs & PlaywrightWorkerOptions>;
|
|
4
|
+
interface ReturnValue {
|
|
5
|
+
test: Test;
|
|
6
|
+
expect: Expect;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Configure `@playwright/test` for usage with axe Watcher and return wrapped `test` and `expect` functions.
|
|
10
|
+
*
|
|
11
|
+
* @param options Options for configuring Playwright and @axe-core/watcher
|
|
12
|
+
* @see https://playwright.dev/docs/api/class-test#test-call
|
|
13
|
+
* @see https://playwright.dev/docs/api/class-test#test-expect
|
|
14
|
+
*/
|
|
15
|
+
declare const playwrightTest: (options: Options) => ReturnValue;
|
|
16
|
+
export default playwrightTest;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
50
|
+
var t = {};
|
|
51
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
52
|
+
t[p] = s[p];
|
|
53
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
54
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
55
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
56
|
+
t[p[i]] = s[p[i]];
|
|
57
|
+
}
|
|
58
|
+
return t;
|
|
59
|
+
};
|
|
60
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
61
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
62
|
+
if (ar || !(i in from)) {
|
|
63
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
64
|
+
ar[i] = from[i];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
68
|
+
};
|
|
69
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
70
|
+
var uuid_1 = require("uuid");
|
|
71
|
+
var playwright_1 = require("./playwright");
|
|
72
|
+
var util_1 = require("./util");
|
|
73
|
+
/**
|
|
74
|
+
* Configure `@playwright/test` for usage with axe Watcher and return wrapped `test` and `expect` functions.
|
|
75
|
+
*
|
|
76
|
+
* @param options Options for configuring Playwright and @axe-core/watcher
|
|
77
|
+
* @see https://playwright.dev/docs/api/class-test#test-call
|
|
78
|
+
* @see https://playwright.dev/docs/api/class-test#test-expect
|
|
79
|
+
*/
|
|
80
|
+
var playwrightTest = function (options) {
|
|
81
|
+
var _a;
|
|
82
|
+
var controller = null;
|
|
83
|
+
var axe = options.axe, config = __rest(options
|
|
84
|
+
// We must lazily require the `@playwright/test` package, as
|
|
85
|
+
// users of other platforms won't have it installed.
|
|
86
|
+
, ["axe"]);
|
|
87
|
+
// We must lazily require the `@playwright/test` package, as
|
|
88
|
+
// users of other platforms won't have it installed.
|
|
89
|
+
var base;
|
|
90
|
+
var chromium;
|
|
91
|
+
try {
|
|
92
|
+
;
|
|
93
|
+
(_a = require('@playwright/test'), base = _a.test, chromium = _a.chromium);
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
throw new Error('Unable to load @playwright/test: ' + error.message);
|
|
97
|
+
}
|
|
98
|
+
(0, util_1.writeVariables)(__assign(__assign({}, axe), { sessionId: axe.sessionId || (0, uuid_1.v4)() }));
|
|
99
|
+
var test = base.extend({
|
|
100
|
+
// Playwright requires destructing the context object. Removing it yields:
|
|
101
|
+
//
|
|
102
|
+
// Error: First argument must use the object destructuring pattern:
|
|
103
|
+
//
|
|
104
|
+
// eslint-disable-next-line no-empty-pattern
|
|
105
|
+
context: function (_a, use) { return __awaiter(void 0, void 0, void 0, function () {
|
|
106
|
+
var context;
|
|
107
|
+
return __generator(this, function (_b) {
|
|
108
|
+
switch (_b.label) {
|
|
109
|
+
case 0: return [4 /*yield*/, chromium.launchPersistentContext('', __assign(__assign({}, config), { args: __spreadArray(__spreadArray([], (config.args || []), true), util_1.extensionArgs, true) }))];
|
|
110
|
+
case 1:
|
|
111
|
+
context = _b.sent();
|
|
112
|
+
return [4 /*yield*/, use(context)];
|
|
113
|
+
case 2:
|
|
114
|
+
_b.sent();
|
|
115
|
+
return [4 /*yield*/, context.close()];
|
|
116
|
+
case 3:
|
|
117
|
+
_b.sent();
|
|
118
|
+
return [2 /*return*/];
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}); },
|
|
122
|
+
page: function (_a, use) {
|
|
123
|
+
var page = _a.page, context = _a.context;
|
|
124
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
125
|
+
return __generator(this, function (_b) {
|
|
126
|
+
switch (_b.label) {
|
|
127
|
+
case 0:
|
|
128
|
+
controller = new playwright_1.PlaywrightController(page);
|
|
129
|
+
(0, playwright_1.wrapPlaywright)(context, controller);
|
|
130
|
+
return [4 /*yield*/, use(page)];
|
|
131
|
+
case 1:
|
|
132
|
+
_b.sent();
|
|
133
|
+
return [2 /*return*/];
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
test.afterEach(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
140
|
+
return __generator(this, function (_a) {
|
|
141
|
+
switch (_a.label) {
|
|
142
|
+
case 0: return [4 /*yield*/, (controller === null || controller === void 0 ? void 0 : controller.flush())];
|
|
143
|
+
case 1:
|
|
144
|
+
_a.sent();
|
|
145
|
+
return [2 /*return*/];
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}); });
|
|
149
|
+
var expect = test.expect;
|
|
150
|
+
return { test: test, expect: expect };
|
|
151
|
+
};
|
|
152
|
+
exports.default = playwrightTest;
|
|
153
|
+
//# sourceMappingURL=playwrightTest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playwrightTest.js","sourceRoot":"","sources":["../src/playwrightTest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,6BAAiC;AACjC,2CAIqB;AACrB,+BAAsD;AAYtD;;;;;;GAMG;AAEH,IAAM,cAAc,GAAG,UAAC,OAAgB;;IACtC,IAAI,UAAU,GAAgC,IAAI,CAAA;IAC1C,IAAA,GAAG,GAAgB,OAAO,IAAvB,EAAK,MAAM,UAAK,OAAO;IAElC,4DAA4D;IAC5D,oDAAoD;MAH9C,OAAkB,CAAF,CAAY;IAElC,4DAA4D;IAC5D,oDAAoD;IACpD,IAAI,IAAU,CAAA;IACd,IAAI,QAAsC,CAAA;IAC1C,IAAI;QACF,CAAC;QAAA,CAAC,KAA2B,OAAO,CAAC,kBAAkB,CAAC,EAA9C,IAAI,UAAA,EAAE,QAAQ,cAAA,CAAiC,CAAA;KAC1D;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CACb,mCAAmC,GAAI,KAAe,CAAC,OAAO,CAC/D,CAAA;KACF;IAED,IAAA,qBAAc,wBAAM,GAAG,KAAE,SAAS,EAAE,GAAG,CAAC,SAAS,IAAI,IAAA,SAAI,GAAE,IAAG,CAAA;IAE9D,IAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;QACvB,0EAA0E;QAC1E,EAAE;QACF,mEAAmE;QACnE,EAAE;QACF,4CAA4C;QAC5C,OAAO,EAAE,UAAO,EAAE,EAAE,GAAG;;;;4BACL,qBAAM,QAAQ,CAAC,uBAAuB,CAAC,EAAE,wBACpD,MAAM,KACT,IAAI,kCAAM,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,SAAK,oBAAa,WAC/C,EAAA;;wBAHI,OAAO,GAAG,SAGd;wBACF,qBAAM,GAAG,CAAC,OAAO,CAAC,EAAA;;wBAAlB,SAAkB,CAAA;wBAClB,qBAAM,OAAO,CAAC,KAAK,EAAE,EAAA;;wBAArB,SAAqB,CAAA;;;;aACtB;QACD,IAAI,EAAE,UAAO,EAAiB,EAAE,GAAG;gBAApB,IAAI,UAAA,EAAE,OAAO,aAAA;;;;;4BAC1B,UAAU,GAAG,IAAI,iCAAoB,CAAC,IAAI,CAAC,CAAA;4BAC3C,IAAA,2BAAc,EAAC,OAAO,EAAE,UAAU,CAAC,CAAA;4BACnC,qBAAM,GAAG,CAAC,IAAI,CAAC,EAAA;;4BAAf,SAAe,CAAA;;;;;SAChB;KACF,CAAC,CAAA;IAEF,IAAI,CAAC,SAAS,CAAC;;;wBACb,qBAAM,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,EAAE,CAAA,EAAA;;oBAAzB,SAAyB,CAAA;;;;SAC1B,CAAC,CAAA;IAEF,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;IAE1B,OAAO,EAAE,IAAI,MAAA,EAAE,MAAM,QAAA,EAAE,CAAA;AACzB,CAAC,CAAA;AAED,kBAAe,cAAc,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Browser, BrowserContext, ElementHandle, Frame, FrameLocator, JSHandle, Keyboard, Locator, Mouse, Page, Touchscreen } from 'playwright-core';
|
|
2
|
+
import type { PlaywrightController } from './playwright';
|
|
3
|
+
declare const kWrapped: unique symbol;
|
|
4
|
+
declare type PossiblyWrapped<T> = T & {
|
|
5
|
+
[kWrapped]?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const isWrapped: <T>(o: PossiblyWrapped<T>) => boolean;
|
|
8
|
+
export declare const markAsWrapped: (o: unknown) => void;
|
|
9
|
+
export declare const wrapBrowserContext: (browserContext: PossiblyWrapped<BrowserContext>, controller: PlaywrightController) => BrowserContext;
|
|
10
|
+
export declare const wrapBrowser: (browser: PossiblyWrapped<Browser>, controller: PlaywrightController) => Browser;
|
|
11
|
+
export declare const wrapPage: (page: PossiblyWrapped<Page>, controller: PlaywrightController) => Page;
|
|
12
|
+
export declare const wrapElementHandle: (elementHandle: PossiblyWrapped<ElementHandle>, controller: PlaywrightController) => ElementHandle;
|
|
13
|
+
export declare const wrapFrame: (frame: PossiblyWrapped<Frame>, controller: PlaywrightController) => Frame;
|
|
14
|
+
export declare const wrapFrameLocator: (frameLocator: PossiblyWrapped<FrameLocator>, controller: PlaywrightController) => FrameLocator;
|
|
15
|
+
export declare const wrapLocator: (locator: PossiblyWrapped<Locator>, controller: PlaywrightController) => Locator;
|
|
16
|
+
export declare const wrapJSHandle: (jsHandle: PossiblyWrapped<JSHandle>, controller: PlaywrightController) => JSHandle;
|
|
17
|
+
export declare const wrapKeyboard: (keyboard: PossiblyWrapped<Keyboard>, controller: PlaywrightController) => Keyboard;
|
|
18
|
+
export declare const wrapMouse: (mouse: PossiblyWrapped<Mouse>, controller: PlaywrightController) => Mouse;
|
|
19
|
+
export declare const wrapTouchscreen: (touchscreen: PossiblyWrapped<Touchscreen>, controller: PlaywrightController) => Touchscreen;
|
|
20
|
+
export {};
|