@applitools/spec-driver-selenium 1.5.54 → 1.5.56
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 +55 -0
- package/dist/spec-driver.js +104 -122
- package/package.json +4 -4
- package/types/index.d.ts +35 -29
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,60 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.5.56](https://github.com/applitools/eyes.sdk.javascript1/compare/js/spec-driver-selenium@1.5.55...js/spec-driver-selenium@1.5.56) (2023-08-18)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Code Refactoring
|
|
7
|
+
|
|
8
|
+
* refactored spec driver interface ([#1839](https://github.com/applitools/eyes.sdk.javascript1/issues/1839)) ([aa49ec2](https://github.com/applitools/eyes.sdk.javascript1/commit/aa49ec2a7d14b8529acc3a8a4c2baecfa113d98a))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* @applitools/utils bumped to 1.5.1
|
|
14
|
+
#### Code Refactoring
|
|
15
|
+
|
|
16
|
+
* refactored spec driver interface ([#1839](https://github.com/applitools/eyes.sdk.javascript1/issues/1839)) ([aa49ec2](https://github.com/applitools/eyes.sdk.javascript1/commit/aa49ec2a7d14b8529acc3a8a4c2baecfa113d98a))
|
|
17
|
+
* @applitools/logger bumped to 2.0.8
|
|
18
|
+
#### Code Refactoring
|
|
19
|
+
|
|
20
|
+
* refactored spec driver interface ([#1839](https://github.com/applitools/eyes.sdk.javascript1/issues/1839)) ([aa49ec2](https://github.com/applitools/eyes.sdk.javascript1/commit/aa49ec2a7d14b8529acc3a8a4c2baecfa113d98a))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
* @applitools/snippets bumped to 2.4.23
|
|
25
|
+
#### Code Refactoring
|
|
26
|
+
|
|
27
|
+
* refactored spec driver interface ([#1839](https://github.com/applitools/eyes.sdk.javascript1/issues/1839)) ([aa49ec2](https://github.com/applitools/eyes.sdk.javascript1/commit/aa49ec2a7d14b8529acc3a8a4c2baecfa113d98a))
|
|
28
|
+
* @applitools/driver bumped to 1.13.5
|
|
29
|
+
#### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* optimize driver usage in close ([#1867](https://github.com/applitools/eyes.sdk.javascript1/issues/1867)) ([60dff6b](https://github.com/applitools/eyes.sdk.javascript1/commit/60dff6b160e69d3893c91a1125d668fa18b43072))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
#### Code Refactoring
|
|
35
|
+
|
|
36
|
+
* refactored spec driver interface ([#1839](https://github.com/applitools/eyes.sdk.javascript1/issues/1839)) ([aa49ec2](https://github.com/applitools/eyes.sdk.javascript1/commit/aa49ec2a7d14b8529acc3a8a4c2baecfa113d98a))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## [1.5.55](https://github.com/applitools/eyes.sdk.javascript1/compare/js/spec-driver-selenium@1.5.54...js/spec-driver-selenium@1.5.55) (2023-08-03)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### Dependencies
|
|
45
|
+
|
|
46
|
+
* @applitools/driver bumped to 1.13.4
|
|
47
|
+
#### Bug Fixes
|
|
48
|
+
|
|
49
|
+
* extract device orientation from a browser for web executions ([d8d4e91](https://github.com/applitools/eyes.sdk.javascript1/commit/d8d4e919965fb9105915e762c397ec2cc57a8a71))
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
* @applitools/snippets bumped to 2.4.22
|
|
54
|
+
#### Bug Fixes
|
|
55
|
+
|
|
56
|
+
* improve orientation extraction for ios devices ([378d989](https://github.com/applitools/eyes.sdk.javascript1/commit/378d9894e4fbc7247087ccb8c46266dc4737e2e5))
|
|
57
|
+
|
|
3
58
|
## [1.5.54](https://github.com/applitools/eyes.sdk.javascript1/compare/js/spec-driver-selenium@1.5.53...js/spec-driver-selenium@1.5.54) (2023-07-21)
|
|
4
59
|
|
|
5
60
|
|
package/dist/spec-driver.js
CHANGED
|
@@ -23,12 +23,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.build = exports.switchWorld = exports.getWorlds = exports.getCurrentWorld = exports.
|
|
26
|
+
exports.build = exports.switchWorld = exports.getWorlds = exports.getCurrentWorld = exports.takeScreenshot = exports.performAction = exports.visit = exports.getUrl = exports.getTitle = exports.getCookies = exports.getSystemBars = exports.setOrientation = exports.getOrientation = exports.setWindowSize = exports.getWindowSize = exports.getCapabilities = exports.getDriverInfo = exports.childContext = exports.parentContext = exports.mainContext = exports.click = exports.hover = exports.getElementText = exports.setElementText = exports.getElementAttribute = exports.getElementRegion = exports.waitForSelector = exports.findElements = exports.findElement = exports.executeScript = exports.toSimpleCommonSelector = exports.toSelector = exports.toDriver = exports.isStaleElementError = exports.isEqualElements = exports.isSelector = exports.isElement = exports.isDriver = void 0;
|
|
27
27
|
const command_1 = require("selenium-webdriver/lib/command");
|
|
28
28
|
const Selenium = __importStar(require("selenium-webdriver"));
|
|
29
29
|
const utils = __importStar(require("@applitools/utils"));
|
|
30
|
-
// #region HELPERS
|
|
31
|
-
const byHash = ['className', 'css', 'id', 'js', 'linkText', 'name', 'partialLinkText', 'tagName', 'xpath'];
|
|
32
30
|
function extractElementId(element) {
|
|
33
31
|
return isElement(element) ? element.getId() : element['shadow-6066-11e4-a52e-4f735466cecf'];
|
|
34
32
|
}
|
|
@@ -37,6 +35,7 @@ function transformShadowRoot(driver, shadowRoot) {
|
|
|
37
35
|
? new Selenium.WebElement(driver, shadowRoot['shadow-6066-11e4-a52e-4f735466cecf'])
|
|
38
36
|
: shadowRoot;
|
|
39
37
|
}
|
|
38
|
+
const byHash = ['className', 'css', 'id', 'js', 'linkText', 'name', 'partialLinkText', 'tagName', 'xpath'];
|
|
40
39
|
function isByHashSelector(selector) {
|
|
41
40
|
return byHash.includes(Object.keys(selector)[0]);
|
|
42
41
|
}
|
|
@@ -45,8 +44,6 @@ async function executeCustomCommand(driver, command) {
|
|
|
45
44
|
? driver.schedule(command)
|
|
46
45
|
: driver.execute(command);
|
|
47
46
|
}
|
|
48
|
-
// #endregion
|
|
49
|
-
// #region UTILITY
|
|
50
47
|
function isDriver(driver) {
|
|
51
48
|
return utils.types.instanceOf(driver, 'WebDriver');
|
|
52
49
|
}
|
|
@@ -64,7 +61,22 @@ function isSelector(selector) {
|
|
|
64
61
|
utils.types.instanceOf(selector, 'RelativeBy'));
|
|
65
62
|
}
|
|
66
63
|
exports.isSelector = isSelector;
|
|
67
|
-
function
|
|
64
|
+
async function isEqualElements(_driver, element1, element2) {
|
|
65
|
+
if (!element1 || !element2)
|
|
66
|
+
return false;
|
|
67
|
+
const elementId1 = await extractElementId(element1);
|
|
68
|
+
const elementId2 = await extractElementId(element2);
|
|
69
|
+
return elementId1 === elementId2;
|
|
70
|
+
}
|
|
71
|
+
exports.isEqualElements = isEqualElements;
|
|
72
|
+
function isStaleElementError(error) {
|
|
73
|
+
if (!error)
|
|
74
|
+
return false;
|
|
75
|
+
error = error.originalError || error;
|
|
76
|
+
return error instanceof Error && error.name === 'StaleElementReferenceError';
|
|
77
|
+
}
|
|
78
|
+
exports.isStaleElementError = isStaleElementError;
|
|
79
|
+
function toDriver(driver) {
|
|
68
80
|
driver.getExecutor().defineCommand('getSessionDetails', 'GET', '/session/:sessionId');
|
|
69
81
|
driver.getExecutor().defineCommand('getOrientation', 'GET', '/session/:sessionId/orientation');
|
|
70
82
|
driver.getExecutor().defineCommand('getSystemBars', 'GET', '/session/:sessionId/appium/device/system_bars');
|
|
@@ -82,8 +94,8 @@ function transformDriver(driver) {
|
|
|
82
94
|
}
|
|
83
95
|
return driver;
|
|
84
96
|
}
|
|
85
|
-
exports.
|
|
86
|
-
function
|
|
97
|
+
exports.toDriver = toDriver;
|
|
98
|
+
function toSelector(selector) {
|
|
87
99
|
if (utils.types.isString(selector)) {
|
|
88
100
|
return { css: selector };
|
|
89
101
|
}
|
|
@@ -99,8 +111,8 @@ function transformSelector(selector) {
|
|
|
99
111
|
}
|
|
100
112
|
return selector;
|
|
101
113
|
}
|
|
102
|
-
exports.
|
|
103
|
-
function
|
|
114
|
+
exports.toSelector = toSelector;
|
|
115
|
+
function toSimpleCommonSelector(selector) {
|
|
104
116
|
if (utils.types.instanceOf(selector, 'RelativeBy') || utils.types.isFunction(selector)) {
|
|
105
117
|
return null;
|
|
106
118
|
}
|
|
@@ -115,47 +127,11 @@ function untransformSelector(selector) {
|
|
|
115
127
|
}
|
|
116
128
|
return selector;
|
|
117
129
|
}
|
|
118
|
-
exports.
|
|
119
|
-
function isStaleElementError(error) {
|
|
120
|
-
if (!error)
|
|
121
|
-
return false;
|
|
122
|
-
error = error.originalError || error;
|
|
123
|
-
return error instanceof Error && error.name === 'StaleElementReferenceError';
|
|
124
|
-
}
|
|
125
|
-
exports.isStaleElementError = isStaleElementError;
|
|
126
|
-
async function isEqualElements(_driver, element1, element2) {
|
|
127
|
-
if (!element1 || !element2)
|
|
128
|
-
return false;
|
|
129
|
-
const elementId1 = await extractElementId(element1);
|
|
130
|
-
const elementId2 = await extractElementId(element2);
|
|
131
|
-
return elementId1 === elementId2;
|
|
132
|
-
}
|
|
133
|
-
exports.isEqualElements = isEqualElements;
|
|
134
|
-
// #endregion
|
|
135
|
-
// #region COMMANDS
|
|
130
|
+
exports.toSimpleCommonSelector = toSimpleCommonSelector;
|
|
136
131
|
async function executeScript(driver, script, arg) {
|
|
137
132
|
return driver.executeScript(script, arg);
|
|
138
133
|
}
|
|
139
134
|
exports.executeScript = executeScript;
|
|
140
|
-
async function mainContext(driver) {
|
|
141
|
-
await driver.switchTo().defaultContent();
|
|
142
|
-
return driver;
|
|
143
|
-
}
|
|
144
|
-
exports.mainContext = mainContext;
|
|
145
|
-
async function parentContext(driver) {
|
|
146
|
-
if (process.env.APPLITOOLS_FRAMEWORK_MAJOR_VERSION === '3') {
|
|
147
|
-
await executeCustomCommand(driver, new command_1.Command('switchToParentFrame'));
|
|
148
|
-
return driver;
|
|
149
|
-
}
|
|
150
|
-
await driver.switchTo().parentFrame();
|
|
151
|
-
return driver;
|
|
152
|
-
}
|
|
153
|
-
exports.parentContext = parentContext;
|
|
154
|
-
async function childContext(driver, element) {
|
|
155
|
-
await driver.switchTo().frame(element);
|
|
156
|
-
return driver;
|
|
157
|
-
}
|
|
158
|
-
exports.childContext = childContext;
|
|
159
135
|
async function findElement(driver, selector, parent) {
|
|
160
136
|
try {
|
|
161
137
|
const root = parent ? transformShadowRoot(driver, parent) : driver;
|
|
@@ -184,16 +160,76 @@ async function waitForSelector(driver, selector, _parent, options) {
|
|
|
184
160
|
}
|
|
185
161
|
}
|
|
186
162
|
exports.waitForSelector = waitForSelector;
|
|
187
|
-
async function
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
163
|
+
async function getElementRegion(_driver, element) {
|
|
164
|
+
if (utils.types.isFunction(element.getRect)) {
|
|
165
|
+
return element.getRect();
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
const { x, y } = await element.getLocation();
|
|
169
|
+
const { width, height } = await element.getSize();
|
|
170
|
+
return { x, y, width, height };
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
exports.getElementRegion = getElementRegion;
|
|
174
|
+
async function getElementAttribute(_driver, element, attr) {
|
|
175
|
+
return element.getAttribute(attr);
|
|
176
|
+
}
|
|
177
|
+
exports.getElementAttribute = getElementAttribute;
|
|
178
|
+
async function setElementText(_driver, element, keys) {
|
|
179
|
+
await element.clear();
|
|
180
|
+
await element.sendKeys(keys);
|
|
191
181
|
}
|
|
192
182
|
exports.setElementText = setElementText;
|
|
193
183
|
async function getElementText(_driver, element) {
|
|
194
184
|
return element.getText();
|
|
195
185
|
}
|
|
196
186
|
exports.getElementText = getElementText;
|
|
187
|
+
async function hover(driver, element) {
|
|
188
|
+
if (process.env.APPLITOOLS_FRAMEWORK_MAJOR_VERSION === '3') {
|
|
189
|
+
const { ActionSequence } = require('selenium-webdriver');
|
|
190
|
+
const action = new ActionSequence(driver);
|
|
191
|
+
await action.mouseMove(element).perform();
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
await driver.actions().move({ origin: element }).perform();
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
exports.hover = hover;
|
|
198
|
+
async function click(_driver, element) {
|
|
199
|
+
await element.click();
|
|
200
|
+
}
|
|
201
|
+
exports.click = click;
|
|
202
|
+
async function mainContext(driver) {
|
|
203
|
+
await driver.switchTo().defaultContent();
|
|
204
|
+
return driver;
|
|
205
|
+
}
|
|
206
|
+
exports.mainContext = mainContext;
|
|
207
|
+
async function parentContext(driver) {
|
|
208
|
+
if (process.env.APPLITOOLS_FRAMEWORK_MAJOR_VERSION === '3') {
|
|
209
|
+
await executeCustomCommand(driver, new command_1.Command('switchToParentFrame'));
|
|
210
|
+
return driver;
|
|
211
|
+
}
|
|
212
|
+
await driver.switchTo().parentFrame();
|
|
213
|
+
return driver;
|
|
214
|
+
}
|
|
215
|
+
exports.parentContext = parentContext;
|
|
216
|
+
async function childContext(driver, element) {
|
|
217
|
+
await driver.switchTo().frame(element);
|
|
218
|
+
return driver;
|
|
219
|
+
}
|
|
220
|
+
exports.childContext = childContext;
|
|
221
|
+
async function getDriverInfo(driver) {
|
|
222
|
+
const session = await driver.getSession();
|
|
223
|
+
return { sessionId: session.getId() };
|
|
224
|
+
}
|
|
225
|
+
exports.getDriverInfo = getDriverInfo;
|
|
226
|
+
async function getCapabilities(driver) {
|
|
227
|
+
var _a;
|
|
228
|
+
return ((_a = (await executeCustomCommand(driver, new command_1.Command('getSessionDetails')).catch(() => null))) !== null && _a !== void 0 ? _a : (await driver
|
|
229
|
+
.getCapabilities()
|
|
230
|
+
.then(capabilities => Array.from(capabilities.keys()).reduce((obj, key) => Object.assign(obj, { [key]: capabilities.get(key) }), {}))));
|
|
231
|
+
}
|
|
232
|
+
exports.getCapabilities = getCapabilities;
|
|
197
233
|
async function getWindowSize(driver) {
|
|
198
234
|
try {
|
|
199
235
|
const rect = await driver.manage().window().getRect();
|
|
@@ -223,6 +259,19 @@ async function setWindowSize(driver, size) {
|
|
|
223
259
|
}
|
|
224
260
|
}
|
|
225
261
|
exports.setWindowSize = setWindowSize;
|
|
262
|
+
async function getOrientation(driver) {
|
|
263
|
+
const orientation = await executeCustomCommand(driver, new command_1.Command('getOrientation'));
|
|
264
|
+
return orientation.toLowerCase();
|
|
265
|
+
}
|
|
266
|
+
exports.getOrientation = getOrientation;
|
|
267
|
+
async function setOrientation(driver, orientation) {
|
|
268
|
+
await executeCustomCommand(driver, new command_1.Command('setOrientation').setParameters({ orientation }));
|
|
269
|
+
}
|
|
270
|
+
exports.setOrientation = setOrientation;
|
|
271
|
+
async function getSystemBars(driver) {
|
|
272
|
+
return executeCustomCommand(driver, new command_1.Command('getSystemBars'));
|
|
273
|
+
}
|
|
274
|
+
exports.getSystemBars = getSystemBars;
|
|
226
275
|
async function getCookies(driver, context) {
|
|
227
276
|
if (context)
|
|
228
277
|
return driver.manage().getCookies();
|
|
@@ -248,18 +297,6 @@ async function getCookies(driver, context) {
|
|
|
248
297
|
});
|
|
249
298
|
}
|
|
250
299
|
exports.getCookies = getCookies;
|
|
251
|
-
async function getDriverInfo(driver) {
|
|
252
|
-
const session = await driver.getSession();
|
|
253
|
-
return { sessionId: session.getId() };
|
|
254
|
-
}
|
|
255
|
-
exports.getDriverInfo = getDriverInfo;
|
|
256
|
-
async function getCapabilities(driver) {
|
|
257
|
-
var _a;
|
|
258
|
-
return ((_a = (await executeCustomCommand(driver, new command_1.Command('getSessionDetails')).catch(() => null))) !== null && _a !== void 0 ? _a : (await driver
|
|
259
|
-
.getCapabilities()
|
|
260
|
-
.then(capabilities => Array.from(capabilities.keys()).reduce((obj, key) => Object.assign(obj, { [key]: capabilities.get(key) }), {}))));
|
|
261
|
-
}
|
|
262
|
-
exports.getCapabilities = getCapabilities;
|
|
263
300
|
async function getTitle(driver) {
|
|
264
301
|
return driver.getTitle();
|
|
265
302
|
}
|
|
@@ -272,68 +309,16 @@ async function visit(driver, url) {
|
|
|
272
309
|
await driver.get(url);
|
|
273
310
|
}
|
|
274
311
|
exports.visit = visit;
|
|
275
|
-
async function takeScreenshot(driver) {
|
|
276
|
-
return driver.takeScreenshot();
|
|
277
|
-
}
|
|
278
|
-
exports.takeScreenshot = takeScreenshot;
|
|
279
|
-
async function click(driver, element) {
|
|
280
|
-
const resolvedElement = isSelector(element) ? await findElement(driver, element) : element;
|
|
281
|
-
await (resolvedElement === null || resolvedElement === void 0 ? void 0 : resolvedElement.click());
|
|
282
|
-
}
|
|
283
|
-
exports.click = click;
|
|
284
|
-
async function hover(driver, element) {
|
|
285
|
-
const resolvedElement = isSelector(element) ? await findElement(driver, element) : element;
|
|
286
|
-
if (process.env.APPLITOOLS_FRAMEWORK_MAJOR_VERSION === '3') {
|
|
287
|
-
const { ActionSequence } = require('selenium-webdriver');
|
|
288
|
-
const action = new ActionSequence(driver);
|
|
289
|
-
await action.mouseMove(resolvedElement).perform();
|
|
290
|
-
}
|
|
291
|
-
else {
|
|
292
|
-
await driver.actions().move({ origin: resolvedElement }).perform();
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
exports.hover = hover;
|
|
296
|
-
async function waitUntilDisplayed(driver, selector, timeout) {
|
|
297
|
-
const element = await findElement(driver, selector);
|
|
298
|
-
await driver.wait(Selenium.until.elementIsVisible(element), timeout);
|
|
299
|
-
}
|
|
300
|
-
exports.waitUntilDisplayed = waitUntilDisplayed;
|
|
301
|
-
// #endregion
|
|
302
|
-
// #region MOBILE COMMANDS
|
|
303
|
-
async function getSystemBars(driver) {
|
|
304
|
-
return executeCustomCommand(driver, new command_1.Command('getSystemBars'));
|
|
305
|
-
}
|
|
306
|
-
exports.getSystemBars = getSystemBars;
|
|
307
|
-
async function setOrientation(driver, orientation) {
|
|
308
|
-
await executeCustomCommand(driver, new command_1.Command('setOrientation').setParameters({ orientation }));
|
|
309
|
-
}
|
|
310
|
-
exports.setOrientation = setOrientation;
|
|
311
|
-
async function getOrientation(driver) {
|
|
312
|
-
const orientation = await executeCustomCommand(driver, new command_1.Command('getOrientation'));
|
|
313
|
-
return orientation.toLowerCase();
|
|
314
|
-
}
|
|
315
|
-
exports.getOrientation = getOrientation;
|
|
316
|
-
async function getElementRegion(_driver, element) {
|
|
317
|
-
if (utils.types.isFunction(element.getRect)) {
|
|
318
|
-
return element.getRect();
|
|
319
|
-
}
|
|
320
|
-
else {
|
|
321
|
-
const { x, y } = await element.getLocation();
|
|
322
|
-
const { width, height } = await element.getSize();
|
|
323
|
-
return { x, y, width, height };
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
exports.getElementRegion = getElementRegion;
|
|
327
|
-
async function getElementAttribute(_driver, element, attr) {
|
|
328
|
-
return element.getAttribute(attr);
|
|
329
|
-
}
|
|
330
|
-
exports.getElementAttribute = getElementAttribute;
|
|
331
312
|
async function performAction(driver, steps) {
|
|
332
313
|
await executeCustomCommand(driver, new command_1.Command('performTouch').setParameters({
|
|
333
314
|
actions: steps.map(({ action, ...options }) => ({ action, options })),
|
|
334
315
|
}));
|
|
335
316
|
}
|
|
336
317
|
exports.performAction = performAction;
|
|
318
|
+
async function takeScreenshot(driver) {
|
|
319
|
+
return driver.takeScreenshot();
|
|
320
|
+
}
|
|
321
|
+
exports.takeScreenshot = takeScreenshot;
|
|
337
322
|
async function getCurrentWorld(driver) {
|
|
338
323
|
return executeCustomCommand(driver, new command_1.Command('getCurrentContext'));
|
|
339
324
|
}
|
|
@@ -346,8 +331,6 @@ async function switchWorld(driver, name) {
|
|
|
346
331
|
return executeCustomCommand(driver, new command_1.Command('switchToContext').setParameters({ name }));
|
|
347
332
|
}
|
|
348
333
|
exports.switchWorld = switchWorld;
|
|
349
|
-
// #endregion
|
|
350
|
-
// #region TESTING
|
|
351
334
|
const browserOptionsNames = {
|
|
352
335
|
chrome: 'goog:chromeOptions',
|
|
353
336
|
firefox: 'moz:firefoxOptions',
|
|
@@ -413,4 +396,3 @@ async function build(env) {
|
|
|
413
396
|
return [driver, () => driver.quit()];
|
|
414
397
|
}
|
|
415
398
|
exports.build = build;
|
|
416
|
-
// #endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/spec-driver-selenium",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.56",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"selenium",
|
|
6
6
|
"selenium-webdriver",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"build": "run --top-level tspc --project ./tsconfig.build.json",
|
|
43
43
|
"test": "run --top-level mocha './test/**/*.spec.ts' -r @applitools/test-utils/mocha-hooks/docker --exit",
|
|
44
44
|
"setup": "run --top-level browsers:setup",
|
|
45
|
-
"up:framework": "
|
|
45
|
+
"up:framework": "yarn add --dev --caret selenium-webdriver${APPLITOOLS_FRAMEWORK_VERSION:+@$APPLITOOLS_FRAMEWORK_VERSION}"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@applitools/driver": "1.13.
|
|
49
|
-
"@applitools/utils": "1.5.
|
|
48
|
+
"@applitools/driver": "1.13.5",
|
|
49
|
+
"@applitools/utils": "1.5.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@applitools/api-extractor": "^1.2.21",
|
package/types/index.d.ts
CHANGED
|
@@ -1,34 +1,37 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: SpecDriver;
|
|
2
2
|
export default _default;
|
|
3
3
|
export function isDriver(driver: any): driver is Driver;
|
|
4
4
|
export function isElement(element: any): element is Element;
|
|
5
5
|
export function isSelector(selector: any): selector is Selector;
|
|
6
|
-
export function transformDriver(driver: Driver): Driver;
|
|
7
|
-
export function transformSelector(selector: import('@applitools/driver').CommonSelector<Selector>): Selector;
|
|
8
|
-
export function untransformSelector(selector: Selector): null | import('@applitools/driver').CommonSelector;
|
|
9
|
-
export function isStaleElementError(error: any): boolean;
|
|
10
6
|
export function isEqualElements(_driver: Driver, element1: Element, element2: Element): Promise<boolean>;
|
|
7
|
+
export function isStaleElementError(error: any): boolean;
|
|
8
|
+
export function toDriver(driver: Driver): Driver;
|
|
9
|
+
export function toSelector(selector: import('@applitools/driver').CommonSelector<Selector>): Selector;
|
|
10
|
+
export function toSimpleCommonSelector(selector: Selector): null | import('@applitools/driver').CommonSelector;
|
|
11
11
|
export function executeScript(driver: Driver, script: string | ((arg: any) => any), arg: any): Promise<any>;
|
|
12
|
-
export function mainContext(driver: Driver): Promise<Driver>;
|
|
13
|
-
export function parentContext(driver: Driver): Promise<Driver>;
|
|
14
|
-
export function childContext(driver: Driver, element: Element): Promise<Driver>;
|
|
15
12
|
export function findElement(driver: Driver, selector: Selector, parent?: undefined | Element): Promise<null | Element>;
|
|
16
13
|
export function findElements(driver: Driver, selector: Selector, parent?: undefined | Element): Promise<Array<Element>>;
|
|
17
14
|
export function waitForSelector(driver: Driver, selector: Selector, _parent?: undefined | Element, options?: undefined | import('@applitools/driver').WaitOptions): Promise<null | Element>;
|
|
18
|
-
export function
|
|
15
|
+
export function getElementRegion(_driver: Driver, element: Element): Promise<{
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
}>;
|
|
21
|
+
export function getElementAttribute(_driver: Driver, element: Element, attr: string): Promise<string>;
|
|
22
|
+
export function setElementText(_driver: Driver, element: Element, keys: string): Promise<void>;
|
|
19
23
|
export function getElementText(_driver: Driver, element: Element): Promise<string>;
|
|
20
|
-
export function
|
|
21
|
-
export function
|
|
22
|
-
export function
|
|
24
|
+
export function hover(driver: Driver, element: Element): Promise<void>;
|
|
25
|
+
export function click(_driver: Driver, element: Element): Promise<void>;
|
|
26
|
+
export function mainContext(driver: Driver): Promise<Driver>;
|
|
27
|
+
export function parentContext(driver: Driver): Promise<Driver>;
|
|
28
|
+
export function childContext(driver: Driver, element: Element): Promise<Driver>;
|
|
23
29
|
export function getDriverInfo(driver: Driver): Promise<import('@applitools/driver').DriverInfo>;
|
|
24
30
|
export function getCapabilities(driver: Driver): Promise<Record<string, any>>;
|
|
25
|
-
export function
|
|
26
|
-
export function
|
|
27
|
-
export function
|
|
28
|
-
export function
|
|
29
|
-
export function click(driver: Driver, element: Element | Selector): Promise<void>;
|
|
30
|
-
export function hover(driver: Driver, element: Element | Selector): Promise<void>;
|
|
31
|
-
export function waitUntilDisplayed(driver: Driver, selector: Selector, timeout: number): Promise<void>;
|
|
31
|
+
export function getWindowSize(driver: Driver): Promise<{ width: number; height: number; }>;
|
|
32
|
+
export function setWindowSize(driver: Driver, size: { width: number; height: number; }): Promise<void>;
|
|
33
|
+
export function getOrientation(driver: Driver): Promise<"portrait" | "landscape">;
|
|
34
|
+
export function setOrientation(driver: Driver, orientation: "portrait" | "landscape"): Promise<void>;
|
|
32
35
|
export function getSystemBars(driver: Driver): Promise<{ statusBar: {
|
|
33
36
|
visible: boolean;
|
|
34
37
|
x: number;
|
|
@@ -42,16 +45,12 @@ export function getSystemBars(driver: Driver): Promise<{ statusBar: {
|
|
|
42
45
|
height: number;
|
|
43
46
|
width: number;
|
|
44
47
|
}; }>;
|
|
45
|
-
export function
|
|
46
|
-
export function
|
|
47
|
-
export function
|
|
48
|
-
|
|
49
|
-
y: number;
|
|
50
|
-
width: number;
|
|
51
|
-
height: number;
|
|
52
|
-
}>;
|
|
53
|
-
export function getElementAttribute(_driver: Driver, element: Element, attr: string): Promise<string>;
|
|
48
|
+
export function getCookies(driver: Driver, context?: undefined | boolean): Promise<Array<import('@applitools/driver').Cookie>>;
|
|
49
|
+
export function getTitle(driver: Driver): Promise<string>;
|
|
50
|
+
export function getUrl(driver: Driver): Promise<string>;
|
|
51
|
+
export function visit(driver: Driver, url: string): Promise<void>;
|
|
54
52
|
export function performAction(driver: Driver, steps: Array<any>): Promise<void>;
|
|
53
|
+
export function takeScreenshot(driver: Driver): Promise<string>;
|
|
55
54
|
export function getCurrentWorld(driver: Driver): Promise<string>;
|
|
56
55
|
export function getWorlds(driver: Driver): Promise<Array<string>>;
|
|
57
56
|
export function switchWorld(driver: Driver, name: string): Promise<void>;
|
|
@@ -60,4 +59,11 @@ export type Driver = import('selenium-webdriver').WebDriver & { __applitoolsBran
|
|
|
60
59
|
export type Element = import('selenium-webdriver').WebElement & { __applitoolsBrand?: undefined; };
|
|
61
60
|
export type ShadowRoot = { 'shadow-6066-11e4-a52e-4f735466cecf': string; };
|
|
62
61
|
export type Selector = (import('selenium-webdriver').By | import('selenium-webdriver').ByHash | import('selenium-webdriver').RelativeBy | { using: string; value: string; } | ((webdriver: import('selenium-webdriver').WebDriver) => Promise<any>)) & { __applitoolsBrand?: undefined; };
|
|
63
|
-
export type
|
|
62
|
+
export type PrimarySpecType = {
|
|
63
|
+
driver: Driver;
|
|
64
|
+
context: Driver;
|
|
65
|
+
element: Element;
|
|
66
|
+
selector: Selector;
|
|
67
|
+
secondary: never;
|
|
68
|
+
};
|
|
69
|
+
export type SpecDriver = import('@applitools/driver').SpecDriver<PrimarySpecType>;
|