@applitools/eyes-selenium 4.56.2 → 4.57.0

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 CHANGED
@@ -3,6 +3,33 @@
3
3
  ## Unreleased
4
4
 
5
5
 
6
+ ## 4.57.0 - 2021/11/5
7
+
8
+ - updated to @applitools/eyes-api@1.1.5 (from 1.1.4)
9
+ - updated to @applitools/eyes-sdk-core@12.23.24 (from 12.23.18)
10
+ - updated to @applitools/visual-grid-client@15.8.43 (from 15.8.37)
11
+
12
+ ## 4.56.5 - 2021/10/20
13
+
14
+ - updated to @applitools/eyes-sdk-core@12.23.18 (from 12.23.15)
15
+ - updated to @applitools/spec-driver-selenium@1.1.1 (from 1.1.0)
16
+ - updated to @applitools/visual-grid-client@15.8.37 (from 15.8.34)
17
+
18
+ ## 4.56.4 - 2021/10/12
19
+
20
+ - move spec driver implementation to the separate package
21
+ - updated to @applitools/eyes-api@1.1.4 (from 1.1.3)
22
+ - updated to @applitools/eyes-sdk-core@12.23.15 (from 12.23.14)
23
+ - updated to @applitools/spec-driver-selenium@1.0.2 (from 1.0.1)
24
+ - updated to @applitools/visual-grid-client@15.8.34 (from 15.8.33)
25
+ - updated to @applitools/spec-driver-selenium@1.1.0 (from 1.0.2)
26
+
27
+ ## 4.56.3 - 2021/10/7
28
+
29
+ - updated to @applitools/eyes-api@1.1.3 (from 1.1.1)
30
+ - updated to @applitools/eyes-sdk-core@12.23.14 (from 12.23.6)
31
+ - updated to @applitools/visual-grid-client@15.8.33 (from 15.8.26)
32
+
6
33
  ## 4.56.2 - 2021/9/13
7
34
 
8
35
  - updated to @applitools/eyes-sdk-core@12.23.0 (from 12.22.6)
package/dist/api.js CHANGED
@@ -25,7 +25,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.BatchClose = exports.Target = exports.CheckSettings = exports.Configuration = exports.Eyes = void 0;
26
26
  const eyes_sdk_core_1 = require("@applitools/eyes-sdk-core");
27
27
  const api = __importStar(require("@applitools/eyes-api"));
28
- const spec = __importStar(require("./spec-driver"));
28
+ const spec = __importStar(require("@applitools/spec-driver-selenium"));
29
29
  const sdk = (0, eyes_sdk_core_1.makeSDK)({
30
30
  name: 'eyes.selenium',
31
31
  version: `${require('../package.json').version}--${process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION}`,
package/dist/index.js CHANGED
@@ -10,9 +10,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
10
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- if (!process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION) {
14
- const { version } = require('selenium-webdriver/package.json');
15
- const [major] = version.split('.', 1);
16
- process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION = major;
17
- }
18
13
  __exportStar(require("./api"), exports);
@@ -6,347 +6,8 @@ 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
- };
21
- var __rest = (this && this.__rest) || function (s, e) {
22
- var t = {};
23
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
24
- t[p] = s[p];
25
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
26
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
27
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
28
- t[p[i]] = s[p[i]];
29
- }
30
- return t;
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
31
11
  };
32
12
  Object.defineProperty(exports, "__esModule", { value: true });
33
- exports.wrapDriver = 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;
34
- const utils = __importStar(require("@applitools/utils"));
35
- const legacy = __importStar(require("./legacy"));
36
- const byHash = ['className', 'css', 'id', 'js', 'linkText', 'name', 'partialLinkText', 'tagName', 'xpath'];
37
- function extractElementId(element) {
38
- return element.getId();
39
- }
40
- function isDriver(driver) {
41
- return utils.types.instanceOf(driver, 'WebDriver');
42
- }
43
- exports.isDriver = isDriver;
44
- function isElement(element) {
45
- return utils.types.instanceOf(element, 'WebElement');
46
- }
47
- exports.isElement = isElement;
48
- function isSelector(selector) {
49
- if (!selector)
50
- return false;
51
- return utils.types.has(selector, ['using', 'value']) || byHash.includes(Object.keys(selector)[0]);
52
- }
53
- exports.isSelector = isSelector;
54
- function transformDriver(driver) {
55
- driver.getExecutor().defineCommand('getSessionDetails', 'GET', '/session/:sessionId');
56
- driver.getExecutor().defineCommand('getOrientation', 'GET', '/session/:sessionId/orientation');
57
- driver.getExecutor().defineCommand('getSystemBars', 'GET', '/session/:sessionId/appium/device/system_bars');
58
- driver.getExecutor().defineCommand('performTouch', 'POST', '/session/:sessionId/touch/perform');
59
- if (process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3') {
60
- driver.getExecutor().defineCommand('switchToParentFrame', 'POST', '/session/:sessionId/frame/parent');
61
- }
62
- return driver;
63
- }
64
- exports.transformDriver = transformDriver;
65
- function transformSelector(selector) {
66
- if (utils.types.isString(selector)) {
67
- return { css: selector };
68
- }
69
- else if (utils.types.has(selector, 'selector')) {
70
- if (!utils.types.isString(selector.selector))
71
- return selector.selector;
72
- if (!utils.types.has(selector, 'type'))
73
- return { css: selector.selector };
74
- if (selector.type === 'css')
75
- return { css: selector.selector };
76
- else
77
- return { using: selector.type, value: selector.selector };
78
- }
79
- return selector;
80
- }
81
- exports.transformSelector = transformSelector;
82
- function isStaleElementError(error) {
83
- if (!error)
84
- return false;
85
- error = error.originalError || error;
86
- return error instanceof Error && error.name === 'StaleElementReferenceError';
87
- }
88
- exports.isStaleElementError = isStaleElementError;
89
- async function isEqualElements(_driver, element1, element2) {
90
- if (!element1 || !element2)
91
- return false;
92
- const elementId1 = await extractElementId(element1);
93
- const elementId2 = await extractElementId(element2);
94
- return elementId1 === elementId2;
95
- }
96
- exports.isEqualElements = isEqualElements;
97
- async function executeScript(driver, script, arg) {
98
- return driver.executeScript(script, arg);
99
- }
100
- exports.executeScript = executeScript;
101
- async function mainContext(driver) {
102
- await driver.switchTo().defaultContent();
103
- return driver;
104
- }
105
- exports.mainContext = mainContext;
106
- async function parentContext(driver) {
107
- if (process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3') {
108
- const { Command } = require('selenium-webdriver/lib/command');
109
- await driver.schedule(new Command('switchToParentFrame'));
110
- return driver;
111
- }
112
- await driver.switchTo().parentFrame();
113
- return driver;
114
- }
115
- exports.parentContext = parentContext;
116
- async function childContext(driver, element) {
117
- await driver.switchTo().frame(element);
118
- return driver;
119
- }
120
- exports.childContext = childContext;
121
- async function findElement(driver, selector, parent) {
122
- try {
123
- const root = parent !== null && parent !== void 0 ? parent : driver;
124
- return await root.findElement(selector);
125
- }
126
- catch (err) {
127
- if (err.name === 'NoSuchElementError')
128
- return null;
129
- else
130
- throw err;
131
- }
132
- }
133
- exports.findElement = findElement;
134
- async function findElements(driver, selector, parent) {
135
- const root = parent !== null && parent !== void 0 ? parent : driver;
136
- return root.findElements(selector);
137
- }
138
- exports.findElements = findElements;
139
- async function getWindowSize(driver) {
140
- try {
141
- const window = driver.manage().window();
142
- if (utils.types.isFunction(window.getSize)) {
143
- return await window.getSize();
144
- }
145
- else if (utils.types.isFunction(window.getRect)) {
146
- const rect = await window.getRect();
147
- return { width: rect.width, height: rect.height };
148
- }
149
- }
150
- catch (err) {
151
- const cmd = require('selenium-webdriver/lib/command');
152
- return driver.execute(new cmd.Command(cmd.Name.GET_WINDOW_SIZE).setParameter('windowHandle', 'current'));
153
- }
154
- }
155
- exports.getWindowSize = getWindowSize;
156
- async function setWindowSize(driver, size) {
157
- const window = driver.manage().window();
158
- if (utils.types.isFunction(window.setRect)) {
159
- await window.setRect({ x: 0, y: 0, width: size.width, height: size.height });
160
- }
161
- else {
162
- await window.setPosition(0, 0);
163
- await window.setSize(size.width, size.height);
164
- }
165
- }
166
- exports.setWindowSize = setWindowSize;
167
- async function getDriverInfo(driver) {
168
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
169
- const session = await driver.getSession();
170
- const capabilities = await driver.getCapabilities();
171
- const desiredCapabilities = (_a = capabilities.get('desired')) !== null && _a !== void 0 ? _a : {};
172
- const platformName = (_c = (_b = capabilities.get('platformName')) !== null && _b !== void 0 ? _b : capabilities.get('platform')) !== null && _c !== void 0 ? _c : desiredCapabilities.platformName;
173
- const isMobile = ['android', 'ios'].includes(platformName === null || platformName === void 0 ? void 0 : platformName.toLowerCase());
174
- const info = {
175
- sessionId: session.getId(),
176
- isMobile,
177
- isNative: isMobile && !capabilities.get('browserName'),
178
- deviceName: (_d = desiredCapabilities.deviceName) !== null && _d !== void 0 ? _d : capabilities.get('deviceName'),
179
- platformName,
180
- platformVersion: capabilities.get('platformVersion'),
181
- browserName: (_e = capabilities.get('browserName')) !== null && _e !== void 0 ? _e : desiredCapabilities.browserName,
182
- browserVersion: (_f = capabilities.get('browserVersion')) !== null && _f !== void 0 ? _f : capabilities.get('version'),
183
- };
184
- if (info.isNative) {
185
- const { Command } = require('selenium-webdriver/lib/command');
186
- let details;
187
- if (capabilities.has('viewportRect') && capabilities.has('pixelRatio') && capabilities.has('statBarHeight')) {
188
- details = {
189
- viewportRect: capabilities.get('viewportRect'),
190
- pixelRatio: capabilities.get('pixelRatio'),
191
- statBarHeight: capabilities.get('statBarHeight'),
192
- };
193
- }
194
- else {
195
- const getSessionDetailsCommand = new Command('getSessionDetails');
196
- details =
197
- process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3'
198
- ? await driver.schedule(getSessionDetailsCommand)
199
- : await driver.execute(getSessionDetailsCommand);
200
- }
201
- info.pixelRatio = details.pixelRatio;
202
- try {
203
- const getSystemBars = new Command('getSystemBars');
204
- const { statusBar, navigationBar } = process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3'
205
- ? await driver.schedule(getSystemBars)
206
- : await driver.execute(getSystemBars);
207
- info.statusBarHeight = statusBar.visible ? statusBar.height : 0;
208
- info.navigationBarHeight = navigationBar.visible ? navigationBar.height : 0;
209
- }
210
- catch (err) {
211
- 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;
212
- info.navigationBarHeight = 0;
213
- }
214
- }
215
- return info;
216
- }
217
- exports.getDriverInfo = getDriverInfo;
218
- async function getTitle(driver) {
219
- return driver.getTitle();
220
- }
221
- exports.getTitle = getTitle;
222
- async function getUrl(driver) {
223
- return driver.getCurrentUrl();
224
- }
225
- exports.getUrl = getUrl;
226
- async function visit(driver, url) {
227
- await driver.get(url);
228
- }
229
- exports.visit = visit;
230
- async function takeScreenshot(driver) {
231
- return driver.takeScreenshot();
232
- }
233
- exports.takeScreenshot = takeScreenshot;
234
- async function click(driver, element) {
235
- if (isSelector(element))
236
- element = await findElement(driver, element);
237
- await element.click();
238
- }
239
- exports.click = click;
240
- async function hover(driver, element) {
241
- if (isSelector(element))
242
- element = await findElement(driver, element);
243
- if (process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3') {
244
- const { ActionSequence } = require('selenium-webdriver');
245
- const action = new ActionSequence(driver);
246
- await action.mouseMove(element).perform();
247
- }
248
- else {
249
- await driver.actions().move({ origin: element }).perform();
250
- }
251
- }
252
- exports.hover = hover;
253
- async function type(driver, element, keys) {
254
- if (isSelector(element))
255
- element = await findElement(driver, element);
256
- await element.sendKeys(keys);
257
- }
258
- exports.type = type;
259
- async function scrollIntoView(driver, element, align = false) {
260
- if (isSelector(element))
261
- element = await findElement(driver, element);
262
- await driver.executeScript('arguments[0].scrollIntoView(arguments[1])', element, align);
263
- }
264
- exports.scrollIntoView = scrollIntoView;
265
- async function waitUntilDisplayed(driver, selector, timeout) {
266
- const { until } = require('selenium-webdriver');
267
- const element = await findElement(driver, selector);
268
- await driver.wait(until.elementIsVisible(element), timeout);
269
- }
270
- exports.waitUntilDisplayed = waitUntilDisplayed;
271
- async function getOrientation(driver) {
272
- const { Command } = require('selenium-webdriver/lib/command');
273
- const getOrientationCommand = new Command('getOrientation');
274
- const orientation = process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3'
275
- ? await driver.schedule(getOrientationCommand)
276
- : await driver.execute(getOrientationCommand);
277
- return orientation.toLowerCase();
278
- }
279
- exports.getOrientation = getOrientation;
280
- async function getElementRegion(_driver, element) {
281
- return element.getRect();
282
- }
283
- exports.getElementRegion = getElementRegion;
284
- async function getElementAttribute(_driver, element, attr) {
285
- return element.getAttribute(attr);
286
- }
287
- exports.getElementAttribute = getElementAttribute;
288
- async function getElementText(_driver, element) {
289
- return element.getText();
290
- }
291
- exports.getElementText = getElementText;
292
- async function performAction(driver, steps) {
293
- const { Command } = require('selenium-webdriver/lib/command');
294
- const performTouchCommand = new Command('performTouch').setParameters({
295
- actions: steps.map((_a) => {
296
- var { action } = _a, options = __rest(_a, ["action"]);
297
- return ({ action, options });
298
- }),
299
- });
300
- if (process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3') {
301
- await driver.schedule(performTouchCommand);
302
- }
303
- else {
304
- await driver.execute(performTouchCommand);
305
- }
306
- }
307
- exports.performAction = performAction;
308
- const browserOptionsNames = {
309
- chrome: 'goog:chromeOptions',
310
- firefox: 'moz:firefoxOptions',
311
- };
312
- async function build(env) {
313
- var _a;
314
- const { Builder } = require('selenium-webdriver');
315
- const parseEnv = require('@applitools/test-utils/src/parse-env');
316
- 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' }));
317
- const desiredCapabilities = Object.assign({}, capabilities);
318
- if (configurable) {
319
- const browserOptionsName = browserOptionsNames[browser || desiredCapabilities.browserName];
320
- if (browserOptionsName) {
321
- const browserOptions = desiredCapabilities[browserOptionsName] || {};
322
- browserOptions.args = [...(browserOptions.args || []), ...args];
323
- if (headless)
324
- browserOptions.args.push('headless');
325
- if (attach) {
326
- browserOptions.debuggerAddress = attach === true ? 'localhost:9222' : attach;
327
- if (browser !== 'firefox')
328
- browserOptions.w3c = false;
329
- }
330
- desiredCapabilities[browserOptionsName] = browserOptions;
331
- }
332
- }
333
- if (appium && browser === 'chrome') {
334
- desiredCapabilities['appium:chromeOptions'] = { w3c: false };
335
- }
336
- const builder = new Builder().withCapabilities(desiredCapabilities);
337
- if (url && !attach)
338
- builder.usingServer(url.href);
339
- if (proxy) {
340
- builder.setProxy({
341
- proxyType: 'manual',
342
- httpProxy: proxy.http || proxy.server,
343
- sslProxy: proxy.https || proxy.server,
344
- ftpProxy: proxy.ftp,
345
- noProxy: proxy.bypass,
346
- });
347
- }
348
- const driver = await builder.build();
349
- return [driver, () => driver.quit()];
350
- }
351
- exports.build = build;
352
- exports.wrapDriver = legacy.wrapDriver;
13
+ __exportStar(require("@applitools/spec-driver-selenium"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/eyes-selenium",
3
- "version": "4.56.2",
3
+ "version": "4.57.0",
4
4
  "description": "Applitools Eyes SDK for Selenium WebDriver",
5
5
  "keywords": [
6
6
  "eyes-selenium",
@@ -23,7 +23,8 @@
23
23
  },
24
24
  "repository": {
25
25
  "type": "git",
26
- "url": "git://github.com/applitools/eyes.sdk.javascript1.git"
26
+ "url": "git://github.com/applitools/eyes.sdk.javascript1.git",
27
+ "directory": "packages/eyes-selenium"
27
28
  },
28
29
  "license": "SEE LICENSE IN LICENSE",
29
30
  "author": {
@@ -42,21 +43,19 @@
42
43
  "types"
43
44
  ],
44
45
  "scripts": {
45
- "lint": "eslint '**/*.ts' '**/*.js'",
46
+ "lint": "eslint '**/*.ts'",
46
47
  "build": "yarn build:dist && yarn build:types",
47
- "doc": "typedoc ./types/index.d.ts --theme minimal --tsconfig ./tsconfig.doc.json",
48
48
  "build:dist": "tsc",
49
49
  "build:types": "api-extractor ./src/index.ts --out ./types/index.d.ts --external-modules selenium-webdriver",
50
50
  "generate:tests": "coverage-tests generate https://raw.githubusercontent.com/applitools/sdk.coverage.tests/master/js/config.js --name 'eyes-selenium'",
51
- "test": "yarn build:dist && yarn test:it && yarn test:coverage",
52
- "test:it": "mocha --no-timeouts './test/it/**/*.spec.js'",
51
+ "test": "yarn test:coverage",
53
52
  "test:coverage": "yarn generate:tests && APPLITOOLS_BATCH_NAME='JS Coverage Tests: eyes-selenium' APPLITOOLS_BATCH_ID=$(uuidgen) XUNIT_FILE=coverage-test-report.xml mocha --config .mocharc.cvg.js",
54
53
  "report": "coverage-tests report https://raw.githubusercontent.com/applitools/sdk.coverage.tests/master/js/config.js --name 'eyes-selenium'",
55
54
  "setup": "yarn docker:setup",
56
55
  "docker:setup": "node ../scripts/scripts/generate-docker-compose-config.js && docker-compose up -d",
57
56
  "docker:teardown": "docker-compose down",
58
57
  "deps": "bongo deps",
59
- "gh:test": "gh workflow run test.yml --ref $(git rev-parse --abbrev-ref HEAD) -f packages='selenium selenium@3' -f links='eyes-sdk-core eyes-api types test-utils utils driver snippets screenshoter sdk-shared visual-grid-client' -f linking-depth=3",
58
+ "gh:test": "gh workflow run test.yml --ref $(git rev-parse --abbrev-ref HEAD) -f packages='selenium selenium@3' -f links='types test-utils sdk-shared eyes-sdk-core visual-grid-client eyes-api spec-driver-selenium utils driver snippets screenshoter' -f linking-depth=3",
60
59
  "gh:publish": "gh workflow run publish.yml --ref $(git rev-parse --abbrev-ref HEAD) -f packages='selenium'",
61
60
  "preversion": "bongo preversion && yarn build",
62
61
  "version": "bongo version",
@@ -68,18 +67,18 @@
68
67
  }
69
68
  },
70
69
  "dependencies": {
71
- "@applitools/eyes-api": "1.1.1",
72
- "@applitools/eyes-sdk-core": "12.23.6",
73
- "@applitools/utils": "1.2.3",
74
- "@applitools/visual-grid-client": "15.8.26"
70
+ "@applitools/eyes-api": "1.1.5",
71
+ "@applitools/eyes-sdk-core": "12.23.24",
72
+ "@applitools/spec-driver-selenium": "1.1.1",
73
+ "@applitools/visual-grid-client": "15.8.43"
75
74
  },
76
75
  "devDependencies": {
77
76
  "@applitools/api-extractor": "1.1.3",
78
77
  "@applitools/scripts": "1.0.1",
79
78
  "@applitools/sdk-coverage-tests": "2.3.15",
80
- "@applitools/sdk-release-kit": "0.13.3",
81
- "@applitools/sdk-shared": "0.9.6",
82
- "@applitools/test-utils": "1.0.7",
79
+ "@applitools/sdk-release-kit": "0.13.4",
80
+ "@applitools/sdk-shared": "0.9.7",
81
+ "@applitools/test-utils": "1.0.9",
83
82
  "@types/selenium-webdriver": "^4.0.11",
84
83
  "@typescript-eslint/eslint-plugin": "^4.15.1",
85
84
  "@typescript-eslint/parser": "^4.15.1",
@@ -90,10 +89,9 @@
90
89
  "eslint-plugin-node": "^11.1.0",
91
90
  "eslint-plugin-prettier": "^3.3.1",
92
91
  "husky": "^4.3.8",
93
- "mocha": "^8.0.1",
94
- "ncp": "^2.0.0",
92
+ "mocha": "^9.1.2",
95
93
  "prettier": "^2.1.2",
96
- "selenium-webdriver": "^4.0.0-beta.4",
94
+ "selenium-webdriver": "^4.0.0-rc-2",
97
95
  "spec-xunit-file": "0.0.1-3",
98
96
  "typescript": "^4.1.3"
99
97
  },
package/types/index.d.ts CHANGED
@@ -120,6 +120,7 @@ export enum FailureReport {
120
120
 
121
121
  export enum IosDeviceName {
122
122
  iPad_7 = 'iPad (7th generation)',
123
+ iPad_9 = 'iPad (9th generation)',
123
124
  iPad_Air_2 = 'iPad Air (2nd generation)',
124
125
  iPad_Pro_3 = 'iPad Pro (12.9-inch) (3rd generation)',
125
126
  iPhone_11 = 'iPhone 11',
@@ -129,6 +130,9 @@ export enum IosDeviceName {
129
130
  iPhone_12_Pro = 'iPhone 12 Pro',
130
131
  iPhone_12_Pro_Max = 'iPhone 12 Pro Max',
131
132
  iPhone_12_mini = 'iPhone 12 mini',
133
+ iPhone_13 = 'iPhone 13',
134
+ iPhone_13_Pro = 'iPhone 13 Pro',
135
+ iPhone_13_Pro_Max = 'iPhone 13 Pro Max',
132
136
  iPhone_7 = 'iPhone 7',
133
137
  iPhone_8 = 'iPhone 8',
134
138
  iPhone_X = 'iPhone X',
@@ -243,7 +247,7 @@ export class BatchClose {
243
247
  setBatchIds(batchIds: string[]): this;
244
248
  setProxy(proxy: ProxySettingsPlain): this;
245
249
  setUrl(serverUrl: string): this;
246
- static close(options: {
250
+ static close(settings: {
247
251
  batchIds: string[];
248
252
  serverUrl?: string;
249
253
  apiKey?: string;
@@ -292,24 +296,27 @@ export class CheckSettings {
292
296
  accessibilityRegion(region: RegionPlain, type?: AccessibilityRegionTypePlain): this;
293
297
  accessibilityRegion(region: Element, type?: AccessibilityRegionTypePlain): this;
294
298
  accessibilityRegion(region: EyesSelector<Selector>, type?: AccessibilityRegionTypePlain): this;
299
+ accessibilityRegion(region: LegacyRegionPlain, type?: AccessibilityRegionTypePlain): this;
295
300
  accessibilityRegions(
296
301
  ...regions: (
297
302
  | {region: RegionPlain | Element | EyesSelector<Selector>; type?: AccessibilityRegionTypePlain}
298
303
  | RegionPlain
299
304
  | Element
300
305
  | EyesSelector<Selector>
306
+ | LegacyRegionPlain
301
307
  )[]
302
308
  ): this;
303
309
  accessibilityRegions(
304
310
  type: AccessibilityRegionTypePlain,
305
- ...regions: (RegionPlain | Element | EyesSelector<Selector>)[]
311
+ ...regions: (RegionPlain | Element | EyesSelector<Selector> | LegacyRegionPlain)[]
306
312
  ): this;
307
313
  beforeRenderScreenshotHook(script: string): this;
308
314
  content(): this;
309
315
  contentRegion(region: RegionPlain): this;
310
316
  contentRegion(region: Element): this;
311
317
  contentRegion(region: EyesSelector<Selector>): this;
312
- contentRegions(...regions: (RegionPlain | Element | EyesSelector<Selector>)[]): this;
318
+ contentRegion(region: LegacyRegionPlain): this;
319
+ contentRegions(...regions: (RegionPlain | Element | EyesSelector<Selector> | LegacyRegionPlain)[]): this;
313
320
  disableBrowserFetching(disableBrowserFetching: boolean): this;
314
321
  enablePatterns(enablePatterns?: boolean): this;
315
322
  exact(): this;
@@ -327,6 +334,8 @@ export class CheckSettings {
327
334
  floating(region: Element): this;
328
335
  /** @deprecated */
329
336
  floating(region: EyesSelector<Selector>): this;
337
+ /** @deprecated */
338
+ floating(region: LegacyRegionPlain): this;
330
339
  floatingRegion(region: {
331
340
  region: RegionPlain | Element | EyesSelector<Selector>;
332
341
  maxUpOffset?: number;
@@ -355,6 +364,13 @@ export class CheckSettings {
355
364
  maxLeftOffset?: number,
356
365
  maxRightOffset?: number,
357
366
  ): this;
367
+ floatingRegion(
368
+ region: LegacyRegionPlain,
369
+ maxUpOffset?: number,
370
+ maxDownOffset?: number,
371
+ maxLeftOffset?: number,
372
+ maxRightOffset?: number,
373
+ ): this;
358
374
  floatingRegions(
359
375
  ...regions: (
360
376
  | {
@@ -367,9 +383,13 @@ export class CheckSettings {
367
383
  | RegionPlain
368
384
  | Element
369
385
  | EyesSelector<Selector>
386
+ | LegacyRegionPlain
370
387
  )[]
371
388
  ): this;
372
- floatingRegions(maxOffset: number, ...regions: (RegionPlain | Element | EyesSelector<Selector>)[]): this;
389
+ floatingRegions(
390
+ maxOffset: number,
391
+ ...regions: (RegionPlain | Element | EyesSelector<Selector> | LegacyRegionPlain)[]
392
+ ): this;
373
393
  /** @deprecated */
374
394
  floatings(
375
395
  ...regions: (
@@ -383,10 +403,14 @@ export class CheckSettings {
383
403
  | RegionPlain
384
404
  | Element
385
405
  | EyesSelector<Selector>
406
+ | LegacyRegionPlain
386
407
  )[]
387
408
  ): this;
388
409
  /** @deprecated */
389
- floatings(maxOffset: number, ...regions: (RegionPlain | Element | EyesSelector<Selector>)[]): this;
410
+ floatings(
411
+ maxOffset: number,
412
+ ...regions: (RegionPlain | Element | EyesSelector<Selector> | LegacyRegionPlain)[]
413
+ ): this;
390
414
  frame(context: {
391
415
  frame: Element | EyesSelector<Selector> | string | number;
392
416
  scrollRootElement?: Element | EyesSelector<Selector>;
@@ -402,32 +426,37 @@ export class CheckSettings {
402
426
  fully(fully?: boolean): this;
403
427
  hook(name: string, script: string): this;
404
428
  /** @deprecated */
405
- ignore(ignoreRegion: RegionPlain): this;
429
+ ignore(region: RegionPlain): this;
430
+ /** @deprecated */
431
+ ignore(region: Element): this;
406
432
  /** @deprecated */
407
- ignore(ignoreRegion: Element): this;
433
+ ignore(region: EyesSelector<Selector>): this;
408
434
  /** @deprecated */
409
- ignore(ignoreRegion: EyesSelector<Selector>): this;
435
+ ignore(region: LegacyRegionPlain): this;
410
436
  ignoreCaret(ignoreCaret?: boolean): this;
411
437
  ignoreDisplacements(ignoreDisplacements?: boolean): this;
412
- ignoreRegion(ignoreRegion: RegionPlain): this;
413
- ignoreRegion(ignoreRegion: Element): this;
414
- ignoreRegion(ignoreRegion: EyesSelector<Selector>): this;
415
- ignoreRegions(...ignoreRegions: (RegionPlain | Element | EyesSelector<Selector>)[]): this;
438
+ ignoreRegion(region: RegionPlain): this;
439
+ ignoreRegion(region: Element): this;
440
+ ignoreRegion(region: EyesSelector<Selector>): this;
441
+ ignoreRegion(region: LegacyRegionPlain): this;
442
+ ignoreRegions(...regions: (RegionPlain | Element | EyesSelector<Selector> | LegacyRegionPlain)[]): this;
416
443
  /** @deprecated */
417
- ignores(...ignoreRegions: (RegionPlain | Element | EyesSelector<Selector>)[]): this;
444
+ ignores(...regions: (RegionPlain | Element | EyesSelector<Selector> | LegacyRegionPlain)[]): this;
418
445
  layout(): this;
419
446
  layoutBreakpoints(layoutBreakpoints?: boolean): this;
420
447
  layoutBreakpoints(layoutBreakpoints?: number[]): this;
421
- layoutRegion(layoutRegion: RegionPlain): this;
422
- layoutRegion(layoutRegion: Element): this;
423
- layoutRegion(layoutRegion: EyesSelector<Selector>): this;
424
- layoutRegions(...layoutRegions: (RegionPlain | Element | EyesSelector<Selector>)[]): this;
448
+ layoutRegion(region: RegionPlain): this;
449
+ layoutRegion(region: Element): this;
450
+ layoutRegion(region: EyesSelector<Selector>): this;
451
+ layoutRegion(region: LegacyRegionPlain): this;
452
+ layoutRegions(...regions: (RegionPlain | Element | EyesSelector<Selector> | LegacyRegionPlain)[]): this;
425
453
  matchLevel(matchLevel: MatchLevelPlain): this;
426
454
  /** @undocumented */
427
455
  name(name: string): this;
428
456
  region(region: RegionPlain): this;
429
457
  region(region: Element): this;
430
458
  region(region: EyesSelector<Selector>): this;
459
+ region(region: LegacyRegionPlain): this;
431
460
  renderId(renderId: string): this;
432
461
  scrollRootElement(scrollRootElement: Element): this;
433
462
  scrollRootElement(scrollRootElement: EyesSelector<Selector>): this;
@@ -436,15 +465,17 @@ export class CheckSettings {
436
465
  /** @deprecated */
437
466
  stitchContent(stitchContent?: boolean): this;
438
467
  strict(): this;
439
- strictRegion(strictRegion: RegionPlain): this;
440
- strictRegion(strictRegion: Element): this;
441
- strictRegion(strictRegion: EyesSelector<Selector>): this;
442
- strictRegions(...regions: (RegionPlain | Element | EyesSelector<Selector>)[]): this;
468
+ strictRegion(region: RegionPlain): this;
469
+ strictRegion(region: Element): this;
470
+ strictRegion(region: EyesSelector<Selector>): this;
471
+ strictRegion(region: LegacyRegionPlain): this;
472
+ strictRegions(...regions: (RegionPlain | Element | EyesSelector<Selector> | LegacyRegionPlain)[]): this;
443
473
  timeout(timeout: number): this;
444
474
  useDom(useDom?: boolean): this;
445
475
  variationGroupId(variationGroupId: string): this;
446
476
  visualGridOption(key: string, value: any): this;
447
477
  visualGridOptions(options: {[key: string]: any}): this;
478
+ waitBeforeCapture(waitBeforeCapture: number): this;
448
479
  /** @deprecated */
449
480
  webHook(script: string): this;
450
481
  withName(name: string): this;
@@ -568,6 +599,8 @@ export class Configuration {
568
599
  set viewportSize(viewportSize: RectangleSizePlain);
569
600
  get visualGridOptions(): {[key: string]: any};
570
601
  set visualGridOptions(visualGridOptions: {[key: string]: any});
602
+ get waitBeforeCapture(): number;
603
+ set waitBeforeCapture(waitBeforeCapture: number);
571
604
  get waitBeforeScreenshots(): number;
572
605
  set waitBeforeScreenshots(waitBeforeScreenshots: number);
573
606
  addBrowser(browserInfo: DesktopBrowserInfo): this;
@@ -661,6 +694,7 @@ export class Configuration {
661
694
  getUseDom(): boolean;
662
695
  getViewportSize(): RectangleSize;
663
696
  getVisualGridOptions(): {[key: string]: any};
697
+ getWaitBeforeCapture(): number;
664
698
  getWaitBeforeScreenshots(): number;
665
699
  setAccessibilityValidation(accessibilityValidation: AccessibilitySettings): this;
666
700
  setAgentId(agentId: string): this;
@@ -744,6 +778,7 @@ export class Configuration {
744
778
  setViewportSize(viewportSize: RectangleSizePlain): this;
745
779
  setVisualGridOption(key: string, value: any): this;
746
780
  setVisualGridOptions(visualGridOptions: {[key: string]: any}): this;
781
+ setWaitBeforeCapture(waitBeforeCapture: number): this;
747
782
  setWaitBeforeScreenshots(waitBeforeScreenshots: number): this;
748
783
  }
749
784
 
@@ -1433,6 +1468,7 @@ export class TestResults implements Required<TestResultsPlain> {
1433
1468
  get hostApp(): string;
1434
1469
  get hostDisplaySize(): RectangleSizePlain;
1435
1470
  get hostOS(): string;
1471
+ get id(): string;
1436
1472
  get isAborted(): boolean;
1437
1473
  get isDifferent(): boolean;
1438
1474
  get isNew(): boolean;
@@ -1448,7 +1484,6 @@ export class TestResults implements Required<TestResultsPlain> {
1448
1484
  get steps(): number;
1449
1485
  get stepsInfo(): StepInfoPlain[];
1450
1486
  get strictMatches(): number;
1451
- get testId(): string;
1452
1487
  get url(): string;
1453
1488
  delete(): Promise<void>;
1454
1489
  /** @deprecated */
@@ -1690,6 +1725,7 @@ export type CheckSettingsPlain = {
1690
1725
  renderId?: string;
1691
1726
  variationGroupId?: string;
1692
1727
  timeout?: number;
1728
+ waitBeforeCapture?: number;
1693
1729
  };
1694
1730
 
1695
1731
  export type ChromeEmulationInfo = {
@@ -1742,12 +1778,14 @@ export type ConfigurationPlain = {
1742
1778
  cut?: CutProviderPlain;
1743
1779
  rotation?: ImageRotationPlain;
1744
1780
  scaleRatio?: number;
1781
+ waitBeforeCapture?: number;
1745
1782
  } & {
1746
1783
  /** @undocumented */ concurrentSessions?: number;
1747
1784
  browsersInfo?: (DesktopBrowserInfo | ChromeEmulationInfo | IOSDeviceInfo)[];
1748
1785
  visualGridOptions?: Record<string, any>;
1749
1786
  layoutBreakpoints?: boolean | number[];
1750
1787
  disableBrowserFetching?: boolean;
1788
+ waitBeforeCapture?: number;
1751
1789
  };
1752
1790
 
1753
1791
  export type ConsoleLogHandlerPlain = {type: 'console'};
@@ -1845,7 +1883,7 @@ export type ExactMatchSettingsPlain = {
1845
1883
  minDiffWidth: number;
1846
1884
  };
1847
1885
 
1848
- export type EyesSelector<TSelector> =
1886
+ export type EyesSelector<TSelector = never> =
1849
1887
  | TSelector
1850
1888
  | string
1851
1889
  | {frame?: EyesSelector<TSelector>; selector: TSelector | string; shadow?: EyesSelector<TSelector>; type?: string};
@@ -1892,6 +1930,7 @@ export type ImageRotationPlain = -270 | -180 | -90 | 0 | 90 | 180 | 270;
1892
1930
 
1893
1931
  export type IosDeviceNamePlain =
1894
1932
  | 'iPad (7th generation)'
1933
+ | 'iPad (9th generation)'
1895
1934
  | 'iPad Air (2nd generation)'
1896
1935
  | 'iPad Pro (12.9-inch) (3rd generation)'
1897
1936
  | 'iPhone 11'
@@ -1901,6 +1940,9 @@ export type IosDeviceNamePlain =
1901
1940
  | 'iPhone 12 Pro'
1902
1941
  | 'iPhone 12 Pro Max'
1903
1942
  | 'iPhone 12 mini'
1943
+ | 'iPhone 13'
1944
+ | 'iPhone 13 Pro'
1945
+ | 'iPhone 13 Pro Max'
1904
1946
  | 'iPhone 7'
1905
1947
  | 'iPhone 8'
1906
1948
  | 'iPhone X'
@@ -1909,6 +1951,9 @@ export type IosDeviceNamePlain =
1909
1951
 
1910
1952
  export type IosVersionPlain = 'latest' | 'latest-1';
1911
1953
 
1954
+ /** @deprecated */
1955
+ export type LegacyRegionPlain = {height: number; left: number; top: number; width: number};
1956
+
1912
1957
  export type LocationPlain = {x: number; y: number};
1913
1958
 
1914
1959
  export type LogHandlerPlain = CustomLogHandlerPlain | FileLogHandlerPlain | ConsoleLogHandlerPlain;
@@ -1983,6 +2028,7 @@ export type TestResultsPlain = {
1983
2028
  readonly hostApp?: string;
1984
2029
  readonly hostDisplaySize?: RectangleSizePlain;
1985
2030
  readonly hostOS?: string;
2031
+ readonly id?: string;
1986
2032
  readonly isAborted?: boolean;
1987
2033
  readonly isDifferent?: boolean;
1988
2034
  readonly isNew?: boolean;
@@ -1998,7 +2044,6 @@ export type TestResultsPlain = {
1998
2044
  readonly steps?: number;
1999
2045
  readonly stepsInfo?: StepInfoPlain[];
2000
2046
  readonly strictMatches?: number;
2001
- readonly testId?: string;
2002
2047
  readonly url?: string;
2003
2048
  };
2004
2049
 
@@ -2021,6 +2066,7 @@ export const Target: {
2021
2066
  region(region: RegionPlain): CheckSettings;
2022
2067
  region(region: Element): CheckSettings;
2023
2068
  region(region: EyesSelector<Selector>): CheckSettings;
2069
+ region(region: LegacyRegionPlain): CheckSettings;
2024
2070
  frame(context: {
2025
2071
  frame: Element | EyesSelector<Selector> | string | number;
2026
2072
  scrollRootElement?: Element | EyesSelector<Selector>;
@@ -2041,9 +2087,6 @@ export function RunnerOptions(): RunnerOptionsFluent;
2041
2087
 
2042
2088
  export function closeBatch(spec: {
2043
2089
  closeBatches(options: {
2044
- batchIds: string[];
2045
- serverUrl?: string;
2046
- apiKey?: string;
2047
- proxy?: ProxySettingsPlain;
2090
+ settings: {batchIds: string[]; serverUrl?: string; apiKey?: string; proxy?: ProxySettingsPlain};
2048
2091
  }): Promise<void>;
2049
2092
  }): {(options: {batchIds: string[]; serverUrl?: string; apiKey?: string; proxy?: ProxySettingsPlain}): Promise<void>};
package/dist/legacy.js DELETED
@@ -1,78 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.wrapDriver = void 0;
4
- function wrapDriver(driver) {
5
- const api = {
6
- get remoteWebDriver() {
7
- return driver;
8
- },
9
- getRemoteWebDriver() {
10
- return driver;
11
- },
12
- async findElementById(id) {
13
- return driver.findElement({ id });
14
- },
15
- async findElementsById(id) {
16
- return driver.findElements({ id });
17
- },
18
- async findElementByName(name) {
19
- return driver.findElement({ name });
20
- },
21
- async findElementsByName(name) {
22
- return driver.findElements({ name });
23
- },
24
- async findElementByCssSelector(css) {
25
- return driver.findElement({ css });
26
- },
27
- async findElementsByCssSelector(css) {
28
- return driver.findElements({ css });
29
- },
30
- async findElementByClassName(className) {
31
- throw driver.findElement({ className });
32
- },
33
- async findElementsByClassName(className) {
34
- throw driver.findElements({ className });
35
- },
36
- async findElementByLinkText(linkText) {
37
- throw driver.findElement({ linkText });
38
- },
39
- async findElementsByLinkText(linkText) {
40
- throw driver.findElements({ linkText });
41
- },
42
- async findElementByPartialLinkText(partialLinkText) {
43
- throw driver.findElement({ partialLinkText });
44
- },
45
- async findElementsByPartialLinkText(partialLinkText) {
46
- throw driver.findElements({ partialLinkText });
47
- },
48
- async findElementByTagName(tagName) {
49
- return driver.findElement({ tagName });
50
- },
51
- async findElementsByTagName(tagName) {
52
- return driver.findElements({ tagName });
53
- },
54
- async findElementByXPath(xpath) {
55
- return driver.findElement({ xpath });
56
- },
57
- async findElementsByXPath(xpath) {
58
- return driver.findElements({ xpath });
59
- },
60
- async getBrowserName() {
61
- const capabilities = await driver.getCapabilities();
62
- return capabilities.getBrowserName();
63
- },
64
- async getBrowserVersion() {
65
- const capabilities = await driver.getCapabilities();
66
- return capabilities.getBrowserVersion();
67
- },
68
- };
69
- return new Proxy(driver, {
70
- get(target, key, receiver) {
71
- if (Object.hasOwnProperty.call(api, key)) {
72
- return Reflect.get(api, key, receiver);
73
- }
74
- return Reflect.get(target, key);
75
- },
76
- });
77
- }
78
- exports.wrapDriver = wrapDriver;