@applitools/eyes-webdriverio 5.33.0 → 5.34.3

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,31 @@
3
3
  ## Unreleased
4
4
 
5
5
 
6
+ ## 5.34.3 - 2021/12/7
7
+
8
+ - updated to @applitools/eyes-sdk-core@12.24.5 (from 12.24.2)
9
+ - updated to @applitools/visual-grid-client@15.8.49 (from 15.8.47)
10
+ - updated to @applitools/spec-driver-webdriverio@1.2.2 (from 1.2.1)
11
+
12
+ ## 5.34.2 - 2021/11/18
13
+
14
+ - updated to @applitools/eyes-sdk-core@12.24.2 (from 12.24.1)
15
+ - updated to @applitools/spec-driver-webdriverio@1.2.1 (from 1.2.0)
16
+ - updated to @applitools/visual-grid-client@15.8.47 (from 15.8.45)
17
+
18
+ ## 5.34.1 - 2021/11/14
19
+
20
+ - updated to @applitools/eyes-sdk-core@12.24.1 (from 12.24.0)
21
+ - updated to @applitools/spec-driver-webdriverio@1.2.0 (from 1.1.0)
22
+ - updated to @applitools/visual-grid-client@15.8.45 (from 15.8.44)
23
+
24
+ ## 5.34.0 - 2021/11/10
25
+
26
+ - support cookies
27
+ - updated to @applitools/eyes-api@1.1.6 (from 1.1.4)
28
+ - updated to @applitools/eyes-sdk-core@12.24.0 (from 12.23.16)
29
+ - updated to @applitools/visual-grid-client@15.8.44 (from 15.8.35)
30
+
6
31
  ## 5.33.0 - 2021/11/5
7
32
 
8
33
  - updated to @applitools/eyes-api@1.1.5 (from 1.1.4)
@@ -76,7 +101,6 @@
76
101
  - updated to @applitools/eyes-api@1.0.12 (from 1.0.11)
77
102
  - updated to @applitools/eyes-sdk-core@12.22.6 (from 12.22.4)
78
103
  - updated to @applitools/visual-grid-client@15.8.20 (from 15.8.18)
79
-
80
104
  ## 5.32.1 - 2021/8/9
81
105
 
82
106
  - updated to @applitools/eyes-sdk-core@12.22.4 (from 12.22.2)
@@ -95,7 +119,6 @@
95
119
  - updated to @applitools/eyes-api@1.0.7 (from 1.0.5)
96
120
  - updated to @applitools/eyes-sdk-core@12.21.3 (from 12.21.1)
97
121
  - updated to @applitools/visual-grid-client@15.8.12 (from 15.8.11)
98
-
99
122
  ## 5.31.8 - 2021/6/15
100
123
 
101
124
  - added full typescript support
package/dist/api.js CHANGED
@@ -25,11 +25,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.BatchClose = exports.Target = exports.CheckSettings = exports.Configuration = exports.Eyes = exports.By = 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"));
29
- const sdk = eyes_sdk_core_1.makeSDK({
30
- name: 'eyes.webdriverio',
28
+ const spec = __importStar(require("@applitools/spec-driver-webdriverio"));
29
+ const sdk = (0, eyes_sdk_core_1.makeSDK)({
30
+ name: 'eyes-webdriverio',
31
31
  version: require('../package.json').version,
32
32
  spec,
33
+ cwd: process.cwd(),
33
34
  VisualGridClient: require('@applitools/visual-grid-client'),
34
35
  });
35
36
  __exportStar(require("@applitools/eyes-api"), exports);
package/dist/index.js CHANGED
@@ -10,13 +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_WEBDRIVERIO_MAJOR_VERSION) {
14
- try {
15
- const { version } = require('webdriverio/package.json');
16
- const [major] = version.split('.', 1);
17
- process.env.APPLITOOLS_WEBDRIVERIO_MAJOR_VERSION = major;
18
- }
19
- catch (_a) {
20
- }
21
- }
22
13
  __exportStar(require("./api"), exports);
package/dist/legacy.js CHANGED
@@ -1,26 +1,6 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.wrapElement = exports.wrapDriver = exports.By = void 0;
23
- const utils = __importStar(require("@applitools/utils"));
3
+ exports.By = void 0;
24
4
  class By {
25
5
  constructor(value, using = 'css selector') {
26
6
  this.value = value;
@@ -58,170 +38,3 @@ class By {
58
38
  }
59
39
  }
60
40
  exports.By = By;
61
- function wrapDriver(browser) {
62
- const api = {
63
- get remoteWebDriver() {
64
- return browser;
65
- },
66
- async executeScript(script, ...args) {
67
- if (utils.types.isFunction(script) || args.length > 1 || !utils.types.isArray(args[0])) {
68
- return browser.execute(script, ...args);
69
- }
70
- else {
71
- return browser.executeScript(script, args[0]);
72
- }
73
- },
74
- async executeAsyncScript(script, ...args) {
75
- if (utils.types.isFunction(script) || args.length > 1 || !utils.types.isArray(args[0])) {
76
- return browser.executeAsync(script, ...args);
77
- }
78
- else {
79
- return browser.executeAsyncScript(script, args[0]);
80
- }
81
- },
82
- async findElement(usingOrLocator, value) {
83
- if (usingOrLocator instanceof By) {
84
- const element = await browser.$(usingOrLocator.toString());
85
- return !element.error ? wrapElement(element, this) : null;
86
- }
87
- else {
88
- return browser.findElement(usingOrLocator, value);
89
- }
90
- },
91
- async findElements(usingOrLocator, value) {
92
- if (usingOrLocator instanceof By) {
93
- const elements = await browser.$$(usingOrLocator.toString());
94
- return Array.from(elements, element => wrapElement(element, this));
95
- }
96
- else {
97
- return browser.findElements(usingOrLocator, value);
98
- }
99
- },
100
- async findElementById(id) {
101
- return this.findElement(By.id(id));
102
- },
103
- async findElementsById(id) {
104
- return this.findElements(By.id(id));
105
- },
106
- async findElementByName(name) {
107
- return this.findElement(By.name(name));
108
- },
109
- async findElementsByName(name) {
110
- return this.findElements(By.name(name));
111
- },
112
- async findElementByCssSelector(cssSelector) {
113
- return this.findElement(By.cssSelector(cssSelector));
114
- },
115
- async findElementsByCssSelector(cssSelector) {
116
- return this.findElements(By.cssSelector(cssSelector));
117
- },
118
- async findElementByClassName() {
119
- throw new TypeError('findElementByClassName method is not implemented!');
120
- },
121
- async findElementsByClassName() {
122
- throw new TypeError('findElementsByClassName method is not implemented!');
123
- },
124
- async findElementByLinkText() {
125
- throw new TypeError('findElementByLinkText method is not implemented!');
126
- },
127
- async findElementsByLinkText() {
128
- throw new TypeError('findElementsByLinkText method is not implemented!');
129
- },
130
- async findElementByPartialLinkText() {
131
- throw new TypeError('findElementByPartialLinkText method is not implemented!');
132
- },
133
- async findElementsByPartialLinkText() {
134
- throw new TypeError('findElementsByPartialLinkText method is not implemented!');
135
- },
136
- async findElementByTagName(tagName) {
137
- return this.findElement(By.tagName(tagName));
138
- },
139
- async findElementsByTagName(tagName) {
140
- return this.findElements(By.tagName(tagName));
141
- },
142
- async findElementByXPath(xpath) {
143
- return this.findElement(By.xPath(xpath));
144
- },
145
- async findElementsByXPath(xpath) {
146
- return this.findElements(By.xPath(xpath));
147
- },
148
- switchTo() {
149
- return {
150
- defaultContent: () => browser.switchToFrame(null),
151
- frame: arg => browser.switchToFrame(arg),
152
- parentFrame: () => browser.switchToParentFrame(),
153
- };
154
- },
155
- async end() {
156
- return browser.deleteSession();
157
- },
158
- async close() {
159
- return browser.deleteSession();
160
- },
161
- async sleep(ms) {
162
- return browser.pause(ms);
163
- },
164
- async getCapabilities() {
165
- return browser.capabilities;
166
- },
167
- async getCurrentUrl() {
168
- return browser.getUrl();
169
- },
170
- async getBrowserName() {
171
- return browser.capabilities.browserName;
172
- },
173
- };
174
- return new Proxy(browser, {
175
- get(target, key, receiver) {
176
- if (Object.hasOwnProperty.call(api, key)) {
177
- return Reflect.get(api, key, receiver);
178
- }
179
- return Reflect.get(target, key);
180
- },
181
- });
182
- }
183
- exports.wrapDriver = wrapDriver;
184
- function wrapElement(element, driver) {
185
- const api = {
186
- get element() {
187
- return element;
188
- },
189
- get locator() {
190
- return this.selector;
191
- },
192
- getDriver() {
193
- return driver;
194
- },
195
- getId() {
196
- return this.elementId;
197
- },
198
- async executeScript(script) {
199
- return driver.execute(script, this);
200
- },
201
- async findElement(locator) {
202
- const extendedParentElement = await this.$(this);
203
- const element = await extendedParentElement.$(locator instanceof By ? locator.toString() : locator);
204
- return !element.error ? wrapElement(element, driver) : null;
205
- },
206
- async findElements(locator) {
207
- const elements = await this.$$(locator instanceof By ? locator.toString() : locator);
208
- return Array.from(elements, element => wrapElement(element, driver));
209
- },
210
- async sendKeys(keysToSend) {
211
- await driver.elementClick(this.elementId);
212
- return driver.keys(keysToSend);
213
- },
214
- async click() {
215
- return driver.elementClick(this.elementId);
216
- },
217
- };
218
- return new Proxy(element, {
219
- get(target, key, receiver) {
220
- if (Object.hasOwnProperty.call(api, key)) {
221
- return Reflect.get(api, key, receiver);
222
- }
223
- return Reflect.get(target, key);
224
- },
225
- });
226
- }
227
- exports.wrapElement = wrapElement;
package/dist/service.js CHANGED
@@ -41,16 +41,17 @@ if (!process.env.APPLITOOLS_WEBDRIVERIO_MAJOR_VERSION) {
41
41
  catch (_a) {
42
42
  }
43
43
  }
44
- const sdk = eyes_sdk_core_1.makeSDK({
44
+ const sdk = (0, eyes_sdk_core_1.makeSDK)({
45
45
  name: 'eyes-webdriverio-service',
46
46
  version: require('../package.json').version,
47
47
  spec,
48
+ cwd: process.cwd(),
48
49
  VisualGridClient: require('@applitools/visual-grid-client'),
49
50
  });
50
51
  class EyesOverride extends api_1.Eyes {
51
52
  }
52
53
  EyesOverride._spec = sdk;
53
- module.exports = class EyesService {
54
+ class EyesService {
54
55
  constructor(_a) {
55
56
  var { useVisualGrid, concurrency, eyes } = _a, config = __rest(_a, ["useVisualGrid", "concurrency", "eyes"]);
56
57
  const wdioMajorVersion = Number(process.env.APPLITOOLS_WEBDRIVERIO_MAJOR_VERSION);
@@ -103,23 +104,24 @@ module.exports = class EyesService {
103
104
  });
104
105
  }
105
106
  beforeTest(test) {
107
+ var _a, _b, _c;
106
108
  const configuration = this._eyes.getConfiguration();
107
- configuration.setTestName(test.title || test.description);
109
+ configuration.setTestName((_a = test.title) !== null && _a !== void 0 ? _a : test.description);
108
110
  if (!this._appName) {
109
- configuration.setAppName(test.parent || test.id);
111
+ configuration.setAppName((_b = test.parent) !== null && _b !== void 0 ? _b : (((_c = test.fullName) === null || _c === void 0 ? void 0 : _c.replace(` ${test.description}`, '')) || test.id));
110
112
  }
111
113
  if (!configuration.getViewportSize()) {
112
114
  configuration.setViewportSize({ width: 800, height: 600 });
113
115
  }
114
116
  this._eyes.setConfiguration(configuration);
115
117
  }
116
- afterTest() {
118
+ async afterTest() {
117
119
  this._eyes.getConfiguration().setScrollRootElement(null);
118
- browser.call(() => this._eyesClose());
120
+ await this._eyesClose();
119
121
  }
120
- after() {
121
- browser.call(() => this._eyes.runner.getAllTestResults(false));
122
- browser.call(() => this._eyes.abort());
122
+ async after() {
123
+ await this._eyes.runner.getAllTestResults(false);
124
+ await this._eyes.abort();
123
125
  }
124
126
  async _eyesOpen() {
125
127
  if (!this._eyes.isOpen) {
@@ -132,4 +134,5 @@ module.exports = class EyesService {
132
134
  this._testResults = await this._eyes.close(false);
133
135
  }
134
136
  }
135
- };
137
+ }
138
+ module.exports = EyesService;