@applitools/eyes-testcafe 1.14.3 → 1.15.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,34 @@
3
3
  ## Unreleased
4
4
 
5
5
 
6
+ ## 1.15.3 - 2022/1/24
7
+
8
+ - updated 'Agent ID' to 'eyes.testcafe' (from 'eyes.webdriverio')
9
+ - updated to @applitools/eyes-api@1.1.7 (from 1.1.6)
10
+ - updated to @applitools/eyes-sdk-core@13.0.0 (from 12.24.13)
11
+ - updated to @applitools/visual-grid-client@15.8.62 (from 15.8.60)
12
+
13
+ ## 1.15.2 - 2022/1/14
14
+
15
+ - remove `esModuleInterop` ts compile option
16
+
17
+ ## 1.15.1 - 2022/1/13
18
+
19
+ - set failTestcafeOnDiff default value to true
20
+ - updated to @applitools/eyes-api@1.1.6 (from 1.1.0)
21
+ - updated to @applitools/eyes-sdk-core@12.24.9 (from 12.23.3)
22
+ - updated to @applitools/utils@1.2.11 (from 1.2.2)
23
+ - updated to @applitools/visual-grid-client@15.8.55 (from 15.8.24)
24
+ - updated to @applitools/eyes-sdk-core@12.24.13 (from 12.24.9)
25
+ - updated to @applitools/visual-grid-client@15.8.60 (from 15.8.55)
26
+
27
+ ## 1.15.0 - 2021/9/6
28
+
29
+ - updated to @applitools/eyes-api@1.1.0 (from 1.0.7)
30
+ - updated to @applitools/eyes-sdk-core@12.23.3 (from 12.21.5)
31
+ - updated to @applitools/utils@1.2.2 (from 1.2.0)
32
+ - updated to @applitools/visual-grid-client@15.8.24 (from 15.8.13)
33
+
6
34
  ## 1.14.3 - 2021/7/14
7
35
 
8
36
  - fix issue with `Eyes` being exported as a type from legacy type definition file
package/README.md CHANGED
@@ -72,39 +72,34 @@ test('Cookies', async t => {
72
72
  <br/>
73
73
 
74
74
  ### Index
75
- - [API](#API)
76
- - [Open](#open)
77
- - [CheckWindow](#checkWindow)
78
- - [tag](#tag)
79
- - [target](#target)
80
- - [fully](#fully)
81
- - [selector](#selector)
82
- - [region](#region)
83
- - [ignore](#ignore)
84
- - [floating](#floating)
85
- - [layout](#layout)
86
- - [strict](#strict)
87
- - [content](#content)
88
- - [accessibility](#accessibility)
89
- - [scriptHooks](#scriptHooks)
90
- - [sendDom](#sendDom)
91
- - [Close](#Close)
92
- - [waitForResults](#waitForResults)
93
- - [Best practices](#Best-practice-for-using-the-SDK)
94
- - [Concurrency](#Concurrency)
95
- - [Running wih testcafe concurrency](#Running-wih-testcafe-concurrency)
96
- - [Applitools concurrency](#Applitools-concurrency)
97
- - [Advanced configuration](#Advanced-configuration)
98
- - [Scoped configuration](#configuration-properties)
99
- - [Global configuration](#global-configuration-properties)
100
- - [Examples](#Method-1-Arguments-for-eyesOpen)
101
- - [Arguments for `eyesOpen`](#Method-1-Arguments-for-eyesOpen)
102
- - [Environment variables](#Method-2-Environment-variables)
103
- - [The `applitools.config.js` file](#Method-3-The-applitoolsconfigjs-file)
104
- - [Configuring the browser](#Configuring-the-browser)
105
- - [Device emulation](#Device-emulation)
106
- - [iOS device](#iOS-device)
107
- - [Troubleshooting](#Troubleshooting)
75
+ - [Eyes-Testcafe](#eyes-testcafe)
76
+ - [Installation](#installation)
77
+ - [Applitools API key](#applitools-api-key)
78
+ - [Usage](#usage)
79
+ - [Example](#example)
80
+ - [Index](#index)
81
+ - [API](#api)
82
+ - [**open**](#open)
83
+ - [**checkWindow**](#checkwindow)
84
+ - [Arguments to `eyes.checkWindow`](#arguments-to-eyescheckwindow)
85
+ - [**close**](#close)
86
+ - [**waitForResults**](#waitforresults)
87
+ - [Best practice for using the SDK](#best-practice-for-using-the-sdk)
88
+ - [Concurrency](#concurrency)
89
+ - [Running wih testcafe concurrency](#running-wih-testcafe-concurrency)
90
+ - [Applitools concurrency](#applitools-concurrency)
91
+ - [Advanced configuration](#advanced-configuration)
92
+ - [Configuration properties:](#configuration-properties)
93
+ - [Global configuration properties:](#global-configuration-properties)
94
+ - [Method 1: Arguments for `eyes.open`](#method-1-arguments-for-eyesopen)
95
+ - [Method 2: Environment variables](#method-2-environment-variables)
96
+ - [Method 3: The `applitools.config.js` file](#method-3-the-applitoolsconfigjs-file)
97
+ - [Configuring the browser](#configuring-the-browser)
98
+ - [Previous browser versions](#previous-browser-versions)
99
+ - [Getting a screenshot of multiple browsers in parallel](#getting-a-screenshot-of-multiple-browsers-in-parallel)
100
+ - [Device emulation](#device-emulation)
101
+ - [iOS device](#ios-device)
102
+ - [Troubleshooting](#troubleshooting)
108
103
 
109
104
  <br/><br/><br/>
110
105
 
@@ -161,6 +156,20 @@ eyes.checkWindow({ tag: 'your tag', target: 'your target mode' })
161
156
  (optional) In case [target](#target) is `region`, this should be the actual css, xpath or [a Testcafe Selector](https://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selectors/) to an element, and the screenshot would be the content of that element. For example:
162
157
 
163
158
  ```js
159
+ // Using a Testcafe Selector
160
+ import {Selector} from 'testcafe';
161
+ eyes.checkWindow({
162
+ target: 'region',
163
+ selector: Selector('.my-region')
164
+ });
165
+
166
+ // Using a Testcafe Selector to reference an element within a shadow DOM
167
+ import {Selector} from 'testcafe';
168
+ eyes.checkWindow({
169
+ target: 'region',
170
+ selector: Selector('#has-shadow-root').shadowRoot().find('.my-region')
171
+ });
172
+
164
173
  // The shorthand string version defaults to css selectors
165
174
  eyes.checkWindow({
166
175
  target: 'region',
@@ -176,13 +185,6 @@ eyes.checkWindow({ tag: 'your tag', target: 'your target mode' })
176
185
  }
177
186
  });
178
187
 
179
- // Using a Testcafe Selector
180
- import {Selector} from 'testcafe';
181
- eyes.checkWindow({
182
- target: 'region',
183
- selector: Selector('.my-region')
184
- });
185
-
186
188
  // Using an xpath selector
187
189
  eyes.checkWindow({
188
190
  target: 'region',
package/dist/api.js CHANGED
@@ -13,18 +13,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.BatchClose = exports.Target = exports.CheckSettings = exports.Configuration = exports.Eyes = void 0;
14
14
  const eyes_sdk_core_1 = require("@applitools/eyes-sdk-core");
15
15
  const api = require("@applitools/eyes-api");
16
- const spec = require("./spec-driver");
17
16
  const legacy = require("./legacy");
17
+ const spec = require("./spec-driver");
18
18
  process.env.APPLITOOLS_SCRIPT_RESULT_MAX_BYTE_LENGTH = '4718592';
19
19
  process.env.APPLITOOLS_SCRIPT_REMOVE_REVERSE_PROXY_URL_PREFIXES = 'true';
20
- const sdk = eyes_sdk_core_1.makeSDK({
21
- name: 'eyes.webdriverio',
20
+ const sdk = (0, eyes_sdk_core_1.makeSDK)({
21
+ name: 'eyes.testcafe',
22
22
  version: require('../package.json').version,
23
23
  spec,
24
24
  VisualGridClient: require('@applitools/visual-grid-client'),
25
25
  });
26
26
  __exportStar(require("@applitools/eyes-api"), exports);
27
- class Eyes extends legacy.TestCafeEyes(api.Eyes) {
27
+ class Eyes extends legacy.LegacyTestCafeEyesMixin(api.Eyes) {
28
28
  }
29
29
  exports.Eyes = Eyes;
30
30
  Eyes._spec = sdk;
@@ -41,4 +41,3 @@ class BatchClose extends api.BatchClose {
41
41
  }
42
42
  exports.BatchClose = BatchClose;
43
43
  BatchClose._spec = sdk;
44
- //# sourceMappingURL=api.js.map
@@ -2,4 +2,3 @@
2
2
  const index_1 = require("./index");
3
3
  index_1.Eyes.default = index_1.Eyes;
4
4
  module.exports = index_1.Eyes;
5
- //# sourceMappingURL=index-legacy.js.map
package/dist/index.js CHANGED
@@ -13,4 +13,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
13
13
  const api_1 = require("./api");
14
14
  __exportStar(require("./api"), exports);
15
15
  exports.default = api_1.Eyes;
16
- //# sourceMappingURL=index.js.map
package/dist/legacy.js CHANGED
@@ -11,21 +11,22 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  return t;
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.transformCheckSettings = exports.transformConfig = exports.TestCafeEyes = void 0;
14
+ exports.transformCheckSettings = exports.transformConfig = exports.LegacyTestCafeEyesMixin = void 0;
15
15
  const utils = require("@applitools/utils");
16
16
  const api = require("@applitools/eyes-api");
17
17
  const fs = require("fs");
18
18
  const path = require("path");
19
19
  const spec = require("./spec-driver");
20
20
  const eyes_sdk_core_1 = require("@applitools/eyes-sdk-core");
21
- function TestCafeEyes(Eyes) {
21
+ function LegacyTestCafeEyesMixin(Eyes) {
22
22
  return class TestCafeEyes extends Eyes {
23
23
  constructor(runnerOrConfigOrOptions, configOrRunner) {
24
- var _a, _b, _c;
24
+ var _a, _b, _c, _d;
25
25
  if (utils.types.isNull(runnerOrConfigOrOptions) || utils.types.has(runnerOrConfigOrOptions, 'configPath')) {
26
26
  const testcafeConfig = eyes_sdk_core_1.ConfigUtils.getConfig({ configPath: runnerOrConfigOrOptions === null || runnerOrConfigOrOptions === void 0 ? void 0 : runnerOrConfigOrOptions.configPath });
27
27
  const runner = (_a = runnerOrConfigOrOptions === null || runnerOrConfigOrOptions === void 0 ? void 0 : runnerOrConfigOrOptions.runner) !== null && _a !== void 0 ? _a : new api.VisualGridRunner({ testConcurrency: (_c = (_b = testcafeConfig.concurrency) !== null && _b !== void 0 ? _b : testcafeConfig.testConcurrency) !== null && _c !== void 0 ? _c : 1 });
28
28
  super(runner, transformConfig(testcafeConfig));
29
+ (_d = testcafeConfig.failTestcafeOnDiff) !== null && _d !== void 0 ? _d : (testcafeConfig.failTestcafeOnDiff = true);
29
30
  this._testcafeConfig = testcafeConfig;
30
31
  }
31
32
  else {
@@ -75,7 +76,7 @@ function TestCafeEyes(Eyes) {
75
76
  }
76
77
  };
77
78
  }
78
- exports.TestCafeEyes = TestCafeEyes;
79
+ exports.LegacyTestCafeEyesMixin = LegacyTestCafeEyesMixin;
79
80
  function transformConfig(options) {
80
81
  const config = Object.assign({}, options);
81
82
  if (options.concurrency)
@@ -182,4 +183,3 @@ function transformCheckSettings(options) {
182
183
  return settings;
183
184
  }
184
185
  exports.transformCheckSettings = transformCheckSettings;
185
- //# sourceMappingURL=legacy.js.map
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.build = exports.waitUntilDisplayed = exports.scrollIntoView = exports.hover = exports.type = exports.click = exports.takeScreenshot = exports.visit = exports.getUrl = exports.getTitle = exports.setViewportSize = exports.getElementRect = exports.findElements = exports.findElement = exports.childContext = exports.mainContext = exports.executeScript = exports.isEqualElements = exports.isStaleElementError = exports.extractSelector = exports.transformElement = exports.isSelector = exports.isElement = exports.isDriver = void 0;
4
- const utils = require("@applitools/utils");
3
+ exports.build = exports.waitUntilDisplayed = exports.scrollIntoView = exports.hover = exports.type = exports.click = exports.takeScreenshot = exports.visit = exports.getUrl = exports.getTitle = exports.getDriverInfo = exports.setViewportSize = exports.findElements = exports.findElement = exports.childContext = exports.mainContext = exports.executeScript = exports.isStaleElementError = exports.extractSelector = exports.transformSelector = exports.transformElement = exports.isSelector = exports.isElement = exports.isDriver = void 0;
5
4
  const testcafe = require("testcafe");
6
5
  const fs = require("fs");
6
+ const utils = require("@applitools/utils");
7
7
  function XPathSelector(selector, options) {
8
8
  const getElementsByXPath = testcafe.Selector(xpath => {
9
9
  const iterator = document.evaluate(xpath, document, null, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null);
@@ -17,14 +17,6 @@ function XPathSelector(selector, options) {
17
17
  }, options);
18
18
  return testcafe.Selector(getElementsByXPath(selector), options);
19
19
  }
20
- function transformSelector(selector) {
21
- if (utils.types.has(selector, ['type', 'selector'])) {
22
- if (selector.type === 'xpath')
23
- return XPathSelector(selector.selector);
24
- return testcafe.Selector(selector.selector);
25
- }
26
- return testcafe.Selector(selector);
27
- }
28
20
  function deserializeResult(result, elements) {
29
21
  if (!result) {
30
22
  return result;
@@ -120,15 +112,28 @@ function isElement(element) {
120
112
  }
121
113
  exports.isElement = isElement;
122
114
  function isSelector(selector) {
123
- return (utils.types.has(selector, ['type', 'selector']) ||
124
- utils.types.isString(selector) ||
125
- Boolean(selector.addCustomMethods && selector.find && selector.parent));
115
+ if (!selector)
116
+ return;
117
+ return Boolean(selector.addCustomMethods && selector.find && selector.parent);
126
118
  }
127
119
  exports.isSelector = isSelector;
128
120
  function transformElement(element) {
129
121
  return utils.types.isFunction(element.selector) ? element.selector : element;
130
122
  }
131
123
  exports.transformElement = transformElement;
124
+ function transformSelector(selector) {
125
+ if (utils.types.has(selector, 'selector')) {
126
+ let current = selector;
127
+ let transformed = selector.type === 'xpath' ? XPathSelector(current.selector) : testcafe.Selector(current.selector);
128
+ while (current.shadow) {
129
+ current = utils.types.has(current.shadow, 'selector') ? current.shadow : { selector: current.shadow };
130
+ transformed = transformed.shadowRoot().find(current.selector);
131
+ }
132
+ return transformed;
133
+ }
134
+ return testcafe.Selector(selector);
135
+ }
136
+ exports.transformSelector = transformSelector;
132
137
  function extractSelector(element) {
133
138
  return utils.types.isFunction(element.selector) ? element.selector : element;
134
139
  }
@@ -137,16 +142,6 @@ function isStaleElementError(_err) {
137
142
  return false;
138
143
  }
139
144
  exports.isStaleElementError = isStaleElementError;
140
- async function isEqualElements(t, element1, element2) {
141
- if (!element1 || !element2)
142
- return false;
143
- const compareElements = testcafe.ClientFunction(() => element1() === element2(), {
144
- boundTestRun: t,
145
- dependencies: { element1, element2 },
146
- });
147
- return compareElements();
148
- }
149
- exports.isEqualElements = isEqualElements;
150
145
  async function executeScript(t, script, arg) {
151
146
  script = utils.types.isFunction(script) ? script.toString() : script;
152
147
  const { result, resultId, elementsCount } = await scriptRunner.with({
@@ -182,15 +177,14 @@ async function findElements(t, selector) {
182
177
  return Array.from({ length: await elements.count }, (_, index) => elements.nth(index));
183
178
  }
184
179
  exports.findElements = findElements;
185
- async function getElementRect(_t, element) {
186
- const { left: x, top: y, width, height } = await element.boundingClientRect;
187
- return { x, y, width, height };
188
- }
189
- exports.getElementRect = getElementRect;
190
180
  async function setViewportSize(t, size) {
191
181
  await t.resizeWindow(size.width, size.height);
192
182
  }
193
183
  exports.setViewportSize = setViewportSize;
184
+ async function getDriverInfo(_t) {
185
+ return { features: { shadowSelector: true } };
186
+ }
187
+ exports.getDriverInfo = getDriverInfo;
194
188
  async function getTitle(t) {
195
189
  try {
196
190
  return await testcafe.Selector('title', { boundTestRun: t }).innerText;
@@ -259,4 +253,3 @@ function build() {
259
253
  return [undefined, () => void 0];
260
254
  }
261
255
  exports.build = build;
262
- //# sourceMappingURL=spec-driver.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/eyes-testcafe",
3
- "version": "1.14.3",
3
+ "version": "1.15.3",
4
4
  "description": "Applitools Eyes SDK for TestCafe",
5
5
  "keywords": [
6
6
  "eyes-testcafe",
@@ -24,6 +24,11 @@
24
24
  "dist",
25
25
  "types"
26
26
  ],
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "https://github.com/applitools/eyes.sdk.javascript1.git",
30
+ "directory": "packages/eyes-testcafe"
31
+ },
27
32
  "main": "./dist/index-legacy.js",
28
33
  "types": "./types/index-legacy.d.ts",
29
34
  "scripts": {
@@ -36,11 +41,9 @@
36
41
  "run:testcafe:8": "./node_modules/testcafe-8/bin/testcafe-with-v8-flag-filter.js",
37
42
  "run:testcafe:7": "./node_modules/testcafe-7/bin/testcafe-with-v8-flag-filter.js",
38
43
  "lint": "eslint '**/*.ts' '**/*.js'",
39
- "build": "yarn build:dist && yarn build:types",
40
- "build:dist": "tsc",
41
- "build:types": "api-extractor ./src/index.ts --out ./types/index.d.ts",
44
+ "build": "ttsc",
42
45
  "generate:tests": "coverage-tests generate ./test/coverage/config.js --name 'eyes-testcafe'",
43
- "test": "yarn build:dist && yarn test:it && yarn test:coverage",
46
+ "test": "yarn test:it && yarn test:coverage",
44
47
  "test:unit": "mocha --no-timeouts ./test/unit/*.spec.js",
45
48
  "test:it": "testcafe chrome:headless test/it && yarn test:it:firefox:headless",
46
49
  "test:it:chrome": "testcafe chrome test/it/spec-driver.spec.js",
@@ -54,8 +57,8 @@
54
57
  "test:coverage:custom": "yarn generate:tests && APPLITOOLS_USE_PRELOADED_CONFIG=true APPLITOOLS_BATCH_NAME='JS Coverage Tests: eyes-testcafe (custom)' APPLITOOLS_BATCH_ID=$(uuidgen) testcafe chrome:headless test/custom --reporter spec,xunit:coverage-test-report.xml",
55
58
  "report": "coverage-tests report ./test/coverage/config.js --name 'eyes-testcafe'",
56
59
  "deps": "bongo deps",
57
- "gh:test": "gh workflow run test.yml -f packages='testcafe' -f links='eyes-sdk-core eyes-api types utils sdk-shared visual-grid-client' -f linking-depth='1'",
58
- "gh:publish": "gh workflow run publish.yml -f packages='testcafe'",
60
+ "gh:test": "gh workflow run test.yml --ref $(git rev-parse --abbrev-ref HEAD) -f packages='testcafe' -f links='eyes-sdk-core eyes-api types test-utils utils driver snippets screenshoter sdk-shared visual-grid-client' -f linking-depth=3",
61
+ "gh:publish": "gh workflow run publish-testcafe.yml --ref $(git rev-parse --abbrev-ref HEAD)",
59
62
  "preversion": "yarn deps && bongo preversion && yarn build",
60
63
  "version": "bongo version",
61
64
  "postversion": "bongo postversion"
@@ -66,19 +69,19 @@
66
69
  }
67
70
  },
68
71
  "dependencies": {
69
- "@applitools/eyes-api": "1.0.7",
70
- "@applitools/eyes-sdk-core": "12.21.5",
71
- "@applitools/utils": "1.2.0",
72
- "@applitools/visual-grid-client": "15.8.13"
72
+ "@applitools/eyes-api": "1.1.7",
73
+ "@applitools/eyes-sdk-core": "13.0.0",
74
+ "@applitools/utils": "1.2.11",
75
+ "@applitools/visual-grid-client": "15.8.62"
73
76
  },
74
77
  "devDependencies": {
75
- "@applitools/api-extractor": "1.1.3",
76
- "@applitools/scripts": "1.0.1",
77
- "@applitools/sdk-coverage-tests": "^2.3.13",
78
- "@applitools/sdk-release-kit": "^0.13.0",
79
- "@applitools/sdk-shared": "0.9.3",
80
- "@applitools/test-server": "1.0.3",
81
- "@applitools/test-utils": "1.0.4",
78
+ "@applitools/api-extractor": "1.2.7",
79
+ "@applitools/scripts": "1.1.0",
80
+ "@applitools/sdk-coverage-tests": "^2.3.18",
81
+ "@applitools/sdk-release-kit": "^0.13.11",
82
+ "@applitools/sdk-shared": "0.9.11",
83
+ "@applitools/test-server": "1.0.8",
84
+ "@applitools/test-utils": "1.0.11",
82
85
  "@typescript-eslint/eslint-plugin": "^4.15.1",
83
86
  "@typescript-eslint/parser": "^4.15.1",
84
87
  "eslint": "^7.9.0",
@@ -90,12 +93,15 @@
90
93
  "husky": "^4.3.8",
91
94
  "mocha": "^8.0.1",
92
95
  "prettier": "^2.1.2",
93
- "testcafe": "^1.10.0",
96
+ "testcafe": "^1.18.1",
94
97
  "testcafe-10": "npm:testcafe@^1.10.0",
95
98
  "testcafe-7": "npm:testcafe@1.7.1",
96
99
  "testcafe-8": "npm:testcafe@1.8.8",
97
100
  "testcafe-9": "npm:testcafe@1.9.4",
98
- "testcafe-browser-provider-browserstack": "^1.13.2-alpha.1"
101
+ "testcafe-browser-provider-browserstack": "^1.13.2-alpha.1",
102
+ "ts-node": "^10.4.0",
103
+ "ttypescript": "^1.5.12",
104
+ "typescript": "^4.5.4"
99
105
  },
100
106
  "peerDependencies": {
101
107
  "testcafe": "^1.7.1"
@@ -1,3 +1,2 @@
1
- import {Eyes} from './index'
2
-
3
- export default Eyes
1
+ import { Eyes } from './index';
2
+ export = Eyes;