@applitools/spec-driver-selenium 1.1.1 → 1.3.2
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/CHANGELOG.md +22 -0
- package/dist/index.js +22 -3
- package/dist/spec-driver.js +96 -72
- package/package.json +24 -12
- package/types/index.d.ts +39 -1
- package/types/spec-driver.d.ts +0 -54
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
## 1.3.2 - 2022/1/12
|
|
7
|
+
|
|
8
|
+
- no changes
|
|
9
|
+
|
|
10
|
+
## 1.3.1 - 2022/1/12
|
|
11
|
+
|
|
12
|
+
- use chromedriver instead of selenium docker container for testing
|
|
13
|
+
- fix tests for selenium 3
|
|
14
|
+
- fix `getCapabilities` for selenium 3
|
|
15
|
+
- updated to @applitools/types@1.0.23 (from 1.0.20)
|
|
16
|
+
- updated to @applitools/utils@1.2.11 (from 1.2.4)
|
|
17
|
+
|
|
18
|
+
## 1.3.0 - 2021/11/17
|
|
19
|
+
|
|
20
|
+
- implement `getCapabilities` and `getBarsHeight` instead of `getDriverInfo`
|
|
21
|
+
- updated to @applitools/types@1.0.20 (from 1.0.19)
|
|
22
|
+
|
|
23
|
+
## 1.2.0 - 2021/11/10
|
|
24
|
+
|
|
25
|
+
- updated to @applitools/types@1.0.19 (from 1.0.15)
|
|
26
|
+
- updated to @applitools/utils@1.2.4 (from 1.2.3)
|
|
27
|
+
|
|
6
28
|
## 1.1.1 - 2021/10/20
|
|
7
29
|
|
|
8
30
|
- install prettier
|
package/dist/index.js
CHANGED
|
@@ -6,13 +6,32 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
6
6
|
if (k2 === undefined) k2 = k;
|
|
7
7
|
o[k2] = m[k];
|
|
8
8
|
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
9
21
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
22
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
23
|
};
|
|
12
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
const spec = __importStar(require("./spec-driver"));
|
|
13
26
|
if (!process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
27
|
+
try {
|
|
28
|
+
const { version } = require('selenium-webdriver/package.json');
|
|
29
|
+
const [major] = version.split('.', 1);
|
|
30
|
+
process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION = major;
|
|
31
|
+
}
|
|
32
|
+
catch (_a) {
|
|
33
|
+
// NOTE: ignore error
|
|
34
|
+
}
|
|
17
35
|
}
|
|
18
36
|
__exportStar(require("./spec-driver"), exports);
|
|
37
|
+
exports.default = spec;
|
package/dist/spec-driver.js
CHANGED
|
@@ -30,12 +30,18 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
30
30
|
return t;
|
|
31
31
|
};
|
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.build = exports.performAction = exports.getElementText = exports.getElementAttribute = exports.getElementRegion = exports.getOrientation = exports.waitUntilDisplayed = exports.scrollIntoView = exports.type = exports.hover = exports.click = exports.takeScreenshot = exports.visit = exports.getUrl = exports.getTitle = exports.getDriverInfo = exports.setWindowSize = exports.getWindowSize = exports.findElements = exports.findElement = exports.childContext = exports.parentContext = exports.mainContext = exports.executeScript = exports.isEqualElements = exports.isStaleElementError = exports.transformSelector = exports.transformDriver = exports.isSelector = exports.isElement = exports.isDriver = void 0;
|
|
33
|
+
exports.build = exports.performAction = exports.getElementText = exports.getElementAttribute = exports.getElementRegion = exports.getOrientation = exports.getBarsHeight = exports.waitUntilDisplayed = exports.scrollIntoView = exports.type = exports.hover = exports.click = exports.takeScreenshot = exports.visit = exports.getUrl = exports.getTitle = exports.getCapabilities = exports.getDriverInfo = exports.getCookies = exports.setWindowSize = exports.getWindowSize = exports.findElements = exports.findElement = exports.childContext = exports.parentContext = exports.mainContext = exports.executeScript = exports.isEqualElements = exports.isStaleElementError = exports.transformSelector = exports.transformDriver = exports.isSelector = exports.isElement = exports.isDriver = void 0;
|
|
34
|
+
const Selenium = __importStar(require("selenium-webdriver"));
|
|
34
35
|
const utils = __importStar(require("@applitools/utils"));
|
|
35
36
|
// #region HELPERS
|
|
36
37
|
const byHash = ['className', 'css', 'id', 'js', 'linkText', 'name', 'partialLinkText', 'tagName', 'xpath'];
|
|
37
38
|
function extractElementId(element) {
|
|
38
|
-
return element.getId();
|
|
39
|
+
return isElement(element) ? element.getId() : element['shadow-6066-11e4-a52e-4f735466cecf'];
|
|
40
|
+
}
|
|
41
|
+
function transformShadowRoot(driver, shadowRoot) {
|
|
42
|
+
return isElement(shadowRoot)
|
|
43
|
+
? shadowRoot
|
|
44
|
+
: new Selenium.WebElement(driver, shadowRoot['shadow-6066-11e4-a52e-4f735466cecf']);
|
|
39
45
|
}
|
|
40
46
|
// #endregion
|
|
41
47
|
// #region UTILITY
|
|
@@ -57,7 +63,11 @@ function transformDriver(driver) {
|
|
|
57
63
|
driver.getExecutor().defineCommand('getSessionDetails', 'GET', '/session/:sessionId');
|
|
58
64
|
driver.getExecutor().defineCommand('getOrientation', 'GET', '/session/:sessionId/orientation');
|
|
59
65
|
driver.getExecutor().defineCommand('getSystemBars', 'GET', '/session/:sessionId/appium/device/system_bars');
|
|
66
|
+
driver.getExecutor().defineCommand('getWindowSize', 'GET', '/session/:sessionId/window/current/size');
|
|
67
|
+
driver.getExecutor().defineCommand('setWindowSize', 'POST', '/session/:sessionId/window/current/size');
|
|
68
|
+
driver.getExecutor().defineCommand('setWindowPosition', 'POST', '/session/:sessionId/window/current/position');
|
|
60
69
|
driver.getExecutor().defineCommand('performTouch', 'POST', '/session/:sessionId/touch/perform');
|
|
70
|
+
driver.getExecutor().defineCommand('executeCdp', 'POST', '/session/:sessionId/chromium/send_command_and_get_result');
|
|
61
71
|
if (process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3') {
|
|
62
72
|
driver.getExecutor().defineCommand('switchToParentFrame', 'POST', '/session/:sessionId/frame/parent');
|
|
63
73
|
}
|
|
@@ -124,7 +134,7 @@ async function childContext(driver, element) {
|
|
|
124
134
|
exports.childContext = childContext;
|
|
125
135
|
async function findElement(driver, selector, parent) {
|
|
126
136
|
try {
|
|
127
|
-
const root = parent
|
|
137
|
+
const root = parent ? transformShadowRoot(driver, parent) : driver;
|
|
128
138
|
return await root.findElement(selector);
|
|
129
139
|
}
|
|
130
140
|
catch (err) {
|
|
@@ -136,90 +146,94 @@ async function findElement(driver, selector, parent) {
|
|
|
136
146
|
}
|
|
137
147
|
exports.findElement = findElement;
|
|
138
148
|
async function findElements(driver, selector, parent) {
|
|
139
|
-
const root = parent
|
|
149
|
+
const root = parent ? transformShadowRoot(driver, parent) : driver;
|
|
140
150
|
return root.findElements(selector);
|
|
141
151
|
}
|
|
142
152
|
exports.findElements = findElements;
|
|
143
153
|
async function getWindowSize(driver) {
|
|
144
154
|
try {
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
return await window.getSize();
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
const rect = await window.getRect();
|
|
151
|
-
return { width: rect.width, height: rect.height };
|
|
152
|
-
}
|
|
155
|
+
const rect = await driver.manage().window().getRect();
|
|
156
|
+
return { width: rect.width, height: rect.height };
|
|
153
157
|
}
|
|
154
|
-
catch (
|
|
155
|
-
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
+
catch (_a) {
|
|
159
|
+
const { Command } = require('selenium-webdriver/lib/command');
|
|
160
|
+
const getWindowSizeCommand = new Command('getWindowSize');
|
|
161
|
+
const size = driver.manage().window().getSize
|
|
162
|
+
? await driver.manage().window().getSize()
|
|
163
|
+
: await driver.execute(getWindowSizeCommand);
|
|
164
|
+
return { width: size.width, height: size.height };
|
|
158
165
|
}
|
|
159
166
|
}
|
|
160
167
|
exports.getWindowSize = getWindowSize;
|
|
161
168
|
async function setWindowSize(driver, size) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
await window.setRect({ x: 0, y: 0, width: size.width, height: size.height });
|
|
169
|
+
try {
|
|
170
|
+
await driver.manage().window().setRect({ x: 0, y: 0, width: size.width, height: size.height });
|
|
165
171
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
172
|
+
catch (_a) {
|
|
173
|
+
const { Command } = require('selenium-webdriver/lib/command');
|
|
174
|
+
const setWindowPositionCommand = new Command('setWindowPosition').setParameters({ x: 0, y: 0 });
|
|
175
|
+
if (driver.manage().window().setPosition)
|
|
176
|
+
await driver.manage().window().setPosition(0, 0);
|
|
177
|
+
else
|
|
178
|
+
await driver.execute(setWindowPositionCommand);
|
|
179
|
+
const setWindowSizeCommand = new Command('setWindowSize').setParameters(Object.assign({}, size));
|
|
180
|
+
if (driver.manage().window().setSize)
|
|
181
|
+
await driver.manage().window().setSize(size.width, size.height);
|
|
182
|
+
else
|
|
183
|
+
await driver.execute(setWindowSizeCommand);
|
|
169
184
|
}
|
|
170
185
|
}
|
|
171
186
|
exports.setWindowSize = setWindowSize;
|
|
187
|
+
async function getCookies(driver, context) {
|
|
188
|
+
if (context)
|
|
189
|
+
return driver.manage().getCookies();
|
|
190
|
+
let cookies;
|
|
191
|
+
if (utils.types.isFunction(driver, 'sendAndGetDevToolsCommand')) {
|
|
192
|
+
const response = await driver.sendAndGetDevToolsCommand('Network.getAllCookies');
|
|
193
|
+
cookies = response.cookies;
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
const { Command } = require('selenium-webdriver/lib/command');
|
|
197
|
+
const executeCdpCommand = new Command('executeCdp')
|
|
198
|
+
.setParameter('cmd', 'Network.getAllCookies')
|
|
199
|
+
.setParameter('params', {});
|
|
200
|
+
const response = process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3'
|
|
201
|
+
? await driver.schedule(executeCdpCommand)
|
|
202
|
+
: await driver.execute(executeCdpCommand);
|
|
203
|
+
cookies = response.cookies;
|
|
204
|
+
}
|
|
205
|
+
return cookies.map((cookie) => {
|
|
206
|
+
const copy = Object.assign(Object.assign({}, cookie), { expiry: cookie.expires });
|
|
207
|
+
delete copy.expires;
|
|
208
|
+
delete copy.size;
|
|
209
|
+
delete copy.priority;
|
|
210
|
+
delete copy.session;
|
|
211
|
+
delete copy.sameParty;
|
|
212
|
+
delete copy.sourceScheme;
|
|
213
|
+
delete copy.sourcePort;
|
|
214
|
+
return copy;
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
exports.getCookies = getCookies;
|
|
172
218
|
async function getDriverInfo(driver) {
|
|
173
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
174
219
|
const session = await driver.getSession();
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
sessionId: session.getId(),
|
|
181
|
-
isMobile,
|
|
182
|
-
isNative: isMobile && !capabilities.get('browserName'),
|
|
183
|
-
deviceName: (_d = desiredCapabilities.deviceName) !== null && _d !== void 0 ? _d : capabilities.get('deviceName'),
|
|
184
|
-
platformName,
|
|
185
|
-
platformVersion: capabilities.get('platformVersion'),
|
|
186
|
-
browserName: (_e = capabilities.get('browserName')) !== null && _e !== void 0 ? _e : desiredCapabilities === null || desiredCapabilities === void 0 ? void 0 : desiredCapabilities.browserName,
|
|
187
|
-
browserVersion: (_f = capabilities.get('browserVersion')) !== null && _f !== void 0 ? _f : capabilities.get('version'),
|
|
188
|
-
};
|
|
189
|
-
if (info.isNative) {
|
|
220
|
+
return { sessionId: session.getId() };
|
|
221
|
+
}
|
|
222
|
+
exports.getDriverInfo = getDriverInfo;
|
|
223
|
+
async function getCapabilities(driver) {
|
|
224
|
+
try {
|
|
190
225
|
const { Command } = require('selenium-webdriver/lib/command');
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
const getSessionDetailsCommand = new Command('getSessionDetails');
|
|
201
|
-
details =
|
|
202
|
-
process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3'
|
|
203
|
-
? await driver.schedule(getSessionDetailsCommand)
|
|
204
|
-
: await driver.execute(getSessionDetailsCommand);
|
|
205
|
-
}
|
|
206
|
-
info.pixelRatio = details.pixelRatio;
|
|
207
|
-
try {
|
|
208
|
-
const getSystemBars = new Command('getSystemBars');
|
|
209
|
-
const { statusBar, navigationBar } = process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3'
|
|
210
|
-
? await driver.schedule(getSystemBars)
|
|
211
|
-
: await driver.execute(getSystemBars);
|
|
212
|
-
info.statusBarHeight = statusBar.visible ? statusBar.height : 0;
|
|
213
|
-
info.navigationBarHeight = navigationBar.visible ? navigationBar.height : 0;
|
|
214
|
-
}
|
|
215
|
-
catch (err) {
|
|
216
|
-
info.statusBarHeight = (_j = (_g = details.statBarHeight) !== null && _g !== void 0 ? _g : (_h = details.viewportRect) === null || _h === void 0 ? void 0 : _h.top) !== null && _j !== void 0 ? _j : 0;
|
|
217
|
-
info.navigationBarHeight = 0;
|
|
218
|
-
}
|
|
226
|
+
const getSessionDetailsCommand = new Command('getSessionDetails');
|
|
227
|
+
return process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3'
|
|
228
|
+
? await driver.schedule(getSessionDetailsCommand)
|
|
229
|
+
: await driver.execute(getSessionDetailsCommand);
|
|
230
|
+
}
|
|
231
|
+
catch (_a) {
|
|
232
|
+
const capabilities = await driver.getCapabilities();
|
|
233
|
+
return Array.from(capabilities.keys()).reduce((obj, key) => Object.assign(obj, { key: capabilities.get(key) }), {});
|
|
219
234
|
}
|
|
220
|
-
return info;
|
|
221
235
|
}
|
|
222
|
-
exports.
|
|
236
|
+
exports.getCapabilities = getCapabilities;
|
|
223
237
|
async function getTitle(driver) {
|
|
224
238
|
return driver.getTitle();
|
|
225
239
|
}
|
|
@@ -268,13 +282,24 @@ async function scrollIntoView(driver, element, align = false) {
|
|
|
268
282
|
}
|
|
269
283
|
exports.scrollIntoView = scrollIntoView;
|
|
270
284
|
async function waitUntilDisplayed(driver, selector, timeout) {
|
|
271
|
-
const { until } = require('selenium-webdriver');
|
|
272
285
|
const element = await findElement(driver, selector);
|
|
273
|
-
await driver.wait(until.elementIsVisible(element), timeout);
|
|
286
|
+
await driver.wait(Selenium.until.elementIsVisible(element), timeout);
|
|
274
287
|
}
|
|
275
288
|
exports.waitUntilDisplayed = waitUntilDisplayed;
|
|
276
289
|
// #endregion
|
|
277
290
|
// #region MOBILE COMMANDS
|
|
291
|
+
async function getBarsHeight(driver) {
|
|
292
|
+
const { Command } = require('selenium-webdriver/lib/command');
|
|
293
|
+
const getSystemBarsCommand = new Command('getSystemBars');
|
|
294
|
+
const { statusBar, navigationBar } = process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3'
|
|
295
|
+
? await driver.schedule(getSystemBarsCommand)
|
|
296
|
+
: await driver.execute(getSystemBarsCommand);
|
|
297
|
+
return {
|
|
298
|
+
statusBarHeight: statusBar.visible ? statusBar.height : 0,
|
|
299
|
+
navigationBarHeight: navigationBar.visible ? navigationBar.height : 0,
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
exports.getBarsHeight = getBarsHeight;
|
|
278
303
|
async function getOrientation(driver) {
|
|
279
304
|
const { Command } = require('selenium-webdriver/lib/command');
|
|
280
305
|
const getOrientationCommand = new Command('getOrientation');
|
|
@@ -327,7 +352,6 @@ const browserOptionsNames = {
|
|
|
327
352
|
};
|
|
328
353
|
async function build(env) {
|
|
329
354
|
var _a;
|
|
330
|
-
const { Builder } = require('selenium-webdriver');
|
|
331
355
|
const parseEnv = require('@applitools/test-utils/src/parse-env');
|
|
332
356
|
const { browser, capabilities, url, attach, proxy, configurable = true, appium = false, args = [], headless, } = parseEnv(Object.assign(Object.assign({}, env), { legacy: (_a = env.legacy) !== null && _a !== void 0 ? _a : process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3' }));
|
|
333
357
|
const desiredCapabilities = Object.assign({}, capabilities);
|
|
@@ -349,7 +373,7 @@ async function build(env) {
|
|
|
349
373
|
if (appium && browser === 'chrome') {
|
|
350
374
|
desiredCapabilities['appium:chromeOptions'] = { w3c: false };
|
|
351
375
|
}
|
|
352
|
-
const builder = new Builder().withCapabilities(desiredCapabilities);
|
|
376
|
+
const builder = new Selenium.Builder().withCapabilities(desiredCapabilities);
|
|
353
377
|
if (url && !attach)
|
|
354
378
|
builder.usingServer(url.href);
|
|
355
379
|
if (proxy) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/spec-driver-selenium",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"selenium",
|
|
6
6
|
"selenium-webdriver",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
},
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
|
-
"url": "git://github.com/applitools/eyes.sdk.javascript1.git"
|
|
20
|
+
"url": "git://github.com/applitools/eyes.sdk.javascript1.git",
|
|
21
|
+
"directory": "packages/spec-driver-selenium"
|
|
21
22
|
},
|
|
22
23
|
"license": "SEE LICENSE IN LICENSE",
|
|
23
24
|
"author": {
|
|
@@ -26,20 +27,27 @@
|
|
|
26
27
|
},
|
|
27
28
|
"main": "./dist/index.js",
|
|
28
29
|
"types": "./types/index.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"default": "./dist/index.js",
|
|
33
|
+
"types": "./types/index.d.ts"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
29
36
|
"files": [
|
|
30
37
|
"dist",
|
|
31
38
|
"types"
|
|
32
39
|
],
|
|
33
40
|
"scripts": {
|
|
34
41
|
"lint": "eslint '**/*.ts'",
|
|
35
|
-
"build": "
|
|
36
|
-
"build:dist": "tsc",
|
|
42
|
+
"build": "ttsc",
|
|
37
43
|
"test": "mocha ./test/**/*.spec.ts --no-timeouts -r ts-node/register -r @applitools/test-utils/mocha-hooks/docker",
|
|
38
|
-
"setup": "yarn
|
|
44
|
+
"setup": "yarn chromedriver:setup",
|
|
45
|
+
"chromedriver:setup": "chromedriver --port=4444 --url-base=/wd/hub &",
|
|
39
46
|
"docker:setup": "node ../scripts/scripts/generate-docker-compose-config.js && docker-compose up -d",
|
|
40
47
|
"docker:teardown": "docker-compose down",
|
|
48
|
+
"upgrade:framework": "if [ ! -z $APPLITOOLS_SELENIUM_MAJOR_VERSION ]; then packagejson=`cat package.json`; yarn upgrade --no-lockfile selenium-webdriver@$APPLITOOLS_SELENIUM_MAJOR_VERSION; echo \"$packagejson\" > package.json; fi",
|
|
41
49
|
"deps": "bongo deps",
|
|
42
|
-
"gh:test": "gh workflow run test.yml --ref $(git rev-parse --abbrev-ref HEAD) -f packages='spec-selenium spec-selenium@3' -f links='test-utils
|
|
50
|
+
"gh:test": "gh workflow run test.yml --ref $(git rev-parse --abbrev-ref HEAD) -f packages='spec-selenium spec-selenium@3' -f links='types utils test-utils'",
|
|
43
51
|
"gh:publish": "gh workflow run publish.yml --ref $(git rev-parse --abbrev-ref HEAD) -f packages='spec-selenium'",
|
|
44
52
|
"preversion": "bongo preversion",
|
|
45
53
|
"version": "bongo version",
|
|
@@ -51,17 +59,20 @@
|
|
|
51
59
|
}
|
|
52
60
|
},
|
|
53
61
|
"dependencies": {
|
|
54
|
-
"@applitools/
|
|
62
|
+
"@applitools/types": "1.0.23",
|
|
63
|
+
"@applitools/utils": "1.2.11"
|
|
55
64
|
},
|
|
56
65
|
"devDependencies": {
|
|
57
|
-
"@applitools/
|
|
58
|
-
"@applitools/
|
|
59
|
-
"@applitools/
|
|
66
|
+
"@applitools/api-extractor": "^1.2.6",
|
|
67
|
+
"@applitools/scripts": "1.1.0",
|
|
68
|
+
"@applitools/sdk-release-kit": "0.13.10",
|
|
69
|
+
"@applitools/test-utils": "1.0.10",
|
|
60
70
|
"@types/mocha": "^9.0.0",
|
|
61
71
|
"@types/node": "^16.10.2",
|
|
62
72
|
"@types/selenium-webdriver": "^4.0.15",
|
|
63
73
|
"@typescript-eslint/eslint-plugin": "^4.15.1",
|
|
64
74
|
"@typescript-eslint/parser": "^4.15.1",
|
|
75
|
+
"chromedriver": "^96",
|
|
65
76
|
"eslint": "^7.9.0",
|
|
66
77
|
"eslint-config-prettier": "^7.2.0",
|
|
67
78
|
"eslint-plugin-mocha-no-only": "^1.1.1",
|
|
@@ -70,9 +81,10 @@
|
|
|
70
81
|
"husky": "^4.3.7",
|
|
71
82
|
"mocha": "^9.1.2",
|
|
72
83
|
"prettier": "^2.4.1",
|
|
73
|
-
"selenium-webdriver": "^4.
|
|
84
|
+
"selenium-webdriver": "^4.1.1",
|
|
74
85
|
"ts-node": "^10.2.1",
|
|
75
|
-
"
|
|
86
|
+
"ttypescript": "^1.5.12",
|
|
87
|
+
"typescript": "^4.5.4"
|
|
76
88
|
},
|
|
77
89
|
"peerDependencies": {
|
|
78
90
|
"selenium-webdriver": ">=3.6.0"
|
package/types/index.d.ts
CHANGED
|
@@ -1 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: import('@applitools/types').SpecDriver<Driver, Driver, Element, Selector>;
|
|
2
|
+
export default _default;
|
|
3
|
+
export function isDriver(driver: any): driver is Driver;
|
|
4
|
+
export function isElement(element: any): element is Element;
|
|
5
|
+
export function isSelector(selector: any): selector is Selector;
|
|
6
|
+
export function transformDriver(driver: Driver): Driver;
|
|
7
|
+
export function transformSelector(selector: Selector | (string | { selector: string | Selector; type?: string; })): Selector;
|
|
8
|
+
export function isStaleElementError(error: any): boolean;
|
|
9
|
+
export function isEqualElements(_driver: Driver, element1: Element, element2: Element): Promise<boolean>;
|
|
10
|
+
export function executeScript(driver: Driver, script: string | ((arg: any) => any), arg: any): Promise<any>;
|
|
11
|
+
export function mainContext(driver: Driver): Promise<Driver>;
|
|
12
|
+
export function parentContext(driver: Driver): Promise<Driver>;
|
|
13
|
+
export function childContext(driver: Driver, element: Element): Promise<Driver>;
|
|
14
|
+
export function findElement(driver: Driver, selector: Selector, parent?: Element): Promise<Element>;
|
|
15
|
+
export function findElements(driver: Driver, selector: Selector, parent?: Element): Promise<Array<Element>>;
|
|
16
|
+
export function getWindowSize(driver: Driver): Promise<import('@applitools/types').Size>;
|
|
17
|
+
export function setWindowSize(driver: Driver, size: import('@applitools/types').Size): Promise<void>;
|
|
18
|
+
export function getCookies(driver: Driver, context?: boolean): Promise<Array<import('@applitools/types').Cookie>>;
|
|
19
|
+
export function getDriverInfo(driver: Driver): Promise<import('@applitools/types').DriverInfo>;
|
|
20
|
+
export function getCapabilities(driver: Driver): Promise<Record<string, any>>;
|
|
21
|
+
export function getTitle(driver: Driver): Promise<string>;
|
|
22
|
+
export function getUrl(driver: Driver): Promise<string>;
|
|
23
|
+
export function visit(driver: Driver, url: string): Promise<void>;
|
|
24
|
+
export function takeScreenshot(driver: Driver): Promise<string>;
|
|
25
|
+
export function click(driver: Driver, element: Element | Selector): Promise<void>;
|
|
26
|
+
export function hover(driver: Driver, element: Element | Selector): Promise<void>;
|
|
27
|
+
export function type(driver: Driver, element: Element | Selector, keys: string): Promise<void>;
|
|
28
|
+
export function scrollIntoView(driver: Driver, element: Element | Selector, align: boolean): Promise<void>;
|
|
29
|
+
export function waitUntilDisplayed(driver: Driver, selector: Selector, timeout: number): Promise<void>;
|
|
30
|
+
export function getBarsHeight(driver: Driver): Promise<{ statusBarHeight: number; navigationBarHeight: number; }>;
|
|
31
|
+
export function getOrientation(driver: Driver): Promise<"portrait" | "landscape">;
|
|
32
|
+
export function getElementRegion(_driver: Driver, element: Element): Promise<import('@applitools/types').Region>;
|
|
33
|
+
export function getElementAttribute(_driver: Driver, element: Element, attr: string): Promise<string>;
|
|
34
|
+
export function getElementText(_driver: Driver, element: Element): Promise<string>;
|
|
35
|
+
export function performAction(driver: Driver, steps: Array<any>): Promise<void>;
|
|
36
|
+
export function build(env: any): Promise<[Driver, () => Promise<void>]>;
|
|
37
|
+
export type Driver = import('selenium-webdriver').WebDriver & { __applitoolsBrand?: never; };
|
|
38
|
+
export type Element = import('selenium-webdriver').WebElement & { __applitoolsBrand?: never; };
|
|
39
|
+
export type Selector = (import('selenium-webdriver').Locator | { using: string; value: string; }) & { __applitoolsBrand?: never; };
|
package/types/spec-driver.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type * as Selenium from 'selenium-webdriver';
|
|
2
|
-
export declare type Driver = Selenium.WebDriver;
|
|
3
|
-
export declare type Element = Selenium.WebElement;
|
|
4
|
-
export declare type Selector = Selenium.Locator | {
|
|
5
|
-
using: string;
|
|
6
|
-
value: string;
|
|
7
|
-
};
|
|
8
|
-
declare type CommonSelector = string | {
|
|
9
|
-
selector: Selector | string;
|
|
10
|
-
type?: string;
|
|
11
|
-
};
|
|
12
|
-
export declare function isDriver(driver: any): driver is Driver;
|
|
13
|
-
export declare function isElement(element: any): element is Element;
|
|
14
|
-
export declare function isSelector(selector: any): selector is Selector;
|
|
15
|
-
export declare function transformDriver(driver: Driver): Driver;
|
|
16
|
-
export declare function transformSelector(selector: Selector | CommonSelector): Selector;
|
|
17
|
-
export declare function isStaleElementError(error: any): boolean;
|
|
18
|
-
export declare function isEqualElements(_driver: Driver, element1: Element, element2: Element): Promise<boolean>;
|
|
19
|
-
export declare function executeScript(driver: Driver, script: ((arg: any) => any) | string, arg: any): Promise<any>;
|
|
20
|
-
export declare function mainContext(driver: Driver): Promise<Driver>;
|
|
21
|
-
export declare function parentContext(driver: Driver): Promise<Driver>;
|
|
22
|
-
export declare function childContext(driver: Driver, element: Element): Promise<Driver>;
|
|
23
|
-
export declare function findElement(driver: Driver, selector: Selector, parent?: Element): Promise<Element>;
|
|
24
|
-
export declare function findElements(driver: Driver, selector: Selector, parent?: Element): Promise<Element[]>;
|
|
25
|
-
export declare function getWindowSize(driver: Driver): Promise<{
|
|
26
|
-
width: number;
|
|
27
|
-
height: number;
|
|
28
|
-
}>;
|
|
29
|
-
export declare function setWindowSize(driver: Driver, size: {
|
|
30
|
-
width: number;
|
|
31
|
-
height: number;
|
|
32
|
-
}): Promise<void>;
|
|
33
|
-
export declare function getDriverInfo(driver: Driver): Promise<any>;
|
|
34
|
-
export declare function getTitle(driver: Driver): Promise<string>;
|
|
35
|
-
export declare function getUrl(driver: Driver): Promise<string>;
|
|
36
|
-
export declare function visit(driver: Driver, url: string): Promise<void>;
|
|
37
|
-
export declare function takeScreenshot(driver: Driver): Promise<string>;
|
|
38
|
-
export declare function click(driver: Driver, element: Element | Selector): Promise<void>;
|
|
39
|
-
export declare function hover(driver: Driver, element: Element | Selector): Promise<void>;
|
|
40
|
-
export declare function type(driver: Driver, element: Element | Selector, keys: string): Promise<void>;
|
|
41
|
-
export declare function scrollIntoView(driver: Driver, element: Element | Selector, align?: boolean): Promise<void>;
|
|
42
|
-
export declare function waitUntilDisplayed(driver: Driver, selector: Selector, timeout: number): Promise<void>;
|
|
43
|
-
export declare function getOrientation(driver: Driver): Promise<'portrait' | 'landscape'>;
|
|
44
|
-
export declare function getElementRegion(_driver: Driver, element: Element): Promise<{
|
|
45
|
-
x: number;
|
|
46
|
-
y: number;
|
|
47
|
-
width: number;
|
|
48
|
-
height: number;
|
|
49
|
-
}>;
|
|
50
|
-
export declare function getElementAttribute(_driver: Driver, element: Element, attr: string): Promise<string>;
|
|
51
|
-
export declare function getElementText(_driver: Driver, element: Element): Promise<string>;
|
|
52
|
-
export declare function performAction(driver: Driver, steps: any[]): Promise<void>;
|
|
53
|
-
export declare function build(env: any): Promise<[Driver, () => Promise<void>]>;
|
|
54
|
-
export {};
|