@applitools/eyes 1.33.3 → 1.33.4

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.
Files changed (141) hide show
  1. package/dist/BatchClose.js +84 -0
  2. package/dist/Eyes.js +750 -0
  3. package/dist/Logger.js +122 -0
  4. package/dist/Runners.js +130 -0
  5. package/dist/SDK.js +45 -0
  6. package/dist/SessionEventHandlers.js +193 -0
  7. package/dist/cli/cli.js +56 -0
  8. package/dist/cli/load-config.js +73 -0
  9. package/dist/enums/AccessibilityGuidelinesVersion.js +9 -0
  10. package/dist/enums/AccessibilityLevel.js +9 -0
  11. package/dist/enums/AccessibilityRegionType.js +12 -0
  12. package/dist/enums/AccessibilityStatus.js +9 -0
  13. package/dist/enums/BrowserType.js +23 -0
  14. package/dist/enums/CorsIframeHandle.js +10 -0
  15. package/dist/enums/DeviceName.js +105 -0
  16. package/dist/enums/DynamicTextType.js +13 -0
  17. package/dist/enums/FailureReport.js +8 -0
  18. package/dist/enums/IosDeviceName.js +47 -0
  19. package/dist/enums/IosMultiDeviceTarget.js +30 -0
  20. package/dist/enums/IosVersion.js +10 -0
  21. package/dist/enums/MatchLevel.js +15 -0
  22. package/dist/enums/ScreenOrientation.js +8 -0
  23. package/dist/enums/SessionType.js +8 -0
  24. package/dist/enums/StitchMode.js +11 -0
  25. package/dist/enums/TestResultsStatus.js +9 -0
  26. package/dist/errors/DiffsFoundError.js +38 -0
  27. package/dist/errors/EyesError.js +6 -0
  28. package/dist/errors/NewTestError.js +38 -0
  29. package/dist/errors/TestFailedError.js +47 -0
  30. package/dist/index.js +128 -0
  31. package/dist/input/AUTProxySettings.js +2 -0
  32. package/dist/input/AccessibilityMatchSettings.js +109 -0
  33. package/dist/input/AccessibilitySettings.js +2 -0
  34. package/dist/input/BatchInfo.js +153 -0
  35. package/dist/input/CheckSettings.js +663 -0
  36. package/dist/input/Configuration.js +1179 -0
  37. package/dist/input/CutProvider.js +132 -0
  38. package/dist/input/DebugScreenshotProvider.js +2 -0
  39. package/dist/input/DensityMetrics.js +2 -0
  40. package/dist/input/ExactMatchSettings.js +102 -0
  41. package/dist/input/EyesSelector.js +2 -0
  42. package/dist/input/FloatingMatchSettings.js +152 -0
  43. package/dist/input/Image.js +2 -0
  44. package/dist/input/ImageMatchSettings.js +271 -0
  45. package/dist/input/ImageRotation.js +59 -0
  46. package/dist/input/LatestCommitInfo.js +2 -0
  47. package/dist/input/LazyLoadOptions.js +2 -0
  48. package/dist/input/Location.js +74 -0
  49. package/dist/input/LogHandler.js +90 -0
  50. package/dist/input/OCRRegion.js +2 -0
  51. package/dist/input/OCRSettings.js +2 -0
  52. package/dist/input/PropertyData.js +76 -0
  53. package/dist/input/ProxySettings.js +77 -0
  54. package/dist/input/RectangleSize.js +74 -0
  55. package/dist/input/Region.js +135 -0
  56. package/dist/input/RenderInfo.js +2 -0
  57. package/dist/input/RunnerOptions.js +56 -0
  58. package/dist/input/VisualLocatorSettings.js +2 -0
  59. package/dist/output/ApiUrls.js +102 -0
  60. package/dist/output/AppUrls.js +66 -0
  61. package/dist/output/MatchResult.js +66 -0
  62. package/dist/output/SessionUrls.js +66 -0
  63. package/dist/output/StepInfo.js +118 -0
  64. package/dist/output/TestAccessibilityStatus.js +2 -0
  65. package/dist/output/TestResultContainer.js +49 -0
  66. package/dist/output/TestResults.js +378 -0
  67. package/dist/output/TestResultsSummary.js +49 -0
  68. package/dist/output/TextRegion.js +2 -0
  69. package/dist/output/ValidationInfo.js +60 -0
  70. package/dist/output/ValidationResult.js +53 -0
  71. package/package.json +1 -1
  72. package/types/BatchClose.d.ts +23 -0
  73. package/types/Eyes.d.ts +255 -0
  74. package/types/Logger.d.ts +30 -0
  75. package/types/Runners.d.ts +41 -0
  76. package/types/SDK.d.ts +20 -0
  77. package/types/SessionEventHandlers.d.ts +78 -0
  78. package/types/cli/cli.d.ts +2 -0
  79. package/types/cli/load-config.d.ts +1 -0
  80. package/types/enums/AccessibilityGuidelinesVersion.d.ts +5 -0
  81. package/types/enums/AccessibilityLevel.d.ts +5 -0
  82. package/types/enums/AccessibilityRegionType.d.ts +8 -0
  83. package/types/enums/AccessibilityStatus.d.ts +5 -0
  84. package/types/enums/BrowserType.d.ts +20 -0
  85. package/types/enums/CorsIframeHandle.d.ts +7 -0
  86. package/types/enums/DeviceName.d.ts +101 -0
  87. package/types/enums/DynamicTextType.d.ts +9 -0
  88. package/types/enums/FailureReport.d.ts +5 -0
  89. package/types/enums/IosDeviceName.d.ts +43 -0
  90. package/types/enums/IosMultiDeviceTarget.d.ts +26 -0
  91. package/types/enums/IosVersion.d.ts +7 -0
  92. package/types/enums/MatchLevel.d.ts +12 -0
  93. package/types/enums/ScreenOrientation.d.ts +5 -0
  94. package/types/enums/SessionType.d.ts +5 -0
  95. package/types/enums/StitchMode.d.ts +8 -0
  96. package/types/enums/TestResultsStatus.d.ts +6 -0
  97. package/types/errors/DiffsFoundError.d.ts +6 -0
  98. package/types/errors/EyesError.d.ts +2 -0
  99. package/types/errors/NewTestError.d.ts +6 -0
  100. package/types/errors/TestFailedError.d.ts +9 -0
  101. package/types/index.d.ts +60 -0
  102. package/types/input/AUTProxySettings.d.ts +5 -0
  103. package/types/input/AccessibilityMatchSettings.d.ts +34 -0
  104. package/types/input/AccessibilitySettings.d.ts +6 -0
  105. package/types/input/BatchInfo.d.ts +47 -0
  106. package/types/input/CheckSettings.d.ts +266 -0
  107. package/types/input/Configuration.d.ts +437 -0
  108. package/types/input/CutProvider.d.ts +44 -0
  109. package/types/input/DebugScreenshotProvider.d.ts +5 -0
  110. package/types/input/DensityMetrics.d.ts +5 -0
  111. package/types/input/ExactMatchSettings.d.ts +34 -0
  112. package/types/input/EyesSelector.d.ts +6 -0
  113. package/types/input/FloatingMatchSettings.d.ts +50 -0
  114. package/types/input/Image.d.ts +11 -0
  115. package/types/input/ImageMatchSettings.d.ts +95 -0
  116. package/types/input/ImageRotation.d.ts +15 -0
  117. package/types/input/LatestCommitInfo.d.ts +4 -0
  118. package/types/input/LazyLoadOptions.d.ts +5 -0
  119. package/types/input/Location.d.ts +23 -0
  120. package/types/input/LogHandler.d.ts +45 -0
  121. package/types/input/OCRRegion.d.ts +9 -0
  122. package/types/input/OCRSettings.d.ts +6 -0
  123. package/types/input/PropertyData.d.ts +23 -0
  124. package/types/input/ProxySettings.d.ts +25 -0
  125. package/types/input/RectangleSize.d.ts +23 -0
  126. package/types/input/Region.d.ts +46 -0
  127. package/types/input/RenderInfo.d.ts +47 -0
  128. package/types/input/RunnerOptions.d.ts +21 -0
  129. package/types/input/VisualLocatorSettings.d.ts +4 -0
  130. package/types/output/ApiUrls.d.ts +41 -0
  131. package/types/output/AppUrls.d.ts +23 -0
  132. package/types/output/MatchResult.d.ts +23 -0
  133. package/types/output/SessionUrls.d.ts +23 -0
  134. package/types/output/StepInfo.d.ts +50 -0
  135. package/types/output/TestAccessibilityStatus.d.ts +8 -0
  136. package/types/output/TestResultContainer.d.ts +31 -0
  137. package/types/output/TestResults.d.ts +186 -0
  138. package/types/output/TestResultsSummary.d.ts +18 -0
  139. package/types/output/TextRegion.d.ts +7 -0
  140. package/types/output/ValidationInfo.d.ts +21 -0
  141. package/types/output/ValidationResult.d.ts +18 -0
package/dist/Logger.js ADDED
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.Logger = void 0;
27
+ const utils = __importStar(require("@applitools/utils"));
28
+ const logger_1 = require("@applitools/logger");
29
+ const LogHandler_1 = require("./input/LogHandler");
30
+ class Logger {
31
+ _makeLogger() {
32
+ return (0, logger_1.makeLogger)({
33
+ handler: this._options.handler && this._options.handler instanceof LogHandler_1.LogHandlerData
34
+ ? this._options.handler.toJSON()
35
+ : this._options.handler,
36
+ level: this._options.show || utils.general.getEnvValue('SHOW_LOGS', 'boolean') ? 'info' : 'silent',
37
+ format: { label: this._options.label },
38
+ });
39
+ }
40
+ constructor(loggerOrOptionsOrShow = false) {
41
+ this._options = {};
42
+ /** @internal */
43
+ this.isLogger = true;
44
+ if (utils.types.isBoolean(loggerOrOptionsOrShow)) {
45
+ return new Logger({ show: loggerOrOptionsOrShow });
46
+ }
47
+ else if (utils.types.has(loggerOrOptionsOrShow, ['log', 'console'])) {
48
+ this._logger = loggerOrOptionsOrShow;
49
+ }
50
+ else {
51
+ this._options = loggerOrOptionsOrShow;
52
+ }
53
+ }
54
+ /** @internal */
55
+ getLogger() {
56
+ if (!this._logger)
57
+ this._logger = this._makeLogger();
58
+ return this._logger;
59
+ }
60
+ getLogHandler() {
61
+ if (this._options.handler) {
62
+ if (!utils.types.has(this._options.handler, 'type')) {
63
+ return this._options.handler;
64
+ }
65
+ else if (this._options.handler.type === 'file') {
66
+ return new LogHandler_1.FileLogHandlerData(true, this._options.handler.filename, this._options.handler.append);
67
+ }
68
+ else if (this._options.handler.type === 'console') {
69
+ return new LogHandler_1.ConsoleLogHandlerData(true);
70
+ }
71
+ }
72
+ return new LogHandler_1.NullLogHandlerData();
73
+ }
74
+ setLogHandler(handler) {
75
+ this._options.handler = handler;
76
+ this._options.show = true;
77
+ }
78
+ verbose(...messages) {
79
+ if (!this._logger)
80
+ this._logger = this._makeLogger();
81
+ messages.forEach(message => this._logger.log(message));
82
+ }
83
+ log(...messages) {
84
+ if (!this._logger)
85
+ this._logger = this._makeLogger();
86
+ messages.forEach(message => this._logger.log(message));
87
+ }
88
+ warn(...messages) {
89
+ if (!this._logger)
90
+ this._logger = this._makeLogger();
91
+ messages.forEach(message => this._logger.warn(message));
92
+ }
93
+ error(...messages) {
94
+ if (!this._logger)
95
+ this._logger = this._makeLogger();
96
+ messages.forEach(message => this._logger.error(message));
97
+ }
98
+ fatal(...messages) {
99
+ if (!this._logger)
100
+ this._logger = this._makeLogger();
101
+ messages.forEach(message => this._logger.fatal(message));
102
+ }
103
+ open() {
104
+ var _a;
105
+ (_a = this._logger) === null || _a === void 0 ? void 0 : _a.open();
106
+ }
107
+ close() {
108
+ var _a;
109
+ (_a = this._logger) === null || _a === void 0 ? void 0 : _a.close();
110
+ }
111
+ /** @internal */
112
+ extend(label) {
113
+ if (this._logger)
114
+ return new Logger(this._logger.extend({ label }));
115
+ return new Logger({
116
+ show: this._options.show,
117
+ label: label !== null && label !== void 0 ? label : this._options.label,
118
+ handler: this._options.handler,
119
+ });
120
+ }
121
+ }
122
+ exports.Logger = Logger;
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.ClassicRunner = exports.VisualGridRunner = exports.EyesRunner = void 0;
27
+ const NewTestError_1 = require("./errors/NewTestError");
28
+ const DiffsFoundError_1 = require("./errors/DiffsFoundError");
29
+ const TestFailedError_1 = require("./errors/TestFailedError");
30
+ const RunnerOptions_1 = require("./input/RunnerOptions");
31
+ const TestResults_1 = require("./output/TestResults");
32
+ const TestResultsSummary_1 = require("./output/TestResultsSummary");
33
+ const utils = __importStar(require("@applitools/utils"));
34
+ class EyesRunner {
35
+ constructor(options) {
36
+ var _a;
37
+ /** @internal */
38
+ this._managerSettings = {};
39
+ /** @internal */
40
+ this._getResultsSettings = {};
41
+ this._maskLog = (_a = options === null || options === void 0 ? void 0 : options.maskLog) !== null && _a !== void 0 ? _a : false;
42
+ if (options) {
43
+ this._managerSettings = {
44
+ concurrency: options.testConcurrency,
45
+ legacyConcurrency: options.legacyConcurrency,
46
+ fetchConcurrency: options.fetchConcurrency,
47
+ removeDuplicateTests: options.removeDuplicateTests,
48
+ };
49
+ this._getResultsSettings = { removeDuplicateTests: options.removeDuplicateTests };
50
+ }
51
+ }
52
+ /** @internal */
53
+ attach(core) {
54
+ var _a;
55
+ (_a = this._core) !== null && _a !== void 0 ? _a : (this._core = core);
56
+ }
57
+ /** @internal */
58
+ async openEyes(options) {
59
+ var _a;
60
+ (_a = this._manager) !== null && _a !== void 0 ? _a : (this._manager = await this._core.makeManager({
61
+ type: this.type,
62
+ settings: this._managerSettings,
63
+ logger: options.logger,
64
+ }));
65
+ return await this._manager.openEyes(options);
66
+ }
67
+ async getAllTestResults(throwErr = true) {
68
+ var _a;
69
+ if (!this._manager)
70
+ return new TestResultsSummary_1.TestResultsSummaryData();
71
+ try {
72
+ const summary = await this._manager.getResults({ settings: { throwErr, ...this._getResultsSettings } });
73
+ return new TestResultsSummary_1.TestResultsSummaryData({ summary, core: this._core });
74
+ }
75
+ catch (err) {
76
+ if ((_a = err.info) === null || _a === void 0 ? void 0 : _a.result) {
77
+ const result = new TestResults_1.TestResultsData({ result: err.info.result, core: this._core });
78
+ if (err.reason === 'test failed') {
79
+ throw new TestFailedError_1.TestFailedError(err.message, result);
80
+ }
81
+ else if (err.reason === 'test different') {
82
+ throw new DiffsFoundError_1.DiffsFoundError(err.message, result);
83
+ }
84
+ else if (err.reason === 'test new') {
85
+ throw new NewTestError_1.NewTestError(err.message, result);
86
+ }
87
+ }
88
+ throw err;
89
+ }
90
+ }
91
+ }
92
+ exports.EyesRunner = EyesRunner;
93
+ class VisualGridRunner extends EyesRunner {
94
+ constructor(optionsOrLegacyConcurrency) {
95
+ let options;
96
+ if (utils.types.instanceOf(optionsOrLegacyConcurrency, RunnerOptions_1.RunnerOptionsFluent)) {
97
+ options = optionsOrLegacyConcurrency.toJSON();
98
+ }
99
+ else if (utils.types.isNumber(optionsOrLegacyConcurrency)) {
100
+ options = { legacyConcurrency: optionsOrLegacyConcurrency };
101
+ }
102
+ else {
103
+ options = optionsOrLegacyConcurrency;
104
+ }
105
+ super(options);
106
+ this.type = 'ufg';
107
+ }
108
+ get testConcurrency() {
109
+ var _a;
110
+ return (_a = this._managerSettings) === null || _a === void 0 ? void 0 : _a.concurrency;
111
+ }
112
+ /** @deprecated */
113
+ get legacyConcurrency() {
114
+ var _a;
115
+ return (_a = this._managerSettings) === null || _a === void 0 ? void 0 : _a.legacyConcurrency;
116
+ }
117
+ /** @deprecated */
118
+ getConcurrentSessions() {
119
+ var _a;
120
+ return (_a = this._managerSettings) === null || _a === void 0 ? void 0 : _a.legacyConcurrency;
121
+ }
122
+ }
123
+ exports.VisualGridRunner = VisualGridRunner;
124
+ class ClassicRunner extends EyesRunner {
125
+ constructor() {
126
+ super(...arguments);
127
+ this.type = 'classic';
128
+ }
129
+ }
130
+ exports.ClassicRunner = ClassicRunner;
package/dist/SDK.js ADDED
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.getCoreWithCache = exports.initSDK = void 0;
27
+ const core_1 = require("@applitools/core");
28
+ const utils = __importStar(require("@applitools/utils"));
29
+ function initSDK(options, maskLog) {
30
+ if (options) {
31
+ options.maskLog = maskLog;
32
+ options.offlineLocationPath = utils.general.getEnvValue('OFFLINE_LOCATION_PATH');
33
+ }
34
+ return {
35
+ core: (0, exports.getCoreWithCache)(options),
36
+ spec: options === null || options === void 0 ? void 0 : options.spec,
37
+ };
38
+ }
39
+ exports.initSDK = initSDK;
40
+ exports.getCoreWithCache = utils.general.cachify(getCore);
41
+ function getCore({ makeCore = core_1.makeCore, ...options } = {}) {
42
+ var _a;
43
+ (_a = options.agentId) !== null && _a !== void 0 ? _a : (options.agentId = `js/eyes/${require('../package.json').version}`);
44
+ return makeCore(options);
45
+ }
@@ -0,0 +1,193 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.RemoteSessionEventHandler = exports.SessionEventHandlers = exports.SessionEventHandler = void 0;
27
+ const utils = __importStar(require("@applitools/utils"));
28
+ const RectangleSize_1 = require("./input/RectangleSize");
29
+ const TestResults_1 = require("./output/TestResults");
30
+ const ValidationInfo_1 = require("./output/ValidationInfo");
31
+ const ValidationResult_1 = require("./output/ValidationResult");
32
+ /** @deprecated */
33
+ class SessionEventHandler {
34
+ /** @internal */
35
+ attach(eyes) {
36
+ this._detach = eyes.on((name, data = {}) => {
37
+ if (!utils.types.isFunction(this, name))
38
+ return;
39
+ const args = [];
40
+ if (name === 'setSizeWillStart') {
41
+ args.push(new RectangleSize_1.RectangleSizeData(data.viewportSize));
42
+ }
43
+ else if (['testStarted', 'validationWillStart', 'validationEnded', 'testEnded'].includes(name)) {
44
+ args.push(data.sessionId);
45
+ if (name === 'validationWillStart') {
46
+ args.push(new ValidationInfo_1.ValidationInfoData(data.validationInfo));
47
+ }
48
+ else if (name === 'validationEnded') {
49
+ args.push(data.validationId, new ValidationResult_1.ValidationResultData(data.validationResult));
50
+ }
51
+ else if (name === 'testEnded') {
52
+ args.push(new TestResults_1.TestResultsData(data.testResults));
53
+ }
54
+ }
55
+ this[name](...args);
56
+ });
57
+ }
58
+ /** @internal */
59
+ detach() {
60
+ if (this._detach)
61
+ this._detach();
62
+ }
63
+ }
64
+ exports.SessionEventHandler = SessionEventHandler;
65
+ /** @deprecated */
66
+ class SessionEventHandlers extends SessionEventHandler {
67
+ constructor() {
68
+ super(...arguments);
69
+ this._handlers = new Set();
70
+ }
71
+ addEventHandler(handler) {
72
+ if (handler === this)
73
+ return;
74
+ this._handlers.add(handler);
75
+ }
76
+ removeEventHandler(handler) {
77
+ if (handler === this)
78
+ return;
79
+ this._handlers.delete(handler);
80
+ }
81
+ clearEventHandlers() {
82
+ this._handlers.clear();
83
+ }
84
+ initStarted() {
85
+ this._handlers.forEach(handler => handler.initStarted());
86
+ }
87
+ initEnded() {
88
+ this._handlers.forEach(handler => handler.initEnded());
89
+ }
90
+ setSizeWillStart(viewportSize) {
91
+ this._handlers.forEach(handler => handler.setSizeWillStart(viewportSize));
92
+ }
93
+ setSizeEnded() {
94
+ this._handlers.forEach(handler => handler.setSizeEnded());
95
+ }
96
+ testStarted(sessionId) {
97
+ this._handlers.forEach(handler => handler.testStarted(sessionId));
98
+ }
99
+ testEnded(sessionId, testResults) {
100
+ this._handlers.forEach(handler => handler.testEnded(sessionId, testResults));
101
+ }
102
+ validationWillStart(sessionId, validationInfo) {
103
+ this._handlers.forEach(handler => handler.validationWillStart(sessionId, validationInfo));
104
+ }
105
+ validationEnded(sessionId, validationId, validationResult) {
106
+ this._handlers.forEach(handler => handler.validationEnded(sessionId, validationId, validationResult));
107
+ }
108
+ }
109
+ exports.SessionEventHandlers = SessionEventHandlers;
110
+ /**
111
+ * @undocumented
112
+ * @deprecated
113
+ */
114
+ class RemoteSessionEventHandler extends SessionEventHandler {
115
+ constructor(optionsOrServerUrl, accessKey, timeout) {
116
+ super();
117
+ const options = utils.types.isObject(optionsOrServerUrl)
118
+ ? optionsOrServerUrl
119
+ : { serverUrl: optionsOrServerUrl, accessKey, timeout };
120
+ this._serverUrl = options.serverUrl;
121
+ this._accessKey = options.accessKey;
122
+ this._timeout = options.timeout;
123
+ }
124
+ get serverUrl() {
125
+ return this._serverUrl;
126
+ }
127
+ set serverUrl(serverUrl) {
128
+ this._serverUrl = serverUrl;
129
+ }
130
+ getServerUrl() {
131
+ return this._serverUrl;
132
+ }
133
+ setServerUrl(serverUrl) {
134
+ this.serverUrl = serverUrl;
135
+ }
136
+ get accessKey() {
137
+ return this._accessKey;
138
+ }
139
+ set accessKey(accessKey) {
140
+ this._accessKey = accessKey;
141
+ }
142
+ getAccessKey() {
143
+ return this.accessKey;
144
+ }
145
+ setAccessKey(accessKey) {
146
+ this._accessKey = accessKey;
147
+ }
148
+ get timeout() {
149
+ return this._timeout;
150
+ }
151
+ set timeout(timeout) {
152
+ this._timeout = timeout;
153
+ }
154
+ setTimeout(timeout) {
155
+ this._timeout = timeout;
156
+ }
157
+ getTimeout() {
158
+ return this._timeout;
159
+ }
160
+ initStarted() {
161
+ return undefined;
162
+ }
163
+ initEnded() {
164
+ return undefined;
165
+ }
166
+ setSizeWillStart() {
167
+ return undefined;
168
+ }
169
+ setSizeEnded() {
170
+ return undefined;
171
+ }
172
+ testStarted() {
173
+ return undefined;
174
+ }
175
+ testEnded() {
176
+ return undefined;
177
+ }
178
+ validationWillStart() {
179
+ return undefined;
180
+ }
181
+ validationEnded() {
182
+ return undefined;
183
+ }
184
+ /** @internal */
185
+ toJSON() {
186
+ return utils.general.toJSON(this, ['serverUrl', 'accessKey']);
187
+ }
188
+ /** @internal */
189
+ toString() {
190
+ return utils.general.toString(this);
191
+ }
192
+ }
193
+ exports.RemoteSessionEventHandler = RemoteSessionEventHandler;
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ /* eslint no-console: off */
8
+ const core_1 = require("@applitools/core");
9
+ const yargs_1 = __importDefault(require("yargs"));
10
+ const Configuration_1 = require("../input/Configuration");
11
+ const load_config_1 = require("./load-config");
12
+ void yargs_1.default
13
+ .example([['eyes run-offline-snapshots', 'Run Eyes visual tests on existing snapshots']])
14
+ .command({
15
+ command: 'run-offline-snapshots',
16
+ builder: yargs => {
17
+ return yargs
18
+ .options({
19
+ offlineLocationPath: {
20
+ description: 'path to offline snapshots folder',
21
+ type: 'string',
22
+ },
23
+ failOnDiff: {
24
+ description: 'should exit process with non-zero exit code on visual diffs, thereby failing the CI job',
25
+ type: 'boolean',
26
+ default: false,
27
+ },
28
+ failOnError: {
29
+ description: 'should exit process with non-zero exit code on errors, thereby failing the CI job',
30
+ type: 'boolean',
31
+ default: true,
32
+ },
33
+ configPath: {
34
+ description: 'path to configuration file (applitools.config.js / applitools.config.ts)',
35
+ type: 'string',
36
+ },
37
+ jsonFilePath: {
38
+ description: 'path to json file with the test results',
39
+ type: 'string',
40
+ },
41
+ })
42
+ .fail((_msg, err, _yargs) => {
43
+ if (err) {
44
+ console.error(err.message);
45
+ // console.log(err)
46
+ process.exit(1);
47
+ }
48
+ });
49
+ },
50
+ handler: async (args) => {
51
+ const config = await (0, load_config_1.loadConfig)(args.configPath);
52
+ const options = { ...args, config: new Configuration_1.ConfigurationData(config).toJSON() };
53
+ await (0, core_1.runOfflineSnapshots)(options);
54
+ },
55
+ })
56
+ .wrap(yargs_1.default.terminalWidth()).argv;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.loadConfig = void 0;
30
+ /* eslint no-console: off */
31
+ const utils = __importStar(require("@applitools/utils"));
32
+ const path_1 = __importDefault(require("path"));
33
+ const fs_1 = __importDefault(require("fs"));
34
+ const chalk_1 = __importDefault(require("chalk"));
35
+ async function loadConfig(configPath) {
36
+ const configPathArr = configPath ? [configPath] : [];
37
+ const paths = configPathArr.concat(['applitools.config.js']);
38
+ let config = {};
39
+ try {
40
+ config = utils.config.getConfig({
41
+ paths,
42
+ traverse: false,
43
+ strict: true,
44
+ });
45
+ // @ts-ignore
46
+ if (config.__esModule) {
47
+ // @ts-ignore
48
+ config = config.default;
49
+ }
50
+ }
51
+ catch (err) {
52
+ if (err.code === 'ERR_REQUIRE_ESM') {
53
+ const resolvedPaths = paths.map(probablePath => path_1.default.resolve(process.cwd(), probablePath));
54
+ const foundPath = resolvedPaths.find(resolvedPath => fs_1.default.existsSync(resolvedPath));
55
+ if (foundPath) {
56
+ try {
57
+ config = await import(foundPath);
58
+ }
59
+ catch (err) {
60
+ console.warn(chalk_1.default.yellow(err.message));
61
+ }
62
+ }
63
+ else {
64
+ console.warn(chalk_1.default.yellow('Could not find configuration file.'));
65
+ }
66
+ }
67
+ else if (configPath) {
68
+ console.warn(chalk_1.default.yellow(`${err.message}. configPath: ${path_1.default.resolve(process.cwd(), configPath)}`));
69
+ }
70
+ }
71
+ return config;
72
+ }
73
+ exports.loadConfig = loadConfig;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /* GENERATED FILE */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.AccessibilityGuidelinesVersionEnum = void 0;
5
+ var AccessibilityGuidelinesVersionEnum;
6
+ (function (AccessibilityGuidelinesVersionEnum) {
7
+ AccessibilityGuidelinesVersionEnum["WCAG_2_0"] = "WCAG_2_0";
8
+ AccessibilityGuidelinesVersionEnum["WCAG_2_1"] = "WCAG_2_1";
9
+ })(AccessibilityGuidelinesVersionEnum || (exports.AccessibilityGuidelinesVersionEnum = AccessibilityGuidelinesVersionEnum = {}));
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /* GENERATED FILE */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.AccessibilityLevelEnum = void 0;
5
+ var AccessibilityLevelEnum;
6
+ (function (AccessibilityLevelEnum) {
7
+ AccessibilityLevelEnum["AA"] = "AA";
8
+ AccessibilityLevelEnum["AAA"] = "AAA";
9
+ })(AccessibilityLevelEnum || (exports.AccessibilityLevelEnum = AccessibilityLevelEnum = {}));
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ /* GENERATED FILE */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.AccessibilityRegionTypeEnum = void 0;
5
+ var AccessibilityRegionTypeEnum;
6
+ (function (AccessibilityRegionTypeEnum) {
7
+ AccessibilityRegionTypeEnum["IgnoreContrast"] = "IgnoreContrast";
8
+ AccessibilityRegionTypeEnum["RegularText"] = "RegularText";
9
+ AccessibilityRegionTypeEnum["LargeText"] = "LargeText";
10
+ AccessibilityRegionTypeEnum["BoldText"] = "BoldText";
11
+ AccessibilityRegionTypeEnum["GraphicalObject"] = "GraphicalObject";
12
+ })(AccessibilityRegionTypeEnum || (exports.AccessibilityRegionTypeEnum = AccessibilityRegionTypeEnum = {}));
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /* GENERATED FILE */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.AccessibilityStatusEnum = void 0;
5
+ var AccessibilityStatusEnum;
6
+ (function (AccessibilityStatusEnum) {
7
+ AccessibilityStatusEnum["Passed"] = "Passed";
8
+ AccessibilityStatusEnum["Failed"] = "Failed";
9
+ })(AccessibilityStatusEnum || (exports.AccessibilityStatusEnum = AccessibilityStatusEnum = {}));