@testim/testim-cli 3.202.0 → 3.203.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/commons/featureFlags.js
CHANGED
|
@@ -54,6 +54,7 @@ class FeatureFlagsService {
|
|
|
54
54
|
useSameBrowserForMultiTests: new LabFeatureFlag('labs'),
|
|
55
55
|
highSpeedMode: new LabFeatureFlag(),
|
|
56
56
|
usePortedHtml5DragDrop: new Rox.Flag(),
|
|
57
|
+
applitoolsNewIntegration: new Rox.Flag(),
|
|
57
58
|
};
|
|
58
59
|
Rox.register('default', this.flags);
|
|
59
60
|
}
|
|
@@ -428,6 +428,19 @@ function addTestRetry({
|
|
|
428
428
|
}), DEFAULT_REQUEST_RETRY);
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
+
/**
|
|
432
|
+
* @param {string} projectId
|
|
433
|
+
* @returns {Promise<import('../../../clickim/src/common/api/testimApplitoolsApi').ApplitoolsIntegrationData>}
|
|
434
|
+
*/
|
|
435
|
+
function getApplitoolsIntegrationData(projectId) {
|
|
436
|
+
try {
|
|
437
|
+
return getWithAuth(`/integration/applitools/v3/connected?projectId=${projectId}`);
|
|
438
|
+
} catch (err) {
|
|
439
|
+
logger.warn('could\'nt get applitools integration data.', { err });
|
|
440
|
+
return {};
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
431
444
|
module.exports = {
|
|
432
445
|
getS3Artifact,
|
|
433
446
|
getTestPlan,
|
|
@@ -459,4 +472,5 @@ module.exports = {
|
|
|
459
472
|
getHybridGridProvider,
|
|
460
473
|
loadTest,
|
|
461
474
|
isTestResultCompleted,
|
|
475
|
+
getApplitoolsIntegrationData,
|
|
462
476
|
};
|
package/package.json
CHANGED
|
@@ -9,7 +9,8 @@ class PixelValidationStepAction extends StepAction {
|
|
|
9
9
|
async performAction() {
|
|
10
10
|
const { shouldUseVisualGrid, applitoolsSdkConfig: config, testResultId } = this.context;
|
|
11
11
|
this.runContext = this.context.getRunContext(undefined);
|
|
12
|
-
const
|
|
12
|
+
const batchId = (config.batch && config.batch.id) || testResultId;
|
|
13
|
+
const eyeManager = await eyeSdkService.getManager(shouldUseVisualGrid, this.context.config.applitoolsConcurrency || 5, batchId, this.runContext.applitoolsIntegrationData);
|
|
13
14
|
const targetElementData = this.getTarget() || {};
|
|
14
15
|
try {
|
|
15
16
|
const openedEye = await eyeManager.openEyes({ driver: this.driver.client, config });
|
|
@@ -226,9 +226,9 @@ class EyeSdkService {
|
|
|
226
226
|
VisualGridClient: require('@applitools/visual-grid-client'),
|
|
227
227
|
});
|
|
228
228
|
}
|
|
229
|
-
async getManager(useVisualGrid, concurrency, batchId) {
|
|
229
|
+
async getManager(useVisualGrid, concurrency, batchId, applitoolsIntegrationData) {
|
|
230
230
|
const manager = await this.sdk.makeManager({ type: useVisualGrid ? 'vg' : 'classic', concurrency });
|
|
231
|
-
sessionPlayer.EyeSdkBuilder.rememberCreatedBatch(batchId);
|
|
231
|
+
sessionPlayer.EyeSdkBuilder.rememberCreatedBatch(batchId, applitoolsIntegrationData);
|
|
232
232
|
return manager;
|
|
233
233
|
}
|
|
234
234
|
}
|
|
@@ -19,6 +19,7 @@ const { getSuite, calcTestResultStatus, validateConfig } = require('./runnerUtil
|
|
|
19
19
|
const { StopRunOnError, ArgError } = require('../errors');
|
|
20
20
|
const Logger = require('../commons/logger');
|
|
21
21
|
const perf = require('../commons/performance-logger');
|
|
22
|
+
const featureFlags = require('../commons/featureFlags');
|
|
22
23
|
|
|
23
24
|
const guid = utils.guid;
|
|
24
25
|
const logger = Logger.getLogger('test-plan-runner');
|
|
@@ -75,6 +76,41 @@ class TestPlanRunner {
|
|
|
75
76
|
return catchBeforeTestsFailed(executionId);
|
|
76
77
|
}
|
|
77
78
|
throw err;
|
|
79
|
+
})
|
|
80
|
+
.finally(async () => {
|
|
81
|
+
if ((tpOptions.lightweightMode && tpOptions.lightweightMode.disablePixelValidation) || !featureFlags.flags.applitoolsNewIntegration.isEnabled()) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
// When sessionPlayer is available, use it - as it only attempts to close batches that exist.
|
|
85
|
+
if (tpOptions.mode === constants.CLI_MODE.SELENIUM) {
|
|
86
|
+
/**
|
|
87
|
+
* @type {{ EyeSdkBuilder: typeof import('../../../clickim/src/background/eyeSdkBuilder').EyeSdkBuilder }}
|
|
88
|
+
*/
|
|
89
|
+
const sessionPlayerInit = require('../commons/getSessionPlayerRequire');
|
|
90
|
+
// TODO: remove once session player released.
|
|
91
|
+
if (typeof sessionPlayerInit.EyeSdkBuilder.closeBatch !== 'function') {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
await sessionPlayerInit.EyeSdkBuilder.closeBatch(executionId);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
try {
|
|
98
|
+
if (!tpOptions.company || !tpOptions.company.activePlan || !tpOptions.company.activePlan.premiumFeatures || !tpOptions.company.activePlan.premiumFeatures.applitools) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const applitoolsIntegrationData = await testimServicesApi.getApplitoolsIntegrationData(tpOptions.project);
|
|
102
|
+
if (_.isEmpty(applitoolsIntegrationData)) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const { runKey: apiKey, url: serverUrl } = applitoolsIntegrationData;
|
|
106
|
+
const tmpSDK = require('@applitools/eyes-sdk-core').makeSDK({ name: 'Testim.io', version: '4.0.0', spec: {} });
|
|
107
|
+
await tmpSDK.closeBatches({ batchIds: [executionId], serverUrl, apiKey });
|
|
108
|
+
} catch (err) {
|
|
109
|
+
if (err.message && err.message.startsWith('Request failed with status code 404')) { // If a batch with this name did not exist, do not log an error.
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
logger.error('Failed closing batch in extension mode', { err, projectId: tpOptions.project });
|
|
113
|
+
}
|
|
78
114
|
});
|
|
79
115
|
}
|
|
80
116
|
|