@testim/testim-cli 3.264.0 → 3.266.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testim/testim-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.266.0",
|
|
4
4
|
"description": "Command line interface for running Testing on your CI",
|
|
5
5
|
"author": "Oren Rubin",
|
|
6
6
|
"contributors": [{
|
|
@@ -43,8 +43,7 @@
|
|
|
43
43
|
"multer": "1.4.4"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@applitools/eyes-sdk-core": "13.
|
|
47
|
-
"@applitools/visual-grid-client": "15.12.34",
|
|
46
|
+
"@applitools/eyes-sdk-core": "13.11.21",
|
|
48
47
|
"@testim/coralogix-logger": "1.1.27-beta.1",
|
|
49
48
|
"@testim/webdriverio": "0.0.5",
|
|
50
49
|
"abort-controller": "3.0.0",
|
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
const _ = require('lodash');
|
|
4
4
|
const StepAction = require('./stepAction');
|
|
5
5
|
const { eyeSdkService } = require('../utils/eyeSdkService');
|
|
6
|
-
const
|
|
6
|
+
const { getLogger } = require('../../commons/logger');
|
|
7
|
+
|
|
8
|
+
const logger = getLogger('pixel-validation-step-action');
|
|
7
9
|
|
|
8
10
|
class PixelValidationStepAction extends StepAction {
|
|
9
11
|
async performAction() {
|
|
10
|
-
const { shouldUseVisualGrid, applitoolsSdkConfig: config, testResultId } = this.context;
|
|
12
|
+
const { shouldUseVisualGrid, applitoolsSdkConfig: config, applitoolsSdkLogger, testResultId } = this.context;
|
|
11
13
|
this.runContext = this.context.getRunContext(undefined);
|
|
12
14
|
const finalParams = this.runContext.incomingParams?.final || {};
|
|
13
15
|
const batchId = config.batch?.id || testResultId;
|
|
@@ -15,10 +17,10 @@ class PixelValidationStepAction extends StepAction {
|
|
|
15
17
|
const targetElementData = this.getTarget() || {};
|
|
16
18
|
let result;
|
|
17
19
|
try {
|
|
18
|
-
const openedEye = await eyeManager.openEyes({ driver: this.driver.client, config });
|
|
20
|
+
const openedEye = await eyeManager.openEyes({ driver: this.driver.client, config, logger: applitoolsSdkLogger });
|
|
19
21
|
const region = (this.step.action === 'element' && targetElementData.seleniumElement) || undefined;
|
|
20
22
|
const settings = { region, fully: this.step.action === 'stitched' };
|
|
21
|
-
if (
|
|
23
|
+
if (_.isPlainObject(finalParams.applitoolsStepSettings)) {
|
|
22
24
|
Object.assign(settings, finalParams.applitoolsStepSettings);
|
|
23
25
|
logger.info('Applitools SDK step executed with applitoolsStepSettings parameter', { applitoolsStepSettings: finalParams.applitoolsStepSettings });
|
|
24
26
|
}
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* @typedef {import('@applitools/types').Core} Core
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const _ = require('lodash');
|
|
8
8
|
const { makeSDK } = require('@applitools/eyes-sdk-core');
|
|
9
9
|
const { W3C_ELEMENT_ID } = require('../constants');
|
|
10
|
-
const
|
|
10
|
+
const { EyeSdkBuilder } = require('../../commons/getSessionPlayerRequire');
|
|
11
11
|
|
|
12
12
|
let packageJson;
|
|
13
13
|
// There is a difference in the folder structure in prod vs. dev
|
|
@@ -41,13 +41,6 @@ function extractElementId(element) {
|
|
|
41
41
|
}
|
|
42
42
|
return undefined;
|
|
43
43
|
}
|
|
44
|
-
/** implements the ?? capability for backward compatibility */
|
|
45
|
-
function getValueOrFallbackIfNullOrUndefined(value, fallback) {
|
|
46
|
-
if (value === null || value === undefined) {
|
|
47
|
-
return fallback;
|
|
48
|
-
}
|
|
49
|
-
return value;
|
|
50
|
-
}
|
|
51
44
|
|
|
52
45
|
/**
|
|
53
46
|
* Applitools Spec Driver for webdriverIO 4.
|
|
@@ -57,7 +50,7 @@ function getValueOrFallbackIfNullOrUndefined(value, fallback) {
|
|
|
57
50
|
class EyesSpec {
|
|
58
51
|
// #region UTILITY
|
|
59
52
|
isDriver(driver) {
|
|
60
|
-
return Boolean(driver
|
|
53
|
+
return Boolean(driver?.getPrototype && driver.desiredCapabilities && driver.requestHandler);
|
|
61
54
|
}
|
|
62
55
|
|
|
63
56
|
isElement(element) {
|
|
@@ -69,7 +62,7 @@ class EyesSpec {
|
|
|
69
62
|
}
|
|
70
63
|
|
|
71
64
|
isSelector(selector) {
|
|
72
|
-
return
|
|
65
|
+
return typeof selector === 'string';
|
|
73
66
|
}
|
|
74
67
|
|
|
75
68
|
transformDriver(driver) {
|
|
@@ -176,8 +169,8 @@ class EyesSpec {
|
|
|
176
169
|
deviceName: desiredCapabilities.deviceName,
|
|
177
170
|
platformName: desiredCapabilities.platformName || desiredCapabilities.platform,
|
|
178
171
|
platformVersion: desiredCapabilities.platformVersion,
|
|
179
|
-
browserName:
|
|
180
|
-
browserVersion:
|
|
172
|
+
browserName: desiredCapabilities.browserName ?? desiredCapabilities.name,
|
|
173
|
+
browserVersion: desiredCapabilities.browserVersion ?? desiredCapabilities.version,
|
|
181
174
|
pixelRatio: desiredCapabilities.pixelRatio,
|
|
182
175
|
};
|
|
183
176
|
}
|
|
@@ -209,7 +202,7 @@ class EyesSpec {
|
|
|
209
202
|
if (this.isSelector(element)) {
|
|
210
203
|
element = await this.findElement(driver, element);
|
|
211
204
|
}
|
|
212
|
-
await driver.moveTo(extractElementId(element), offset
|
|
205
|
+
await driver.moveTo(extractElementId(element), offset?.x, offset?.y);
|
|
213
206
|
}
|
|
214
207
|
|
|
215
208
|
async type(driver, element, keys) {
|
|
@@ -242,7 +235,6 @@ class EyeSdkService {
|
|
|
242
235
|
name: 'Testim.io',
|
|
243
236
|
version: `4.0.0/eyes-sdk-core/${sdkVersion}`,
|
|
244
237
|
spec: new EyesSpec(),
|
|
245
|
-
VisualGridClient: require('@applitools/visual-grid-client'),
|
|
246
238
|
});
|
|
247
239
|
/** @type {EyeSdkBuilder['handleApplitoolsSdkResult']} */
|
|
248
240
|
this.handleApplitoolsSdkResult = EyeSdkBuilder.handleApplitoolsSdkResult;
|
|
@@ -106,7 +106,7 @@ class TestPlanRunner {
|
|
|
106
106
|
/** @type {Awaited<ReturnType<typeof testimServicesApi['getApplitoolsIntegrationData']>>} */
|
|
107
107
|
let applitoolsIntegrationData;
|
|
108
108
|
try {
|
|
109
|
-
if (!tpOptions.company
|
|
109
|
+
if (!tpOptions.company?.activePlan?.premiumFeatures?.applitools) {
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
112
|
applitoolsIntegrationData = await testimServicesApi.getApplitoolsIntegrationData(tpOptions.project);
|
|
@@ -115,7 +115,7 @@ class TestPlanRunner {
|
|
|
115
115
|
}
|
|
116
116
|
const { runKey: apiKey, url: serverUrl } = applitoolsIntegrationData;
|
|
117
117
|
const tmpSDK = require('@applitools/eyes-sdk-core').makeSDK({ name: 'Testim.io', version: '4.0.0', spec: {} });
|
|
118
|
-
await tmpSDK.
|
|
118
|
+
await tmpSDK.closeBatch({ settings: { batchId: executionId, serverUrl, apiKey } });
|
|
119
119
|
} catch (err) {
|
|
120
120
|
// If a batch with this name did not exist, do not log an error.
|
|
121
121
|
if (err.message && (err.message.startsWith('Request failed with status code 404') || err.message.startsWith('no batchIds were set'))) {
|
package/utils/promiseUtils.js
CHANGED
|
@@ -39,9 +39,10 @@ function delay(time) {
|
|
|
39
39
|
* @param {string=} errMsg
|
|
40
40
|
*/
|
|
41
41
|
function promiseTimeout(promise, timeout, errMsg = 'Timeout Error') {
|
|
42
|
+
const timeoutErr = new TimeoutError(errMsg);
|
|
42
43
|
return Promise.race([
|
|
43
44
|
promise,
|
|
44
|
-
delay(timeout).then(() => { throw
|
|
45
|
+
delay(timeout).then(() => { throw timeoutErr; }),
|
|
45
46
|
]);
|
|
46
47
|
}
|
|
47
48
|
|