webdriverio 7.21.0 → 8.0.0-alpha.239
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/build/cjs/index.d.ts +3 -0
- package/build/cjs/index.d.ts.map +1 -0
- package/build/cjs/index.js +13 -0
- package/build/cjs/package.json +3 -0
- package/build/commands/browser/$$.js +6 -9
- package/build/commands/browser/$.js +8 -11
- package/build/commands/browser/action.d.ts +128 -0
- package/build/commands/browser/action.d.ts.map +1 -0
- package/build/commands/browser/action.js +13 -0
- package/build/commands/browser/actions.d.ts +29 -0
- package/build/commands/browser/actions.d.ts.map +1 -0
- package/build/commands/browser/actions.js +30 -0
- package/build/commands/browser/call.js +1 -4
- package/build/commands/browser/custom$$.js +7 -10
- package/build/commands/browser/custom$.js +5 -8
- package/build/commands/browser/debug.js +8 -14
- package/build/commands/browser/deleteCookies.js +1 -4
- package/build/commands/browser/execute.js +3 -6
- package/build/commands/browser/executeAsync.js +3 -6
- package/build/commands/browser/getCookies.js +1 -4
- package/build/commands/browser/getPuppeteer.d.ts +1 -1
- package/build/commands/browser/getPuppeteer.d.ts.map +1 -1
- package/build/commands/browser/getPuppeteer.js +14 -21
- package/build/commands/browser/getWindowSize.js +3 -6
- package/build/commands/browser/keys.d.ts +20 -10
- package/build/commands/browser/keys.d.ts.map +1 -1
- package/build/commands/browser/keys.js +29 -24
- package/build/commands/browser/mock.d.ts +1 -1
- package/build/commands/browser/mock.d.ts.map +1 -1
- package/build/commands/browser/mock.js +12 -19
- package/build/commands/browser/mockClearAll.js +5 -11
- package/build/commands/browser/mockRestoreAll.js +5 -11
- package/build/commands/browser/newWindow.js +5 -11
- package/build/commands/browser/pause.js +1 -4
- package/build/commands/browser/react$$.d.ts.map +1 -1
- package/build/commands/browser/react$$.js +12 -16
- package/build/commands/browser/react$.d.ts.map +1 -1
- package/build/commands/browser/react$.js +10 -14
- package/build/commands/browser/reloadSession.js +5 -12
- package/build/commands/browser/savePDF.js +7 -13
- package/build/commands/browser/saveRecordingScreen.js +6 -12
- package/build/commands/browser/saveScreenshot.js +6 -12
- package/build/commands/browser/scroll.d.ts +25 -0
- package/build/commands/browser/scroll.d.ts.map +1 -0
- package/build/commands/browser/scroll.js +41 -0
- package/build/commands/browser/setCookies.js +1 -4
- package/build/commands/browser/setTimeout.js +1 -4
- package/build/commands/browser/setWindowSize.js +3 -6
- package/build/commands/browser/switchWindow.js +1 -4
- package/build/commands/browser/throttle.js +3 -6
- package/build/commands/browser/touchAction.d.ts +1 -1
- package/build/commands/browser/touchAction.d.ts.map +1 -1
- package/build/commands/browser/touchAction.js +3 -6
- package/build/commands/browser/uploadFile.d.ts +1 -1
- package/build/commands/browser/uploadFile.d.ts.map +1 -1
- package/build/commands/browser/uploadFile.js +10 -15
- package/build/commands/browser/url.js +3 -6
- package/build/commands/browser/waitUntil.js +3 -9
- package/build/commands/browser.d.ts +39 -33
- package/build/commands/browser.d.ts.map +1 -1
- package/build/commands/browser.js +42 -43
- package/build/commands/constant.d.ts +1 -1
- package/build/commands/constant.d.ts.map +1 -1
- package/build/commands/constant.js +6 -12
- package/build/commands/element/$$.d.ts +1 -1
- package/build/commands/element/$$.d.ts.map +1 -1
- package/build/commands/element/$$.js +2 -7
- package/build/commands/element/$.d.ts +1 -1
- package/build/commands/element/$.d.ts.map +1 -1
- package/build/commands/element/$.js +2 -7
- package/build/commands/element/addValue.d.ts +10 -14
- package/build/commands/element/addValue.d.ts.map +1 -1
- package/build/commands/element/addValue.js +23 -27
- package/build/commands/element/clearValue.d.ts +1 -1
- package/build/commands/element/clearValue.js +2 -5
- package/build/commands/element/click.d.ts +1 -1
- package/build/commands/element/click.d.ts.map +1 -1
- package/build/commands/element/click.js +19 -34
- package/build/commands/element/custom$$.js +9 -11
- package/build/commands/element/custom$.js +8 -10
- package/build/commands/element/doubleClick.d.ts.map +1 -1
- package/build/commands/element/doubleClick.js +11 -17
- package/build/commands/element/dragAndDrop.d.ts.map +1 -1
- package/build/commands/element/dragAndDrop.js +13 -19
- package/build/commands/element/getAttribute.js +1 -4
- package/build/commands/element/getCSSProperty.d.ts +1 -1
- package/build/commands/element/getCSSProperty.d.ts.map +1 -1
- package/build/commands/element/getCSSProperty.js +7 -13
- package/build/commands/element/getComputedLabel.js +1 -4
- package/build/commands/element/getComputedRole.js +1 -4
- package/build/commands/element/getHTML.js +7 -13
- package/build/commands/element/getLocation.js +3 -5
- package/build/commands/element/getProperty.d.ts +8 -8
- package/build/commands/element/getProperty.d.ts.map +1 -1
- package/build/commands/element/getProperty.js +5 -11
- package/build/commands/element/getSize.js +3 -5
- package/build/commands/element/getTagName.js +1 -4
- package/build/commands/element/getText.js +1 -4
- package/build/commands/element/getValue.js +1 -4
- package/build/commands/element/isClickable.js +7 -13
- package/build/commands/element/isDisplayed.js +9 -16
- package/build/commands/element/isDisplayedInViewport.js +7 -13
- package/build/commands/element/isEnabled.js +1 -4
- package/build/commands/element/isEqual.d.ts.map +1 -1
- package/build/commands/element/isEqual.js +9 -9
- package/build/commands/element/isExisting.js +1 -4
- package/build/commands/element/isFocused.js +7 -13
- package/build/commands/element/isSelected.js +1 -4
- package/build/commands/element/moveTo.d.ts.map +1 -1
- package/build/commands/element/moveTo.js +8 -13
- package/build/commands/element/nextElement.js +2 -5
- package/build/commands/element/parentElement.js +2 -5
- package/build/commands/element/previousElement.js +2 -5
- package/build/commands/element/react$$.d.ts.map +1 -1
- package/build/commands/element/react$$.js +13 -16
- package/build/commands/element/react$.d.ts.map +1 -1
- package/build/commands/element/react$.js +12 -14
- package/build/commands/element/saveScreenshot.js +6 -12
- package/build/commands/element/scrollIntoView.d.ts +3 -2
- package/build/commands/element/scrollIntoView.d.ts.map +1 -1
- package/build/commands/element/scrollIntoView.js +32 -12
- package/build/commands/element/selectByAttribute.js +3 -6
- package/build/commands/element/selectByIndex.js +3 -6
- package/build/commands/element/selectByVisibleText.js +3 -6
- package/build/commands/element/setValue.d.ts +13 -14
- package/build/commands/element/setValue.d.ts.map +1 -1
- package/build/commands/element/setValue.js +14 -17
- package/build/commands/element/shadow$$.d.ts +1 -1
- package/build/commands/element/shadow$$.d.ts.map +1 -1
- package/build/commands/element/shadow$$.js +3 -6
- package/build/commands/element/shadow$.js +3 -6
- package/build/commands/element/touchAction.js +3 -6
- package/build/commands/element/waitForClickable.js +1 -4
- package/build/commands/element/waitForDisplayed.js +1 -4
- package/build/commands/element/waitForEnabled.js +1 -4
- package/build/commands/element/waitForExist.js +1 -4
- package/build/commands/element/waitUntil.d.ts +1 -1
- package/build/commands/element/waitUntil.d.ts.map +1 -1
- package/build/commands/element/waitUntil.js +2 -7
- package/build/commands/element.d.ts +48 -48
- package/build/commands/element.d.ts.map +1 -1
- package/build/commands/element.js +57 -62
- package/build/constants.d.ts +66 -0
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +91 -12
- package/build/index.d.ts +64 -5
- package/build/index.d.ts.map +1 -1
- package/build/index.js +47 -85
- package/build/middlewares.d.ts +1 -1
- package/build/middlewares.js +11 -19
- package/build/multiremote.js +12 -20
- package/build/protocol-stub.d.ts.map +1 -1
- package/build/protocol-stub.js +4 -6
- package/build/scripts/getHTML.js +1 -4
- package/build/scripts/getProperty.d.ts +8 -8
- package/build/scripts/getProperty.d.ts.map +1 -1
- package/build/scripts/getProperty.js +1 -4
- package/build/scripts/isElementClickable.js +1 -4
- package/build/scripts/isElementDisplayed.js +1 -4
- package/build/scripts/isElementInViewport.js +1 -4
- package/build/scripts/isFocused.js +1 -4
- package/build/scripts/newWindow.js +1 -4
- package/build/scripts/resq.js +3 -9
- package/build/scripts/shadowFnFactory.js +2 -6
- package/build/types.d.ts +1 -5
- package/build/types.d.ts.map +1 -1
- package/build/types.js +1 -2
- package/build/utils/SevereServiceError.js +1 -4
- package/build/utils/Timer.d.ts.map +1 -1
- package/build/utils/Timer.js +1 -25
- package/build/utils/actions/base.d.ts +32 -0
- package/build/utils/actions/base.d.ts.map +1 -0
- package/build/utils/actions/base.js +78 -0
- package/build/utils/actions/index.d.ts +6 -0
- package/build/utils/actions/index.d.ts.map +1 -0
- package/build/utils/actions/index.js +5 -0
- package/build/utils/actions/key.d.ts +15 -0
- package/build/utils/actions/key.d.ts.map +1 -0
- package/build/utils/actions/key.js +22 -0
- package/build/utils/actions/pointer.d.ts +62 -0
- package/build/utils/actions/pointer.d.ts.map +1 -0
- package/build/utils/actions/pointer.js +76 -0
- package/build/utils/actions/wheel.d.ts +36 -0
- package/build/utils/actions/wheel.d.ts.map +1 -0
- package/build/utils/actions/wheel.js +20 -0
- package/build/utils/detectBackend.d.ts +1 -1
- package/build/utils/detectBackend.d.ts.map +1 -1
- package/build/utils/detectBackend.js +3 -7
- package/build/utils/findStrategy.js +11 -19
- package/build/utils/getElementObject.d.ts.map +1 -1
- package/build/utils/getElementObject.js +42 -31
- package/build/utils/implicitWait.js +3 -9
- package/build/utils/index.d.ts +2 -6
- package/build/utils/index.d.ts.map +1 -1
- package/build/utils/index.js +92 -142
- package/build/utils/interception/devtools.d.ts +1 -1
- package/build/utils/interception/devtools.d.ts.map +1 -1
- package/build/utils/interception/devtools.js +17 -23
- package/build/utils/interception/index.d.ts +2 -2
- package/build/utils/interception/index.d.ts.map +1 -1
- package/build/utils/interception/index.js +5 -11
- package/build/utils/interception/types.d.ts +1 -1
- package/build/utils/interception/types.d.ts.map +1 -1
- package/build/utils/interception/types.js +1 -2
- package/build/utils/interception/webdriver.d.ts +1 -1
- package/build/utils/interception/webdriver.d.ts.map +1 -1
- package/build/utils/interception/webdriver.js +5 -11
- package/build/utils/refetchElement.js +3 -9
- package/package.json +22 -11
- package/async.d.ts +0 -24
- package/sync.d.ts +0 -24
package/build/index.js
CHANGED
|
@@ -1,51 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
|
-
};
|
|
28
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
-
};
|
|
31
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.SevereServiceError = exports.multiremote = exports.attach = exports.remote = void 0;
|
|
33
|
-
const logger_1 = __importDefault(require("@wdio/logger"));
|
|
34
|
-
const webdriver_1 = __importDefault(require("webdriver"));
|
|
35
|
-
const webdriver_2 = require("webdriver");
|
|
36
|
-
const config_1 = require("@wdio/config");
|
|
37
|
-
const utils_1 = require("@wdio/utils");
|
|
38
|
-
const multiremote_1 = __importDefault(require("./multiremote"));
|
|
39
|
-
const SevereServiceError_1 = __importDefault(require("./utils/SevereServiceError"));
|
|
40
|
-
const detectBackend_1 = __importDefault(require("./utils/detectBackend"));
|
|
41
|
-
const constants_1 = require("./constants");
|
|
42
|
-
const utils_2 = require("./utils");
|
|
1
|
+
import logger from '@wdio/logger';
|
|
2
|
+
import WebDriver, { DEFAULTS } from 'webdriver';
|
|
3
|
+
import { validateConfig } from '@wdio/config';
|
|
4
|
+
import { wrapCommand } from '@wdio/utils';
|
|
5
|
+
import MultiRemote from './multiremote.js';
|
|
6
|
+
import SevereServiceErrorImport from './utils/SevereServiceError.js';
|
|
7
|
+
import detectBackend from './utils/detectBackend.js';
|
|
8
|
+
import { WDIO_DEFAULTS, Key as KeyConstant } from './constants.js';
|
|
9
|
+
import { getPrototype, addLocatorStrategyHandler, isStub, getAutomationProtocol, updateCapabilities } from './utils/index.js';
|
|
10
|
+
export const Key = KeyConstant;
|
|
43
11
|
/**
|
|
44
12
|
* A method to create a new session with WebdriverIO.
|
|
45
13
|
*
|
|
46
14
|
* <b>
|
|
47
15
|
* NOTE: If you hit "error TS2694: Namespace 'global.WebdriverIO' has no exported member 'Browser'" when using typescript,
|
|
48
|
-
* add "
|
|
16
|
+
* add "@wdio/globals/types" into tsconfig.json's "types" array will solve it: <code> { "compilerOptions": { "types": ["@wdio/globals/types"] } } </code>
|
|
49
17
|
* </b>
|
|
50
18
|
*
|
|
51
19
|
* @param {Object} [params={}] Options to create the session with
|
|
@@ -53,10 +21,10 @@ const utils_2 = require("./utils");
|
|
|
53
21
|
* @return {object} browser object with sessionId
|
|
54
22
|
* @see <a href="https://webdriver.io/docs/typescript">Typescript setup</a>
|
|
55
23
|
*/
|
|
56
|
-
const remote = async function (params, remoteModifier) {
|
|
57
|
-
|
|
58
|
-
const config =
|
|
59
|
-
const automationProtocol = await
|
|
24
|
+
export const remote = async function (params, remoteModifier) {
|
|
25
|
+
logger.setLogLevelsConfig(params.logLevels, params.logLevel);
|
|
26
|
+
const config = validateConfig(WDIO_DEFAULTS, params, Object.keys(DEFAULTS));
|
|
27
|
+
const automationProtocol = await getAutomationProtocol(config);
|
|
60
28
|
const modifier = (client, options) => {
|
|
61
29
|
/**
|
|
62
30
|
* overwrite instance options with default values of the protocol
|
|
@@ -70,46 +38,41 @@ const remote = async function (params, remoteModifier) {
|
|
|
70
38
|
options.automationProtocol = automationProtocol;
|
|
71
39
|
return client;
|
|
72
40
|
};
|
|
73
|
-
const prototype =
|
|
74
|
-
const ProtocolDriver = (await
|
|
75
|
-
params = Object.assign({}, (
|
|
76
|
-
|
|
77
|
-
const instance = await ProtocolDriver.newSession(params, modifier, prototype,
|
|
41
|
+
const prototype = getPrototype('browser');
|
|
42
|
+
const ProtocolDriver = (await import(automationProtocol)).default;
|
|
43
|
+
params = Object.assign({}, detectBackend(params), params);
|
|
44
|
+
updateCapabilities(params, automationProtocol);
|
|
45
|
+
const instance = await ProtocolDriver.newSession(params, modifier, prototype, wrapCommand);
|
|
78
46
|
/**
|
|
79
47
|
* we need to overwrite the original addCommand and overwriteCommand
|
|
80
|
-
* in order to wrap the function within Fibers (only if webdriverio
|
|
81
|
-
* is used with @wdio/cli)
|
|
82
48
|
*/
|
|
83
|
-
if (params.framework && !
|
|
49
|
+
if (params.framework && !isStub(automationProtocol)) {
|
|
84
50
|
const origAddCommand = instance.addCommand.bind(instance);
|
|
85
|
-
instance.addCommand = (name, fn, attachToElement) => (origAddCommand(name,
|
|
51
|
+
instance.addCommand = (name, fn, attachToElement) => (origAddCommand(name, fn, attachToElement));
|
|
86
52
|
const origOverwriteCommand = instance.overwriteCommand.bind(instance);
|
|
87
|
-
instance.overwriteCommand = (name, fn, attachToElement) => (origOverwriteCommand(name,
|
|
53
|
+
instance.overwriteCommand = (name, fn, attachToElement) => (origOverwriteCommand(name, fn, attachToElement));
|
|
88
54
|
}
|
|
89
|
-
instance.addLocatorStrategy =
|
|
55
|
+
instance.addLocatorStrategy = addLocatorStrategyHandler(instance);
|
|
90
56
|
return instance;
|
|
91
57
|
};
|
|
92
|
-
|
|
93
|
-
const attach = async function (attachOptions) {
|
|
94
|
-
var _a, _b;
|
|
58
|
+
export const attach = async function (attachOptions) {
|
|
95
59
|
/**
|
|
96
60
|
* copy instances properties into new object
|
|
97
61
|
*/
|
|
98
62
|
const params = {
|
|
99
63
|
...attachOptions,
|
|
100
64
|
options: { ...attachOptions.options },
|
|
101
|
-
...(
|
|
65
|
+
...detectBackend(attachOptions),
|
|
102
66
|
requestedCapabilities: attachOptions.requestedCapabilities
|
|
103
67
|
};
|
|
104
|
-
const prototype =
|
|
68
|
+
const prototype = getPrototype('browser');
|
|
105
69
|
let automationProtocol = 'webdriver';
|
|
106
|
-
if (
|
|
107
|
-
automationProtocol =
|
|
70
|
+
if (params.options?.automationProtocol) {
|
|
71
|
+
automationProtocol = params.options?.automationProtocol;
|
|
108
72
|
}
|
|
109
|
-
const ProtocolDriver = (await
|
|
110
|
-
return ProtocolDriver.attachToSession(params, undefined, prototype,
|
|
73
|
+
const ProtocolDriver = (await import(automationProtocol)).default;
|
|
74
|
+
return ProtocolDriver.attachToSession(params, undefined, prototype, wrapCommand);
|
|
111
75
|
};
|
|
112
|
-
exports.attach = attach;
|
|
113
76
|
/**
|
|
114
77
|
* WebdriverIO allows you to run multiple automated sessions in a single test.
|
|
115
78
|
* This is handy when you’re testing features that require multiple users (for example, chat or WebRTC applications).
|
|
@@ -129,47 +92,46 @@ exports.attach = attach;
|
|
|
129
92
|
*
|
|
130
93
|
* @see <a href="https://webdriver.io/docs/multiremote">External document and example usage</a>.
|
|
131
94
|
*/
|
|
132
|
-
const multiremote = async function (params, { automationProtocol } = {}) {
|
|
133
|
-
const multibrowser = new
|
|
95
|
+
export const multiremote = async function (params, { automationProtocol } = {}) {
|
|
96
|
+
const multibrowser = new MultiRemote();
|
|
134
97
|
const browserNames = Object.keys(params);
|
|
135
98
|
/**
|
|
136
99
|
* create all instance sessions
|
|
137
100
|
*/
|
|
138
101
|
await Promise.all(browserNames.map(async (browserName) => {
|
|
139
|
-
const instance = await
|
|
102
|
+
const instance = await remote(params[browserName]);
|
|
140
103
|
return multibrowser.addInstance(browserName, instance);
|
|
141
104
|
}));
|
|
142
105
|
/**
|
|
143
106
|
* use attachToSession capability to wrap instances around blank pod
|
|
144
107
|
*/
|
|
145
|
-
const prototype =
|
|
146
|
-
const sessionParams =
|
|
108
|
+
const prototype = getPrototype('browser');
|
|
109
|
+
const sessionParams = isStub(automationProtocol) ? undefined : {
|
|
147
110
|
sessionId: '',
|
|
148
111
|
isW3C: multibrowser.instances[browserNames[0]].isW3C,
|
|
149
112
|
logLevel: multibrowser.instances[browserNames[0]].options.logLevel
|
|
150
113
|
};
|
|
151
|
-
const ProtocolDriver = automationProtocol &&
|
|
152
|
-
?
|
|
153
|
-
:
|
|
154
|
-
const driver = ProtocolDriver.attachToSession(sessionParams, multibrowser.modifier.bind(multibrowser), prototype,
|
|
114
|
+
const ProtocolDriver = automationProtocol && isStub(automationProtocol)
|
|
115
|
+
? (await import(automationProtocol)).default
|
|
116
|
+
: WebDriver;
|
|
117
|
+
const driver = ProtocolDriver.attachToSession(sessionParams, multibrowser.modifier.bind(multibrowser), prototype, wrapCommand);
|
|
155
118
|
/**
|
|
156
119
|
* in order to get custom command overwritten or added to multiremote instance
|
|
157
120
|
* we need to pass in the prototype of the multibrowser
|
|
158
121
|
*/
|
|
159
|
-
if (!
|
|
122
|
+
if (!isStub(automationProtocol)) {
|
|
160
123
|
const origAddCommand = driver.addCommand.bind(driver);
|
|
161
124
|
driver.addCommand = (name, fn, attachToElement) => {
|
|
162
|
-
return origAddCommand(name,
|
|
125
|
+
return origAddCommand(name, fn, attachToElement, Object.getPrototypeOf(multibrowser.baseInstance), multibrowser.instances);
|
|
163
126
|
};
|
|
164
127
|
const origOverwriteCommand = driver.overwriteCommand.bind(driver);
|
|
165
128
|
driver.overwriteCommand = (name, fn, attachToElement) => {
|
|
166
|
-
return origOverwriteCommand(name,
|
|
129
|
+
return origOverwriteCommand(name, fn, attachToElement, Object.getPrototypeOf(multibrowser.baseInstance), multibrowser.instances);
|
|
167
130
|
};
|
|
168
131
|
}
|
|
169
|
-
driver.addLocatorStrategy =
|
|
132
|
+
driver.addLocatorStrategy = addLocatorStrategyHandler(driver);
|
|
170
133
|
return driver;
|
|
171
134
|
};
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
__exportStar(require("./utils/interception/types"), exports);
|
|
135
|
+
export const SevereServiceError = SevereServiceErrorImport;
|
|
136
|
+
export * from './types.js';
|
|
137
|
+
export * from './utils/interception/types.js';
|
package/build/middlewares.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* This method is an command wrapper for elements that checks if a command is called
|
|
3
3
|
* that wasn't found on the page and automatically waits for it
|
|
4
4
|
*
|
|
5
|
-
* @param {Function} fn
|
|
5
|
+
* @param {Function} fn command shim
|
|
6
6
|
*/
|
|
7
7
|
export declare const elementErrorHandler: (fn: Function) => (commandName: string, commandFn: Function) => (this: WebdriverIO.Element, ...args: any[]) => any;
|
|
8
8
|
/**
|
package/build/middlewares.js
CHANGED
|
@@ -1,32 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.multiremoteHandler = exports.elementErrorHandler = void 0;
|
|
7
|
-
const refetchElement_1 = __importDefault(require("./utils/refetchElement"));
|
|
8
|
-
const implicitWait_1 = __importDefault(require("./utils/implicitWait"));
|
|
9
|
-
const utils_1 = require("./utils");
|
|
10
|
-
const constants_1 = require("./constants");
|
|
1
|
+
import refetchElement from './utils/refetchElement.js';
|
|
2
|
+
import implicitWait from './utils/implicitWait.js';
|
|
3
|
+
import { getBrowserObject } from './utils/index.js';
|
|
4
|
+
import { ELEMENT_KEY } from './constants.js';
|
|
11
5
|
/**
|
|
12
6
|
* This method is an command wrapper for elements that checks if a command is called
|
|
13
7
|
* that wasn't found on the page and automatically waits for it
|
|
14
8
|
*
|
|
15
|
-
* @param {Function} fn
|
|
9
|
+
* @param {Function} fn command shim
|
|
16
10
|
*/
|
|
17
|
-
const elementErrorHandler = (fn) => (commandName, commandFn) => {
|
|
11
|
+
export const elementErrorHandler = (fn) => (commandName, commandFn) => {
|
|
18
12
|
return function elementErrorHandlerCallback(...args) {
|
|
19
13
|
return fn(commandName, async function elementErrorHandlerCallbackFn() {
|
|
20
|
-
const element = await (
|
|
14
|
+
const element = await implicitWait(this, commandName);
|
|
21
15
|
this.elementId = element.elementId;
|
|
22
|
-
this[
|
|
16
|
+
this[ELEMENT_KEY] = element.elementId;
|
|
23
17
|
try {
|
|
24
18
|
const result = await fn(commandName, commandFn).apply(this, args);
|
|
25
19
|
/**
|
|
26
20
|
* assume Safari responses like { error: 'no such element', message: '', stacktrace: '' }
|
|
27
21
|
* as `stale element reference`
|
|
28
22
|
*/
|
|
29
|
-
const caps =
|
|
23
|
+
const caps = getBrowserObject(this).capabilities;
|
|
30
24
|
if (caps && caps.browserName === 'safari' &&
|
|
31
25
|
result && result.error === 'no such element') {
|
|
32
26
|
const errorName = 'stale element reference';
|
|
@@ -38,7 +32,7 @@ const elementErrorHandler = (fn) => (commandName, commandFn) => {
|
|
|
38
32
|
}
|
|
39
33
|
catch (err) {
|
|
40
34
|
if (err.name === 'stale element reference') {
|
|
41
|
-
const element = await (
|
|
35
|
+
const element = await refetchElement(this, commandName);
|
|
42
36
|
this.elementId = element.elementId;
|
|
43
37
|
this.parent = element.parent;
|
|
44
38
|
return await fn(commandName, commandFn).apply(this, args);
|
|
@@ -48,11 +42,10 @@ const elementErrorHandler = (fn) => (commandName, commandFn) => {
|
|
|
48
42
|
}).apply(this);
|
|
49
43
|
};
|
|
50
44
|
};
|
|
51
|
-
exports.elementErrorHandler = elementErrorHandler;
|
|
52
45
|
/**
|
|
53
46
|
* handle single command calls from multiremote instances
|
|
54
47
|
*/
|
|
55
|
-
const multiremoteHandler = (wrapCommand) => (commandName) => {
|
|
48
|
+
export const multiremoteHandler = (wrapCommand) => (commandName) => {
|
|
56
49
|
return wrapCommand(commandName, function (...args) {
|
|
57
50
|
// @ts-ignore
|
|
58
51
|
const commandResults = this.instances.map((instanceName) => {
|
|
@@ -62,4 +55,3 @@ const multiremoteHandler = (wrapCommand) => (commandName) => {
|
|
|
62
55
|
return Promise.all(commandResults);
|
|
63
56
|
});
|
|
64
57
|
};
|
|
65
|
-
exports.multiremoteHandler = multiremoteHandler;
|
package/build/multiremote.js
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
exports.MultiRemoteDriver = void 0;
|
|
7
|
-
const lodash_zip_1 = __importDefault(require("lodash.zip"));
|
|
8
|
-
const lodash_clonedeep_1 = __importDefault(require("lodash.clonedeep"));
|
|
9
|
-
const utils_1 = require("@wdio/utils");
|
|
10
|
-
const middlewares_1 = require("./middlewares");
|
|
11
|
-
const utils_2 = require("./utils");
|
|
1
|
+
import zip from 'lodash.zip';
|
|
2
|
+
import clone from 'lodash.clonedeep';
|
|
3
|
+
import { webdriverMonad, wrapCommand } from '@wdio/utils';
|
|
4
|
+
import { multiremoteHandler } from './middlewares.js';
|
|
5
|
+
import { getPrototype } from './utils/index.js';
|
|
12
6
|
/**
|
|
13
7
|
* Multiremote class
|
|
14
8
|
*/
|
|
15
|
-
class MultiRemote {
|
|
9
|
+
export default class MultiRemote {
|
|
16
10
|
constructor() {
|
|
17
11
|
this.instances = {};
|
|
18
12
|
}
|
|
@@ -65,8 +59,8 @@ class MultiRemote {
|
|
|
65
59
|
* ```
|
|
66
60
|
*/
|
|
67
61
|
static elementWrapper(instances, result, propertiesObject, scope) {
|
|
68
|
-
const prototype = { ...propertiesObject, ...(
|
|
69
|
-
const element =
|
|
62
|
+
const prototype = { ...propertiesObject, ...clone(getPrototype('element')), scope: { value: 'element' } };
|
|
63
|
+
const element = webdriverMonad({}, (client) => {
|
|
70
64
|
/**
|
|
71
65
|
* attach instances to wrapper client
|
|
72
66
|
*/
|
|
@@ -80,7 +74,7 @@ class MultiRemote {
|
|
|
80
74
|
return client;
|
|
81
75
|
}, prototype);
|
|
82
76
|
// @ts-ignore
|
|
83
|
-
return element(this.sessionId,
|
|
77
|
+
return element(this.sessionId, multiremoteHandler(scope.commandWrapper.bind(scope)));
|
|
84
78
|
}
|
|
85
79
|
/**
|
|
86
80
|
* handle commands for multiremote instances
|
|
@@ -88,7 +82,7 @@ class MultiRemote {
|
|
|
88
82
|
commandWrapper(commandName) {
|
|
89
83
|
const instances = this.instances;
|
|
90
84
|
const self = this;
|
|
91
|
-
return
|
|
85
|
+
return wrapCommand(commandName, async function (...args) {
|
|
92
86
|
const mElem = this;
|
|
93
87
|
const scope = this.selector
|
|
94
88
|
? Object.entries(mElem.instances.reduce((ins, instanceName) => ({ ...ins, [instanceName]: mElem[instanceName] }), {}))
|
|
@@ -104,19 +98,18 @@ class MultiRemote {
|
|
|
104
98
|
return elem;
|
|
105
99
|
}
|
|
106
100
|
else if (commandName === '$$') {
|
|
107
|
-
const zippedResult = (
|
|
101
|
+
const zippedResult = zip(...result);
|
|
108
102
|
return zippedResult.map((singleResult) => MultiRemote.elementWrapper(instances, singleResult, this.__propertiesObject__, self));
|
|
109
103
|
}
|
|
110
104
|
return result;
|
|
111
105
|
});
|
|
112
106
|
}
|
|
113
107
|
}
|
|
114
|
-
exports.default = MultiRemote;
|
|
115
108
|
/**
|
|
116
109
|
* event listener class that propagates events to sub drivers
|
|
117
110
|
*/
|
|
118
111
|
/* istanbul ignore next */
|
|
119
|
-
class MultiRemoteDriver {
|
|
112
|
+
export class MultiRemoteDriver {
|
|
120
113
|
constructor(instances, propertiesObject) {
|
|
121
114
|
this.isMultiremote = true;
|
|
122
115
|
this.instances = Object.keys(instances);
|
|
@@ -157,4 +150,3 @@ class MultiRemoteDriver {
|
|
|
157
150
|
return undefined;
|
|
158
151
|
}
|
|
159
152
|
}
|
|
160
|
-
exports.MultiRemoteDriver = MultiRemoteDriver;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol-stub.d.ts","sourceRoot":"","sources":["../src/protocol-stub.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAgB,OAAO,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAO9C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,YAAY;WAChB,UAAU,CAAE,OAAO,EAAE,OAAO,CAAC,SAAS;
|
|
1
|
+
{"version":3,"file":"protocol-stub.d.ts","sourceRoot":"","sources":["../src/protocol-stub.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAgB,OAAO,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAO9C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,YAAY;WAChB,UAAU,CAAE,OAAO,EAAE,OAAO,CAAC,SAAS;IAcnD;;;OAGG;IACH,MAAM,CAAC,aAAa;IAIpB,MAAM,CAAC,eAAe,CAClB,OAAO,EAAE,aAAa,EACtB,QAAQ,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG;CAazC"}
|
package/build/protocol-stub.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const utils_1 = require("@wdio/utils");
|
|
1
|
+
import { capabilitiesEnvironmentDetector } from '@wdio/utils';
|
|
4
2
|
/**
|
|
5
3
|
* these commands can be used outside test scope and may be used accidentally by user before browser session is started
|
|
6
4
|
*/
|
|
@@ -9,13 +7,14 @@ const WARN_ON_COMMANDS = ['addCommand', 'overwriteCommand'];
|
|
|
9
7
|
* create `browser` object with capabilities and environment flags before session is started
|
|
10
8
|
* so that Mocha/Jasmine users can filter their specs based on flags or use capabilities in test titles
|
|
11
9
|
*/
|
|
12
|
-
class ProtocolStub {
|
|
10
|
+
export default class ProtocolStub {
|
|
13
11
|
static async newSession(options) {
|
|
14
12
|
const capabilities = emulateSessionCapabilities((options.capabilities || {}));
|
|
15
13
|
const browser = addCommands({
|
|
16
14
|
capabilities,
|
|
17
|
-
...
|
|
15
|
+
...capabilitiesEnvironmentDetector(capabilities, options._automationProtocol || 'webdriver')
|
|
18
16
|
});
|
|
17
|
+
browser.options = options;
|
|
19
18
|
return browser;
|
|
20
19
|
}
|
|
21
20
|
/**
|
|
@@ -37,7 +36,6 @@ class ProtocolStub {
|
|
|
37
36
|
}));
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
|
-
exports.default = ProtocolStub;
|
|
41
39
|
/**
|
|
42
40
|
* provide better visibility to users that want to add / overwrite commands
|
|
43
41
|
* before session is started
|
package/build/scripts/getHTML.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* get HTML of selector element
|
|
4
3
|
*
|
|
@@ -6,8 +5,6 @@
|
|
|
6
5
|
* @param {Boolean} includeSelectorTag if true, selector tag gets included (uses outerHTML)
|
|
7
6
|
* @return {String} html source
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
function getHTML(element, includeSelectorTag) {
|
|
8
|
+
export default function getHTML(element, includeSelectorTag) {
|
|
11
9
|
return element[includeSelectorTag ? 'outerHTML' : 'innerHTML'];
|
|
12
10
|
}
|
|
13
|
-
exports.default = getHTML;
|
|
@@ -4,17 +4,20 @@
|
|
|
4
4
|
* @param {String} property requested property
|
|
5
5
|
* @return {String} the value of the property
|
|
6
6
|
*/
|
|
7
|
-
export default function getProperty(element: HTMLElement, property: keyof HTMLElement): string | number | boolean | HTMLElement | Element | ChildNode | ParentNode | ((
|
|
7
|
+
export default function getProperty(element: HTMLElement, property: keyof HTMLElement): string | number | boolean | HTMLElement | Element | ChildNode | ParentNode | ((...nodes: (string | Node)[]) => void) | ((...nodes: (string | Node)[]) => void) | {
|
|
8
|
+
(options?: ScrollToOptions | undefined): void;
|
|
9
|
+
(x: number, y: number): void;
|
|
10
|
+
} | (() => void) | ((qualifiedName: string) => string | null) | ((arg?: boolean | ScrollIntoViewOptions | undefined) => void) | (() => void) | (() => ElementInternals) | {
|
|
8
11
|
<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
9
12
|
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
10
13
|
} | {
|
|
11
14
|
<K_1 extends keyof HTMLElementEventMap>(type: K_1, listener: (this: HTMLElement, ev: HTMLElementEventMap[K_1]) => any, options?: boolean | EventListenerOptions | undefined): void;
|
|
12
15
|
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
|
|
13
|
-
} | NamedNodeMap | DOMTokenList | ((this: Element, ev: Event) => any) | ((this: Element, ev: Event) => any) | ShadowRoot | ((init: ShadowRootInit) => ShadowRoot) | {
|
|
16
|
+
} | NamedNodeMap | DOMTokenList | ((this: Element, ev: Event) => any) | ((this: Element, ev: Event) => any) | Document | ShadowRoot | ((init: ShadowRootInit) => ShadowRoot) | {
|
|
14
17
|
<K_2 extends keyof HTMLElementTagNameMap>(selector: K_2): HTMLElementTagNameMap[K_2] | null;
|
|
15
18
|
<K_3 extends keyof SVGElementTagNameMap>(selector: K_3): SVGElementTagNameMap[K_3] | null;
|
|
16
19
|
<E extends Element = Element>(selectors: string): E | null;
|
|
17
|
-
} | ((
|
|
20
|
+
} | ((namespace: string | null, localName: string) => string | null) | (() => string[]) | ((qualifiedName: string) => Attr | null) | ((namespace: string | null, localName: string) => Attr | null) | (() => DOMRect) | (() => DOMRectList) | ((classNames: string) => HTMLCollectionOf<Element>) | {
|
|
18
21
|
<K_4 extends keyof HTMLElementTagNameMap>(qualifiedName: K_4): HTMLCollectionOf<HTMLElementTagNameMap[K_4]>;
|
|
19
22
|
<K_5 extends keyof SVGElementTagNameMap>(qualifiedName: K_5): HTMLCollectionOf<SVGElementTagNameMap[K_5]>;
|
|
20
23
|
(qualifiedName: string): HTMLCollectionOf<Element>;
|
|
@@ -28,10 +31,7 @@ export default function getProperty(element: HTMLElement, property: keyof HTMLEl
|
|
|
28
31
|
} | {
|
|
29
32
|
(options?: ScrollToOptions | undefined): void;
|
|
30
33
|
(x: number, y: number): void;
|
|
31
|
-
} | ((
|
|
32
|
-
(options?: ScrollToOptions | undefined): void;
|
|
33
|
-
(x: number, y: number): void;
|
|
34
|
-
} | ((qualifiedName: string, value: string) => void) | ((namespace: string | null, qualifiedName: string, value: string) => void) | ((attr: Attr) => Attr | null) | ((attr: Attr) => Attr | null) | ((pointerId: number) => void) | ((qualifiedName: string, force?: boolean | undefined) => boolean) | ((selectors: string) => boolean) | NodeListOf<ChildNode> | (<T extends Node>(node: T) => T) | ((deep?: boolean | undefined) => Node) | ((other: Node) => number) | ((other: Node | null) => boolean) | ((options?: GetRootNodeOptions | undefined) => Node) | (() => boolean) | (<T_1 extends Node>(node: T_1, child: Node | null) => T_1) | ((namespace: string | null) => boolean) | ((otherNode: Node | null) => boolean) | ((otherNode: Node | null) => boolean) | ((prefix: string | null) => string | null) | ((namespace: string | null) => string | null) | (() => void) | (<T_2 extends Node>(child: T_2) => T_2) | (<T_3 extends Node>(node: Node, child: T_3) => T_3) | ((keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions | undefined) => Animation) | ((options?: GetAnimationsOptions | undefined) => Animation[]) | ((...nodes: (string | Node)[]) => void) | ((...nodes: (string | Node)[]) => void) | (() => void) | ((...nodes: (string | Node)[]) => void) | HTMLCollection | ((...nodes: (string | Node)[]) => void) | ((...nodes: (string | Node)[]) => void) | {
|
|
34
|
+
} | ((qualifiedName: string, value: string) => void) | ((namespace: string | null, qualifiedName: string, value: string) => void) | ((attr: Attr) => Attr | null) | ((attr: Attr) => Attr | null) | ((pointerId: number) => void) | ((qualifiedName: string, force?: boolean | undefined) => boolean) | ((selectors: string) => boolean) | NodeListOf<ChildNode> | (<T extends Node>(node: T) => T) | ((deep?: boolean | undefined) => Node) | ((other: Node) => number) | ((other: Node | null) => boolean) | ((options?: GetRootNodeOptions | undefined) => Node) | (() => boolean) | (<T_1 extends Node>(node: T_1, child: Node | null) => T_1) | ((namespace: string | null) => boolean) | ((otherNode: Node | null) => boolean) | ((otherNode: Node | null) => boolean) | ((prefix: string | null) => string | null) | ((namespace: string | null) => string | null) | (<T_2 extends Node>(child: T_2) => T_2) | (<T_3 extends Node>(node: Node, child: T_3) => T_3) | ((event: Event) => boolean) | ((keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions | undefined) => Animation) | ((options?: GetAnimationsOptions | undefined) => Animation[]) | (() => void) | ((...nodes: (string | Node)[]) => void) | HTMLCollection | ((...nodes: (string | Node)[]) => void) | ((...nodes: (string | Node)[]) => void) | {
|
|
35
35
|
<K_6 extends keyof HTMLElementTagNameMap>(selectors: K_6): HTMLElementTagNameMap[K_6] | null;
|
|
36
36
|
<K_7 extends keyof SVGElementTagNameMap>(selectors: K_7): SVGElementTagNameMap[K_7] | null;
|
|
37
37
|
<E_1 extends Element = Element>(selectors: string): E_1 | null;
|
|
@@ -39,5 +39,5 @@ export default function getProperty(element: HTMLElement, property: keyof HTMLEl
|
|
|
39
39
|
<K_8 extends keyof HTMLElementTagNameMap>(selectors: K_8): NodeListOf<HTMLElementTagNameMap[K_8]>;
|
|
40
40
|
<K_9 extends keyof SVGElementTagNameMap>(selectors: K_9): NodeListOf<SVGElementTagNameMap[K_9]>;
|
|
41
41
|
<E_2 extends Element = Element>(selectors: string): NodeListOf<E_2>;
|
|
42
|
-
} | ((...nodes: (string | Node)[]) => void) | HTMLSlotElement | ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | CSSStyleDeclaration | DOMStringMap | (() => void) | ((options?: FocusOptions | undefined) => void) | undefined;
|
|
42
|
+
} | ((...nodes: (string | Node)[]) => void) | HTMLSlotElement | ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | CSSStyleDeclaration | ((this: GlobalEventHandlers, ev: UIEvent) => any) | ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | ((this: GlobalEventHandlers, ev: MouseEvent) => any) | ((this: GlobalEventHandlers, ev: FocusEvent) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: MouseEvent) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: MouseEvent) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: MouseEvent) => any) | ((this: GlobalEventHandlers, ev: DragEvent) => any) | ((this: GlobalEventHandlers, ev: DragEvent) => any) | ((this: GlobalEventHandlers, ev: DragEvent) => any) | ((this: GlobalEventHandlers, ev: DragEvent) => any) | ((this: GlobalEventHandlers, ev: DragEvent) => any) | ((this: GlobalEventHandlers, ev: DragEvent) => any) | ((this: GlobalEventHandlers, ev: DragEvent) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | OnErrorEventHandler | ((this: GlobalEventHandlers, ev: FocusEvent) => any) | ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | ((this: GlobalEventHandlers, ev: PointerEvent) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: PointerEvent) => any) | ((this: GlobalEventHandlers, ev: MouseEvent) => any) | ((this: GlobalEventHandlers, ev: MouseEvent) => any) | ((this: GlobalEventHandlers, ev: MouseEvent) => any) | ((this: GlobalEventHandlers, ev: MouseEvent) => any) | ((this: GlobalEventHandlers, ev: MouseEvent) => any) | ((this: GlobalEventHandlers, ev: MouseEvent) => any) | ((this: GlobalEventHandlers, ev: MouseEvent) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: PointerEvent) => any) | ((this: GlobalEventHandlers, ev: PointerEvent) => any) | ((this: GlobalEventHandlers, ev: PointerEvent) => any) | ((this: GlobalEventHandlers, ev: PointerEvent) => any) | ((this: GlobalEventHandlers, ev: PointerEvent) => any) | ((this: GlobalEventHandlers, ev: PointerEvent) => any) | ((this: GlobalEventHandlers, ev: PointerEvent) => any) | ((this: GlobalEventHandlers, ev: PointerEvent) => any) | ((this: GlobalEventHandlers, ev: ProgressEvent<EventTarget>) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: UIEvent) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: TouchEvent) => any) | ((this: GlobalEventHandlers, ev: TouchEvent) => any) | ((this: GlobalEventHandlers, ev: TouchEvent) => any) | ((this: GlobalEventHandlers, ev: TouchEvent) => any) | ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: Event) => any) | ((this: GlobalEventHandlers, ev: WheelEvent) => any) | DOMStringMap | (() => void) | ((options?: FocusOptions | undefined) => void) | undefined;
|
|
43
43
|
//# sourceMappingURL=getProperty.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProperty.d.ts","sourceRoot":"","sources":["../../src/scripts/getProperty.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"getProperty.d.ts","sourceRoot":"","sources":["../../src/scripts/getProperty.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wiKAErF"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/**
|
|
4
2
|
* get property from element
|
|
5
3
|
* @param {String} element element with requested property
|
|
6
4
|
* @param {String} property requested property
|
|
7
5
|
* @return {String} the value of the property
|
|
8
6
|
*/
|
|
9
|
-
function getProperty(element, property) {
|
|
7
|
+
export default function getProperty(element, property) {
|
|
10
8
|
return element[property];
|
|
11
9
|
}
|
|
12
|
-
exports.default = getProperty;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/**
|
|
4
2
|
* check if element is within the viewport or is overlapped by another element or disabled
|
|
5
3
|
* @param {HTMLElement} elem element to check
|
|
6
4
|
* @return {Boolean} false if element is not overlapped
|
|
7
5
|
*/
|
|
8
|
-
function isElementClickable(elem) {
|
|
6
|
+
export default function isElementClickable(elem) {
|
|
9
7
|
if (!elem.getBoundingClientRect || !elem.scrollIntoView || !elem.contains || !elem.getClientRects || !document.elementFromPoint) {
|
|
10
8
|
return false;
|
|
11
9
|
}
|
|
@@ -118,4 +116,3 @@ function isElementClickable(elem) {
|
|
|
118
116
|
}
|
|
119
117
|
return true;
|
|
120
118
|
}
|
|
121
|
-
exports.default = isElementClickable;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright (C) 2017 Apple Inc. All rights reserved.
|
|
4
3
|
*
|
|
@@ -23,13 +22,12 @@
|
|
|
23
22
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
24
23
|
* THE POSSIBILITY OF SUCH DAMAGE.
|
|
25
24
|
*/
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
25
|
/**
|
|
28
26
|
* check if element is visible
|
|
29
27
|
* @param {HTMLElement} elem element to check
|
|
30
28
|
* @return {Boolean} true if element is within viewport
|
|
31
29
|
*/
|
|
32
|
-
function isElementDisplayed(element) {
|
|
30
|
+
export default function isElementDisplayed(element) {
|
|
33
31
|
function nodeIsElement(node) {
|
|
34
32
|
if (!node) {
|
|
35
33
|
return false;
|
|
@@ -213,4 +211,3 @@ function isElementDisplayed(element) {
|
|
|
213
211
|
}
|
|
214
212
|
return true;
|
|
215
213
|
}
|
|
216
|
-
exports.default = isElementDisplayed;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/**
|
|
4
2
|
* check if element is within the viewport
|
|
5
3
|
* https://gist.github.com/davidtheclark/5515733#gistcomment-2113205
|
|
@@ -8,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
6
|
* @param {HTMLElement} elem element to check
|
|
9
7
|
* @return {Boolean} true if element is within viewport
|
|
10
8
|
*/
|
|
11
|
-
function isElementInViewport(elem) {
|
|
9
|
+
export default function isElementInViewport(elem) {
|
|
12
10
|
if (!elem.getBoundingClientRect) {
|
|
13
11
|
return false;
|
|
14
12
|
}
|
|
@@ -19,4 +17,3 @@ function isElementInViewport(elem) {
|
|
|
19
17
|
const horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) > 0);
|
|
20
18
|
return (vertInView && horInView);
|
|
21
19
|
}
|
|
22
|
-
exports.default = isElementInViewport;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/**
|
|
4
2
|
* checks if given element is focused
|
|
5
3
|
* @param {HTMLElement} elem element to check
|
|
6
4
|
* @return {Boolean} true if element is focused
|
|
7
5
|
*/
|
|
8
|
-
function isFocused(elem) {
|
|
6
|
+
export default function isFocused(elem) {
|
|
9
7
|
return elem === document.activeElement;
|
|
10
8
|
}
|
|
11
|
-
exports.default = isFocused;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/**
|
|
4
2
|
* opens new window via window.open
|
|
5
3
|
* @param {String} url The URL to be loaded in the newly opened window.
|
|
@@ -8,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
6
|
*
|
|
9
7
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window.open
|
|
10
8
|
*/
|
|
11
|
-
function newWindow(url, windowName, windowFeatures) {
|
|
9
|
+
export default function newWindow(url, windowName, windowFeatures) {
|
|
12
10
|
window.open(url, windowName || '', windowFeatures || '');
|
|
13
11
|
}
|
|
14
|
-
exports.default = newWindow;
|
package/build/scripts/resq.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.react$$ = exports.react$ = exports.waitToLoadReact = void 0;
|
|
4
|
-
const waitToLoadReact = function waitToLoadReact() {
|
|
1
|
+
export const waitToLoadReact = function waitToLoadReact() {
|
|
5
2
|
window.resq.waitToLoadReact();
|
|
6
3
|
};
|
|
7
|
-
|
|
8
|
-
const react$ = function react$(selector, props, state, reactElement) {
|
|
4
|
+
export const react$ = function react$(selector, props, state, reactElement) {
|
|
9
5
|
props = props || {};
|
|
10
6
|
state = state || {};
|
|
11
7
|
let element = window.resq.resq$(selector, reactElement);
|
|
@@ -26,8 +22,7 @@ const react$ = function react$(selector, props, state, reactElement) {
|
|
|
26
22
|
? element.node[0]
|
|
27
23
|
: element.node;
|
|
28
24
|
};
|
|
29
|
-
|
|
30
|
-
const react$$ = function react$$(selector, props, state, reactElement) {
|
|
25
|
+
export const react$$ = function react$$(selector, props, state, reactElement) {
|
|
31
26
|
let elements = window.resq.resq$$(selector, reactElement);
|
|
32
27
|
if (Object.keys(props).length) {
|
|
33
28
|
// not yet typed https://github.com/baruchvlz/resq/issues/69
|
|
@@ -55,4 +50,3 @@ const react$$ = function react$$(selector, props, state, reactElement) {
|
|
|
55
50
|
});
|
|
56
51
|
return [...nodes];
|
|
57
52
|
};
|
|
58
|
-
exports.react$$ = react$$;
|