@applitools/eyes-webdriverio 5.49.3 → 5.50.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
@@ -1,5 +1,160 @@
1
1
  # Changelog
2
2
 
3
+ ## [5.50.0](https://github.com/applitools/eyes.sdk.javascript1/compare/js/eyes-webdriverio@5.49.4...js/eyes-webdriverio@5.50.0) (2023-11-21)
4
+
5
+
6
+ ### Features
7
+
8
+ * added `enableEyesLogs` configuration to the eyes service ([639ca8a](https://github.com/applitools/eyes.sdk.javascript1/commit/639ca8a021008d06fc09d19ca58ac3d00a18e4c3))
9
+ * added `useExecutionCloud` configuration to the eyes service ([#2033](https://github.com/applitools/eyes.sdk.javascript1/issues/2033)) ([639ca8a](https://github.com/applitools/eyes.sdk.javascript1/commit/639ca8a021008d06fc09d19ca58ac3d00a18e4c3))
10
+ * added notification about outdated sdk version ([#2012](https://github.com/applitools/eyes.sdk.javascript1/issues/2012)) ([0f0a646](https://github.com/applitools/eyes.sdk.javascript1/commit/0f0a6462a56e7c97f9a22173c3b63af91e220adb))
11
+
12
+
13
+ ### Dependencies
14
+
15
+ * @applitools/utils bumped to 1.6.3
16
+ #### Bug Fixes
17
+
18
+ * don't throw error for missing configuration file ([#2034](https://github.com/applitools/eyes.sdk.javascript1/issues/2034)) ([d084e7b](https://github.com/applitools/eyes.sdk.javascript1/commit/d084e7bf6e1727e3969622b4e597881f18241eb3))
19
+ * @applitools/socket bumped to 1.1.13
20
+
21
+ * @applitools/dom-snapshot bumped to 4.7.14
22
+ #### Bug Fixes
23
+
24
+ * preserve css declarations order in dom-snapshot ([#2037](https://github.com/applitools/eyes.sdk.javascript1/issues/2037)) ([1381851](https://github.com/applitools/eyes.sdk.javascript1/commit/1381851d46f28ea7e7724025c4eab33c81c4e144))
25
+ * @applitools/spec-driver-webdriver bumped to 1.0.50
26
+ #### Bug Fixes
27
+
28
+ * send devtool commands in chromium ([#2039](https://github.com/applitools/eyes.sdk.javascript1/issues/2039)) ([ff42043](https://github.com/applitools/eyes.sdk.javascript1/commit/ff42043c3d9f110eb7b22ab1a8448d77859923b4))
29
+
30
+
31
+
32
+ * @applitools/core bumped to 4.2.0
33
+ #### Features
34
+
35
+ * added notification about outdated sdk version ([#2012](https://github.com/applitools/eyes.sdk.javascript1/issues/2012)) ([0f0a646](https://github.com/applitools/eyes.sdk.javascript1/commit/0f0a6462a56e7c97f9a22173c3b63af91e220adb))
36
+ * log driver environment info to splank ([#2023](https://github.com/applitools/eyes.sdk.javascript1/issues/2023)) ([11d0546](https://github.com/applitools/eyes.sdk.javascript1/commit/11d0546e76962b4c231e140b0229b8402da27f69))
37
+
38
+
39
+ #### Bug Fixes
40
+
41
+ * return result when error in the ufg ([#2020](https://github.com/applitools/eyes.sdk.javascript1/issues/2020)) ([28cdcc5](https://github.com/applitools/eyes.sdk.javascript1/commit/28cdcc5a859641d0edde032165c5068fcc580c8d))
42
+
43
+
44
+
45
+ * @applitools/spec-driver-selenium bumped to 1.5.64
46
+
47
+ * @applitools/spec-driver-puppeteer bumped to 1.3.0
48
+ #### Features
49
+
50
+ * added notification about outdated sdk version ([#2012](https://github.com/applitools/eyes.sdk.javascript1/issues/2012)) ([0f0a646](https://github.com/applitools/eyes.sdk.javascript1/commit/0f0a6462a56e7c97f9a22173c3b63af91e220adb))
51
+
52
+
53
+
54
+ * @applitools/screenshoter bumped to 3.8.16
55
+
56
+ * @applitools/tunnel-client bumped to 1.3.1
57
+
58
+ * @applitools/ec-client bumped to 1.7.16
59
+
60
+ * @applitools/core-base bumped to 1.7.3
61
+ #### Bug Fixes
62
+
63
+ * remove connection timeout in case of a long running tasks ([#2006](https://github.com/applitools/eyes.sdk.javascript1/issues/2006)) ([49a596a](https://github.com/applitools/eyes.sdk.javascript1/commit/49a596ac1b022a66b5c07ecfee458cc061891ce0))
64
+ * return result when error in the ufg ([#2020](https://github.com/applitools/eyes.sdk.javascript1/issues/2020)) ([28cdcc5](https://github.com/applitools/eyes.sdk.javascript1/commit/28cdcc5a859641d0edde032165c5068fcc580c8d))
65
+
66
+
67
+
68
+ * @applitools/eyes bumped to 1.12.0
69
+ #### Features
70
+
71
+ * added `enableEyesLogs` configuration to the eyes service ([639ca8a](https://github.com/applitools/eyes.sdk.javascript1/commit/639ca8a021008d06fc09d19ca58ac3d00a18e4c3))
72
+ * added `useExecutionCloud` configuration to the eyes service ([#2033](https://github.com/applitools/eyes.sdk.javascript1/issues/2033)) ([639ca8a](https://github.com/applitools/eyes.sdk.javascript1/commit/639ca8a021008d06fc09d19ca58ac3d00a18e4c3))
73
+
74
+
75
+ #### Bug Fixes
76
+
77
+ * error to unknown type in exception ([#2035](https://github.com/applitools/eyes.sdk.javascript1/issues/2035)) ([16d78c3](https://github.com/applitools/eyes.sdk.javascript1/commit/16d78c3cce90a5cb50cc2aa4e9ab6a58b7b93f89))
78
+
79
+
80
+
81
+ * @applitools/logger bumped to 2.0.13
82
+
83
+ * @applitools/req bumped to 1.6.3
84
+
85
+ * @applitools/image bumped to 1.1.8
86
+
87
+ * @applitools/driver bumped to 1.15.1
88
+
89
+ * @applitools/nml-client bumped to 1.5.16
90
+
91
+ * @applitools/ufg-client bumped to 1.9.8
92
+
93
+
94
+ ## [5.49.4](https://github.com/applitools/eyes.sdk.javascript1/compare/js/eyes-webdriverio@5.49.3...js/eyes-webdriverio@5.49.4) (2023-11-07)
95
+
96
+
97
+ ### Dependencies
98
+
99
+ * @applitools/dom-shared bumped to 1.0.11
100
+ #### Bug Fixes
101
+
102
+ * (java/eyes-appium-java5): fix incorrect stitchMode mapping in checkSettings ([c70428e](https://github.com/applitools/eyes.sdk.javascript1/commit/c70428ec83e26b8b5e398ff11814f8376ca97d56))
103
+ * @applitools/dom-capture bumped to 11.2.4
104
+ #### Bug Fixes
105
+
106
+ * (java/eyes-appium-java5): fix incorrect stitchMode mapping in checkSettings ([c70428e](https://github.com/applitools/eyes.sdk.javascript1/commit/c70428ec83e26b8b5e398ff11814f8376ca97d56))
107
+
108
+
109
+
110
+ * @applitools/dom-snapshot bumped to 4.7.13
111
+ #### Bug Fixes
112
+
113
+ * (java/eyes-appium-java5): fix incorrect stitchMode mapping in checkSettings ([c70428e](https://github.com/applitools/eyes.sdk.javascript1/commit/c70428ec83e26b8b5e398ff11814f8376ca97d56))
114
+ * handled duplicated style properties in inline style tags ([#2014](https://github.com/applitools/eyes.sdk.javascript1/issues/2014)) ([2f8bada](https://github.com/applitools/eyes.sdk.javascript1/commit/2f8bada9cd44c65a69e54cbd08f57534632f12d2))
115
+
116
+
117
+
118
+ * @applitools/spec-driver-webdriver bumped to 1.0.49
119
+
120
+ * @applitools/spec-driver-selenium bumped to 1.5.63
121
+
122
+ * @applitools/spec-driver-puppeteer bumped to 1.2.5
123
+
124
+ * @applitools/driver bumped to 1.15.0
125
+ #### Features
126
+
127
+ * added warning when driver used with capabilities that may conflict with applitools lib workflow ([#2011](https://github.com/applitools/eyes.sdk.javascript1/issues/2011)) ([081006d](https://github.com/applitools/eyes.sdk.javascript1/commit/081006d879894db03a2713129b66586496b6eb02))
128
+ * @applitools/ufg-client bumped to 1.9.7
129
+ #### Bug Fixes
130
+
131
+ * added retries on ufg requests that respond with 503 status code ([7d78917](https://github.com/applitools/eyes.sdk.javascript1/commit/7d78917d559fa182c6723ca34cef2118cf08a036))
132
+ * @applitools/core bumped to 4.1.0
133
+ #### Features
134
+
135
+ * added warning when driver used with capabilities that may conflict with applitools lib workflow ([#2011](https://github.com/applitools/eyes.sdk.javascript1/issues/2011)) ([081006d](https://github.com/applitools/eyes.sdk.javascript1/commit/081006d879894db03a2713129b66586496b6eb02))
136
+
137
+
138
+ #### Bug Fixes
139
+
140
+ * fixed issue that caused dom snapshots to be taken for different viewport sizes when layout breakpoints were explicitly turned off ([4121876](https://github.com/applitools/eyes.sdk.javascript1/commit/4121876189f133b6023cfea52ca91c02c31079fb))
141
+
142
+
143
+
144
+ * @applitools/screenshoter bumped to 3.8.15
145
+
146
+ * @applitools/nml-client bumped to 1.5.15
147
+
148
+ * @applitools/ec-client bumped to 1.7.15
149
+
150
+ * @applitools/eyes bumped to 1.11.4
151
+ #### Bug Fixes
152
+
153
+ * fixed issue when w3c properties were added to legacy capabilities object in `Eyes.setMobileCapabilities` method ([94d785f](https://github.com/applitools/eyes.sdk.javascript1/commit/94d785f0428df101c207d6f09a55c46f2bdbf19e))
154
+
155
+
156
+
157
+
3
158
  ## [5.49.3](https://github.com/applitools/eyes.sdk.javascript1/compare/js/eyes-webdriverio@5.49.2...js/eyes-webdriverio@5.49.3) (2023-10-30)
4
159
 
5
160
 
@@ -17,6 +17,14 @@ function extractEnvironment() {
17
17
  catch {
18
18
  // NOTE: ignore error
19
19
  }
20
- return { versions };
20
+ let sdk = undefined;
21
+ try {
22
+ const { name, version } = require('../package.json');
23
+ sdk = { lang: 'js', name, currentVersion: version };
24
+ }
25
+ catch {
26
+ // NOTE: ignore error
27
+ }
28
+ return { versions, sdk };
21
29
  }
22
30
  exports.extractEnvironment = extractEnvironment;
package/dist/service.js CHANGED
@@ -1,16 +1,5 @@
1
1
  "use strict";
2
- var _a;
3
2
  const api_1 = require("./api");
4
- if (!process.env.APPLITOOLS_FRAMEWORK_MAJOR_VERSION) {
5
- try {
6
- const version = (_a = process.env.APPLITOOLS_FRAMEWORK_VERSION) !== null && _a !== void 0 ? _a : require('webdriverio/package.json').version;
7
- const [major] = version.split('.', 1);
8
- process.env.APPLITOOLS_FRAMEWORK_MAJOR_VERSION = major;
9
- }
10
- catch {
11
- // NOTE: ignore error
12
- }
13
- }
14
3
  class EyesOverride extends api_1.Eyes {
15
4
  }
16
5
  EyesOverride._sdk = {
@@ -18,90 +7,102 @@ EyesOverride._sdk = {
18
7
  agentId: `eyes-webdriverio-service/${require('../package.json').version}`,
19
8
  };
20
9
  class EyesService {
21
- constructor({ useVisualGrid, concurrency, eyes, ...config }) {
22
- const wdioMajorVersion = Number(process.env.APPLITOOLS_FRAMEWORK_MAJOR_VERSION);
23
- config = wdioMajorVersion < 6 ? { ...eyes } : config;
24
- if (!useVisualGrid)
25
- config.hideScrollbars = true;
26
- this._eyes = new EyesOverride(useVisualGrid ? new api_1.VisualGridRunner({ testConcurrency: concurrency }) : new api_1.ClassicRunner(), config);
10
+ constructor(config) {
11
+ const { useExecutionCloud, useVisualGrid, concurrency, ...eyesConfig } = config;
12
+ this._config = { useExecutionCloud, useVisualGrid, concurrency };
13
+ this._eyes = new EyesOverride(this._config.useVisualGrid
14
+ ? new api_1.VisualGridRunner({ testConcurrency: this._config.concurrency })
15
+ : new api_1.ClassicRunner(), eyesConfig);
27
16
  }
28
17
  async _eyesOpen() {
29
- if (!this._eyes.isOpen) {
30
- this._testResults = undefined;
18
+ if (!this._eyes.isOpen)
31
19
  await this._eyes.open(browser);
32
- }
33
20
  }
34
21
  async _eyesClose() {
35
- if (this._eyes.isOpen) {
36
- this._testResults = await this._eyes.close(false);
37
- }
22
+ if (this._eyes.isOpen)
23
+ await this._eyes.closeAsync();
38
24
  }
39
- beforeSession(config) {
40
- this._appName = this._eyes.configuration.appName;
41
- if (config.enableEyesLogs) {
25
+ async beforeSession(options) {
26
+ if (this._config.useExecutionCloud) {
27
+ const url = new URL(await this._eyes.getExecutionCloudUrl());
28
+ options.protocol = url.protocol ? url.protocol.replace(/:$/, '') : undefined;
29
+ options.hostname = url.hostname;
30
+ if (url.port)
31
+ options.port = Number(url.port);
32
+ else if (options.protocol === 'http')
33
+ options.port = 80;
34
+ else if (options.protocol === 'https')
35
+ options.port = 443;
36
+ options.path = url.pathname;
37
+ }
38
+ if (options.enableEyesLogs || this._config.enableEyesLogs) {
42
39
  this._eyes.setLogHandler({ type: 'console' });
43
40
  }
44
- }
45
- before() {
46
41
  browser.addCommand('getEyes', () => {
47
42
  return this._eyes;
48
43
  });
49
- browser.addCommand('eyesCheck', async (title, checkSettings = { fully: true }) => {
44
+ browser.addCommand('eyesGetConfiguration', () => {
45
+ return this._eyes.getConfiguration();
46
+ });
47
+ browser.addCommand('eyesSetConfiguration', (configuration) => {
48
+ return this._eyes.setConfiguration(configuration);
49
+ });
50
+ browser.addCommand('eyesCheck', async (...args) => {
50
51
  await this._eyesOpen();
51
- return this._eyes.check(title, checkSettings);
52
+ return this._eyes.check(...args);
53
+ });
54
+ browser.addCommand('eyesGetResults', async (throwErr) => {
55
+ await this._eyesClose();
56
+ return this._eyes.getResults(throwErr);
57
+ });
58
+ browser.addCommand('eyesGetAllTestResults', async (throwErr) => {
59
+ return this._eyes.runner.getAllTestResults(throwErr);
52
60
  });
53
- // deprecated, alias of eyesCheck
61
+ // renamed
54
62
  browser.addCommand('eyesCheckWindow', async (...args) => {
55
63
  return browser.eyesCheck(...args);
56
64
  });
65
+ // renamed + improved
66
+ browser.addCommand('eyesGetTestResults', async () => {
67
+ const [result] = await browser.eyesGetResults();
68
+ return result;
69
+ });
70
+ // should be set through check settings or configuration
57
71
  browser.addCommand('eyesSetScrollRootElement', (element) => {
58
72
  this._eyes.getConfiguration().setScrollRootElement(element);
59
73
  });
74
+ // should be set through configuration
60
75
  browser.addCommand('eyesAddProperty', (key, value) => {
61
76
  this._eyes.getConfiguration().addProperty(key, value);
62
77
  });
78
+ // should be set through configuration
63
79
  browser.addCommand('eyesClearProperties', () => {
64
80
  this._eyes.getConfiguration().clearProperties();
65
81
  });
66
- browser.addCommand('eyesGetTestResults', async () => {
67
- // because `afterTest` executes after `afterEach`, this is the way to get results in `afterEach` or `it`
68
- await this._eyesClose();
69
- return this._testResults;
70
- });
71
- browser.addCommand('eyesSetConfiguration', (configuration) => {
72
- return this._eyes.setConfiguration(configuration);
73
- });
82
+ // useless
74
83
  browser.addCommand('eyesGetIsOpen', () => {
75
84
  return this._eyes.getIsOpen();
76
85
  });
77
- browser.addCommand('eyesGetConfiguration', () => {
78
- return this._eyes.getConfiguration();
79
- });
80
- browser.addCommand('eyesGetAllTestResults', async (throwErr) => {
81
- return this._eyes.runner.getAllTestResults(throwErr);
82
- });
83
86
  }
84
- beforeTest(test) {
85
- var _a, _b, _c;
86
- const configuration = this._eyes.getConfiguration();
87
- configuration.setTestName((_a = test.title) !== null && _a !== void 0 ? _a : test.description); // test.title is for mocha, and test.description is for jasmine
88
- if (!this._appName) {
89
- configuration.setAppName((_b = test.parent) !== null && _b !== void 0 ? _b : (_c = test.fullName) === null || _c === void 0 ? void 0 : _c.replace(` ${test.description}`, '')); // test.parent is for mocha, and test.id is for jasmine
90
- }
91
- if (!configuration.getViewportSize()) {
92
- configuration.setViewportSize({ width: 800, height: 600 });
93
- }
94
- this._eyes.setConfiguration(configuration);
87
+ async before() {
88
+ var _a;
89
+ var _b;
90
+ (_a = (_b = this._eyes.configuration).viewportSize) !== null && _a !== void 0 ? _a : (_b.viewportSize = { width: 800, height: 600 });
91
+ }
92
+ async beforeTest(test) {
93
+ var _a, _b, _c, _d, _e;
94
+ var _f, _g;
95
+ (_a = (_f = this._eyes.configuration).appName) !== null && _a !== void 0 ? _a : (_f.appName = (_b = test.parent /* mocha */) !== null && _b !== void 0 ? _b : (_c = test.fullName) === null || _c === void 0 ? void 0 : _c.replace(` ${test.description}`, '')); /* jasmine */
96
+ (_d = (_g = this._eyes.configuration).testName) !== null && _d !== void 0 ? _d : (_g.testName = (_e = test.title /* mocha */) !== null && _e !== void 0 ? _e : test.description); /* jasmine */
95
97
  }
96
98
  async afterTest() {
97
- // the next line is required because if we set an element in one test, then the following test
98
- // will say that the element is not attached to the page (because different browsers are used)
99
- this._eyes.getConfiguration().setScrollRootElement(null);
99
+ this._eyes.configuration.appName = undefined;
100
+ this._eyes.configuration.testName = undefined;
101
+ this._eyes.configuration.scrollRootElement = undefined;
100
102
  await this._eyesClose();
101
103
  }
102
104
  async after() {
103
105
  await this._eyes.runner.getAllTestResults(false);
104
- await this._eyes.abort();
105
106
  }
106
107
  }
107
108
  module.exports = EyesService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/eyes-webdriverio",
3
- "version": "5.49.3",
3
+ "version": "5.50.0",
4
4
  "description": "Applitools Eyes SDK for WebdriverIO",
5
5
  "keywords": [
6
6
  "eyes-webdriverio",
@@ -30,6 +30,9 @@
30
30
  "default": "./dist/service.js",
31
31
  "types": "./types/service.d.ts"
32
32
  },
33
+ "./v8": {
34
+ "types": "./types/v8.d.ts"
35
+ },
33
36
  "./v7": {
34
37
  "types": "./types/v7.d.ts"
35
38
  },
@@ -49,28 +52,6 @@
49
52
  "./types/*": "./dist/*.d.ts",
50
53
  "./package.json": "./package.json"
51
54
  },
52
- "typesVersions": {
53
- "*": {
54
- "service": [
55
- "./types/service.d.ts"
56
- ],
57
- "v7": [
58
- "./types/v7.d.ts"
59
- ],
60
- "v6": [
61
- "./types/v6.d.ts"
62
- ],
63
- "v5": [
64
- "./types/v5-async.d.ts"
65
- ],
66
- "v5/async": [
67
- "./types/v5-async.d.ts"
68
- ],
69
- "v5/sync": [
70
- "./types/v5-sync.d.ts"
71
- ]
72
- }
73
- },
74
55
  "files": [
75
56
  "dist",
76
57
  "types"
@@ -84,20 +65,20 @@
84
65
  "test:local": "run test:it && run test:service && MOCHA_OMIT_TAGS=sauce run test:coverage",
85
66
  "test:local:cdp": "APPLITOOLS_FRAMEWORK_PROTOCOL=cdp run test:local",
86
67
  "test:sauce": "MOCHA_ONLY_TAGS=sauce run test:coverage",
87
- "test:service": "MOCHA_GROUP=service run --top-level mocha './test/service/unit/*.spec.js' && wdio run ./test/service/wdio.conf.js --autoCompileOpts.autoCompile=0 && wdio run ./test/service/no-config/wdio.no-config.conf.js --autoCompileOpts.autoCompile=0 && wdio run ./test/service/vg/wdio.vg.conf.js --autoCompileOpts.autoCompile=0",
68
+ "test:service": "MOCHA_GROUP=service wdio run ./test/service/config/basic.config.js --autoCompileOpts.autoCompile=0 && wdio run ./test/service/config/ec.config.js --autoCompileOpts.autoCompile=0",
88
69
  "test:coverage": "APPLITOOLS_SHOW_LOGS=true APPLITOOLS_LOG_FILE=\"./logs/$(uuidgen).log\" APPLITOOLS_BATCH_NAME='JS Coverage Tests: eyes-webdriverio' APPLITOOLS_BATCH_ID=$(uuidgen) MOCHA_GROUP=coverage run --top-level mocha './test/generated-coverage/*.spec.js' --parallel --jobs ${MOCHA_JOBS:-15} --exit",
89
70
  "setup": "run --top-level browsers:setup",
90
71
  "up:framework": "echo \"$(jq '.devDependencies.webdriverio = $ENV.APPLITOOLS_FRAMEWORK_VERSION' ./package.json)\" > ./package.json"
91
72
  },
92
73
  "dependencies": {
93
- "@applitools/driver": "1.14.4",
94
- "@applitools/eyes": "1.11.3",
95
- "@applitools/spec-driver-webdriver": "1.0.48"
74
+ "@applitools/driver": "1.15.1",
75
+ "@applitools/eyes": "1.12.0",
76
+ "@applitools/spec-driver-webdriver": "1.0.50"
96
77
  },
97
78
  "devDependencies": {
98
79
  "@applitools/api-extractor": "^1.2.22",
99
- "@applitools/bongo": "^5.7.0",
100
- "@applitools/generic": "^3.5.0",
80
+ "@applitools/bongo": "^5.7.6",
81
+ "@applitools/generic": "^3.5.2",
101
82
  "@applitools/test-utils": "^1.5.17",
102
83
  "@types/node": "^16.18.14",
103
84
  "@wdio/cli": "^8.14.4",
@@ -105,6 +86,7 @@
105
86
  "@wdio/globals": "^8.14.3",
106
87
  "@wdio/local-runner": "^8.14.3",
107
88
  "@wdio/mocha-framework": "^8.14.0",
89
+ "@wdio/types": "^8.21.0",
108
90
  "devtools": "^8.15.4",
109
91
  "expect-webdriverio": "^4.0.1",
110
92
  "webdriverio": "^8.15.4"
package/types/index.d.ts CHANGED
@@ -45,14 +45,7 @@ export class Eyes {
45
45
  open(appName?: undefined | string, testName?: undefined | string, viewportSize?: undefined | RectangleSizePlain, sessionType?: undefined | SessionTypePlain): Promise<void>;
46
46
  check(name: string, checkSettings: CheckSettingsAutomation): Promise<MatchResult>;
47
47
  check(name: string, checkSettings: CheckSettingsImage): Promise<MatchResult>;
48
- check(target: {
49
- image: string | URL | Buffer;
50
- name?: undefined | string;
51
- dom?: undefined | string;
52
- locationInViewport?: undefined | LocationPlain;
53
- locationInView?: undefined | LocationPlain;
54
- fullViewSize?: undefined | RectangleSizePlain;
55
- }, checkSettings?: undefined | CheckSettingsImagePlain): Promise<MatchResult>;
48
+ check(target: Image, checkSettings?: undefined | CheckSettingsImagePlain): Promise<MatchResult>;
56
49
  check(checkSettings?: undefined | CheckSettingsAutomationPlain): Promise<MatchResult>;
57
50
  checkWindow(name?: undefined | string, timeout?: undefined | number, fully?: undefined | boolean): Promise<MatchResult>;
58
51
  checkFrame(element: number, timeout?: undefined | number, name?: undefined | string): Promise<MatchResult>;
@@ -112,6 +105,7 @@ export class Eyes {
112
105
  abort(): Promise<TestResults>;
113
106
  abortAsync(): Promise<void>;
114
107
  abortIfNotClosed(): Promise<TestResultsPlain>;
108
+ getResults(throwErr?: undefined | boolean): Promise<Array<TestResults>>;
115
109
  getViewportSize(): Promise<RectangleSize>;
116
110
  setViewportSize(size: RectangleSizePlain): Promise<void>;
117
111
  getScrollRootElement(): Element | EyesSelector<Selector>;
@@ -1026,6 +1020,14 @@ export class BatchInfo implements Required<BatchInfoPlain> {
1026
1020
  addProperty(name: string, value: string): BatchInfo;
1027
1021
  addProperty(prop: PropertyDataPlain): BatchInfo;
1028
1022
  }
1023
+ export type Image = {
1024
+ image: string | URL | Buffer;
1025
+ name?: undefined | string;
1026
+ dom?: undefined | string;
1027
+ locationInViewport?: undefined | LocationPlain;
1028
+ locationInView?: undefined | LocationPlain;
1029
+ fullViewSize?: undefined | RectangleSizePlain;
1030
+ };
1029
1031
  export type CheckSettingsImagePlain = {
1030
1032
  name?: undefined | string;
1031
1033
  region?: undefined | RegionPlain;
@@ -1065,22 +1067,8 @@ export type CheckSettingsImagePlain = {
1065
1067
  densityMetrics?: undefined | { scaleRatio?: undefined | number; xdpi?: undefined | number; ydpi?: undefined | number; };
1066
1068
  };
1067
1069
  export class CheckSettingsImage {
1068
- constructor(settings?: undefined | CheckSettingsImage, target?: undefined | {
1069
- image: string | URL | Buffer;
1070
- name?: undefined | string;
1071
- dom?: undefined | string;
1072
- locationInViewport?: undefined | LocationPlain;
1073
- locationInView?: undefined | LocationPlain;
1074
- fullViewSize?: undefined | RectangleSizePlain;
1075
- });
1076
- constructor(settings?: undefined | CheckSettingsImagePlain, target?: undefined | {
1077
- image: string | URL | Buffer;
1078
- name?: undefined | string;
1079
- dom?: undefined | string;
1080
- locationInViewport?: undefined | LocationPlain;
1081
- locationInView?: undefined | LocationPlain;
1082
- fullViewSize?: undefined | RectangleSizePlain;
1083
- });
1070
+ constructor(settings?: undefined | CheckSettingsImage, target?: undefined | Image);
1071
+ constructor(settings?: undefined | CheckSettingsImagePlain, target?: undefined | Image);
1084
1072
  image(image: string): CheckSettingsImage;
1085
1073
  image(image: URL): CheckSettingsImage;
1086
1074
  image(image: Buffer): CheckSettingsImage;
@@ -1,20 +1,49 @@
1
- import { ConfigurationPlain } from './api';
2
- interface EyesServiceOptions extends ConfigurationPlain {
3
- useVisualGrid?: boolean;
4
- concurrency?: number;
5
- eyes?: EyesServiceOptions;
1
+ import type {
2
+ Element,
3
+ Selector,
4
+ Eyes,
5
+ ConfigurationPlain,
6
+ Configuration,
7
+ Image,
8
+ CheckSettingsImage,
9
+ CheckSettingsAutomation,
10
+ CheckSettingsImagePlain,
11
+ CheckSettingsAutomationPlain,
12
+ TestResults,
13
+ TestResultsSummary,
14
+ } from './index'
15
+
16
+ declare global {
17
+ namespace WebdriverIO {
18
+ interface ServiceOption extends ConfigurationPlain {
19
+ useExecutionCloud?: boolean
20
+ useVisualGrid?: boolean
21
+ concurrency?: number
22
+ enableEyesLogs?: boolean
23
+ /** @deprecated */
24
+ eyes?: ServiceOption
25
+ }
26
+
27
+ interface Browser {
28
+ getEyes(): Eyes
29
+ eyesGetConfiguration(): Configuration
30
+ eyesSetConfiguration(configuration: ConfigurationPlain): void
31
+ eyesCheck(name: string, checkSettings: CheckSettingsImage | CheckSettingsAutomation): Promise<void>
32
+ eyesCheck(target: Image, checkSettings?: CheckSettingsImagePlain): Promise<void>
33
+ eyesCheck(checkSettings?: CheckSettingsAutomationPlain): Promise<void>
34
+ eyesGetResults(throwErr: boolean): Promise<TestResults[]>
35
+ eyesGetAllTestResults(throwErr: boolean): Promise<TestResultsSummary>
36
+
37
+ /** @deprecated */
38
+ eyesGetIsOpen(): boolean
39
+ /** @deprecated */
40
+ eyesSetScrollRootElement(element: Element | Selector): void
41
+ /** @deprecated */
42
+ eyesAddProperty(key: string, value: string): void
43
+ /** @deprecated */
44
+ eyesClearProperties(): void
45
+ /** @deprecated */
46
+ eyesGetTestResults(throwErr: boolean): Promise<TestResults>
47
+ }
48
+ }
6
49
  }
7
- declare class EyesService {
8
- private _eyes;
9
- private _appName?;
10
- private _testResults?;
11
- constructor({ useVisualGrid, concurrency, eyes, ...config }: EyesServiceOptions);
12
- private _eyesOpen;
13
- private _eyesClose;
14
- beforeSession(config: Record<string, unknown>): void;
15
- before(): void;
16
- beforeTest(test: any): void;
17
- afterTest(): Promise<void>;
18
- after(): Promise<void>;
19
- }
20
- export = EyesService;