slnodejs 6.2.19 → 6.2.22
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/browser-agent/dist/browser-agent-all.js +63 -8
- package/browser-agent/dist/browser-agent-all.min.js +3 -3
- package/lib/preload.js +6 -0
- package/package.json +2 -2
- package/tsOutputs/common/contracts.d.ts +2 -1
- package/tsOutputs/common/state-tracker.d.ts +23 -0
- package/tsOutputs/common/state-tracker.js +52 -1
- package/tsOutputs/common/state-tracker.js.map +1 -1
- package/tsOutputs/messages/message-keys.generated.js +1 -1
|
@@ -592,6 +592,10 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
592
592
|
this.logger.info("Agent is setting current test identifier. testIdentifier:'" + testIdentifier + "'.");
|
|
593
593
|
this.stateTracker.setCurrentTestIdentifier(testIdentifier);
|
|
594
594
|
}
|
|
595
|
+
setExternalExecutionContext(executionId, testStage) {
|
|
596
|
+
this.logger.info(`Agent is setting external execution context. executionId:'${executionId}'` + `${(testStage === null || testStage === void 0 ? void 0 : testStage.length) ? `, testStage:'${testStage}'` : ''}.`);
|
|
597
|
+
this.stateTracker.setExternalExecutionContext(executionId, testStage);
|
|
598
|
+
}
|
|
595
599
|
stop() {
|
|
596
600
|
return __awaiter(this, void 0, void 0, function* () {
|
|
597
601
|
if (!this._isStarted) return;
|
|
@@ -750,6 +754,9 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
750
754
|
setCurrentTestIdentifier(identifier) {
|
|
751
755
|
this.instances.forEach(instance => instance.setCurrentTestIdentifier(identifier));
|
|
752
756
|
}
|
|
757
|
+
setExternalExecutionContext(executionId, testStage) {
|
|
758
|
+
this.instances.forEach(instance => instance.setExternalExecutionContext(executionId, testStage));
|
|
759
|
+
}
|
|
753
760
|
sendAllFootprints() {
|
|
754
761
|
return __awaiter(this, void 0, void 0, function* () {
|
|
755
762
|
context_message_manager_1.ContextMessageManager.getInstance().sendAllEvents();
|
|
@@ -1027,10 +1034,14 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
1027
1034
|
this.windowObj = window;
|
|
1028
1035
|
this.testName = null;
|
|
1029
1036
|
this.executionId = null;
|
|
1037
|
+
this.testStage = null;
|
|
1030
1038
|
}
|
|
1031
1039
|
setTestName(testName) {
|
|
1032
1040
|
this.testName = testName;
|
|
1033
1041
|
}
|
|
1042
|
+
setTestStage(testStage) {
|
|
1043
|
+
this.testStage = (testStage === null || testStage === void 0 ? void 0 : testStage.length) ? testStage : null;
|
|
1044
|
+
}
|
|
1034
1045
|
setExecutionId(executionId) {
|
|
1035
1046
|
if (!(executionId === null || executionId === void 0 ? void 0 : executionId.length)) {
|
|
1036
1047
|
return this.executionId = null;
|
|
@@ -1041,11 +1052,13 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
1041
1052
|
}
|
|
1042
1053
|
this.executionId = executionId;
|
|
1043
1054
|
}
|
|
1044
|
-
setCurrentTestIdentifier(testName, executionId) {
|
|
1045
|
-
var _a;
|
|
1055
|
+
setCurrentTestIdentifier(testName, executionId, testStage) {
|
|
1056
|
+
var _a, _b, _c;
|
|
1046
1057
|
this.setExecutionId(executionId);
|
|
1047
1058
|
this.setTestName(testName);
|
|
1059
|
+
this.setTestStage(testStage);
|
|
1048
1060
|
(_a = this.windowObj.$SealightsAgent) === null || _a === void 0 ? void 0 : _a.setCurrentTestIdentifier(this.getCurrentTestIdentifier());
|
|
1061
|
+
(_c = (_b = this.windowObj.$SealightsAgent) === null || _b === void 0 ? void 0 : _b.setExternalExecutionContext) === null || _c === void 0 ? void 0 : _c.call(_b, this.executionId, this.testStage);
|
|
1049
1062
|
}
|
|
1050
1063
|
getCurrentTestIdentifier() {
|
|
1051
1064
|
var _a, _b;
|
|
@@ -1058,6 +1071,9 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
1058
1071
|
getExecutionId() {
|
|
1059
1072
|
return this.executionId;
|
|
1060
1073
|
}
|
|
1074
|
+
getTestStage() {
|
|
1075
|
+
return this.testStage;
|
|
1076
|
+
}
|
|
1061
1077
|
}
|
|
1062
1078
|
exports.ColorContextManager = ColorContextManager;
|
|
1063
1079
|
});
|
|
@@ -1077,7 +1093,7 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
1077
1093
|
value: true
|
|
1078
1094
|
});
|
|
1079
1095
|
exports.SL_AGENT_TYPE = exports.SL_AGENT_VERSION = void 0;
|
|
1080
|
-
exports.SL_AGENT_VERSION = '6.2.
|
|
1096
|
+
exports.SL_AGENT_VERSION = '6.2.22';
|
|
1081
1097
|
exports.SL_AGENT_TYPE = 'browser';
|
|
1082
1098
|
});
|
|
1083
1099
|
|
|
@@ -1384,11 +1400,12 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
1384
1400
|
Object.defineProperty(exports, "__esModule", {
|
|
1385
1401
|
value: true
|
|
1386
1402
|
});
|
|
1387
|
-
exports.relativePathRegex = exports.EVENTS = exports.EVENT_TYPES = exports.SL_CONTEXT_DIAGNOSIS = exports.SL_SESSION_CONTEXT = exports.CONTEXT = exports.SL_EVENTS_BRIDGE = exports.SL_EXECUTION_ID = exports.SL_TEST_NAME = exports.SL_SESSION_ID = exports.SL_CONTEXT_KEY = exports.SL_BAGGAGE_HEADER = void 0;
|
|
1403
|
+
exports.relativePathRegex = exports.EVENTS = exports.EVENT_TYPES = exports.SL_CONTEXT_DIAGNOSIS = exports.SL_SESSION_CONTEXT = exports.CONTEXT = exports.SL_EVENTS_BRIDGE = exports.SL_EXECUTION_ID = exports.SL_TEST_STAGE = exports.SL_TEST_NAME = exports.SL_SESSION_ID = exports.SL_CONTEXT_KEY = exports.SL_BAGGAGE_HEADER = void 0;
|
|
1388
1404
|
exports.SL_BAGGAGE_HEADER = 'baggage';
|
|
1389
1405
|
exports.SL_CONTEXT_KEY = 'sl-context';
|
|
1390
1406
|
exports.SL_SESSION_ID = 'x-sl-test-session-id';
|
|
1391
1407
|
exports.SL_TEST_NAME = 'x-sl-test-name';
|
|
1408
|
+
exports.SL_TEST_STAGE = 'x-sl-test-stage';
|
|
1392
1409
|
exports.SL_EXECUTION_ID = 'x-sl-execution-id';
|
|
1393
1410
|
exports.SL_EVENTS_BRIDGE = 'sl-events-bridge';
|
|
1394
1411
|
exports.CONTEXT = 'context';
|
|
@@ -1684,15 +1701,18 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
1684
1701
|
function checkExistingCookies(logger) {
|
|
1685
1702
|
const testNameCookieValue = (0, cookie_utils_1.getCookie)(SlConst.SL_TEST_NAME);
|
|
1686
1703
|
const executionIdCookieValue = (0, cookie_utils_1.getCookie)(SlConst.SL_EXECUTION_ID);
|
|
1704
|
+
const testStageCookieValue = (0, cookie_utils_1.getCookie)(SlConst.SL_TEST_STAGE);
|
|
1687
1705
|
if (!(testNameCookieValue === null || testNameCookieValue === void 0 ? void 0 : testNameCookieValue.length) || !(executionIdCookieValue === null || executionIdCookieValue === void 0 ? void 0 : executionIdCookieValue.length)) {
|
|
1688
1706
|
return false;
|
|
1689
1707
|
}
|
|
1690
1708
|
logger.info(`Found existing test name and executionId cookies. Dispatching event with data: ${testNameCookieValue}/${executionIdCookieValue}`);
|
|
1691
1709
|
dispatchEvent(new CustomEvent(SlConst.EVENTS.SET_BAGGAGE, {
|
|
1692
|
-
detail: {
|
|
1710
|
+
detail: Object.assign({
|
|
1693
1711
|
[SlConst.SL_SESSION_ID]: executionIdCookieValue,
|
|
1694
1712
|
[SlConst.SL_TEST_NAME]: testNameCookieValue
|
|
1695
|
-
}
|
|
1713
|
+
}, (testStageCookieValue === null || testStageCookieValue === void 0 ? void 0 : testStageCookieValue.length) ? {
|
|
1714
|
+
[SlConst.SL_TEST_STAGE]: testStageCookieValue
|
|
1715
|
+
} : {})
|
|
1696
1716
|
}));
|
|
1697
1717
|
return true;
|
|
1698
1718
|
}
|
|
@@ -1708,6 +1728,7 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
1708
1728
|
}
|
|
1709
1729
|
const executionId = detail[SlConst.SL_SESSION_ID];
|
|
1710
1730
|
const testName = detail[SlConst.SL_TEST_NAME];
|
|
1731
|
+
const testStage = detail[SlConst.SL_TEST_STAGE];
|
|
1711
1732
|
if (!(executionId === null || executionId === void 0 ? void 0 : executionId.length) || !(testName === null || testName === void 0 ? void 0 : testName.length)) {
|
|
1712
1733
|
logger.warn(`Received setBaggage event with with missing testName/executionId: testName=${testName} executionId=${executionId}`);
|
|
1713
1734
|
return;
|
|
@@ -1721,9 +1742,12 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
1721
1742
|
[SlConst.SL_TEST_NAME]: encodeURIComponent(testName)
|
|
1722
1743
|
});
|
|
1723
1744
|
}
|
|
1724
|
-
colorContextManager.setCurrentTestIdentifier(testName, executionId);
|
|
1745
|
+
colorContextManager.setCurrentTestIdentifier(testName, executionId, testStage);
|
|
1725
1746
|
(0, cookie_utils_1.setCookie)(SlConst.SL_EXECUTION_ID, executionId);
|
|
1726
1747
|
(0, cookie_utils_1.setCookie)(SlConst.SL_TEST_NAME, testName);
|
|
1748
|
+
if (testStage === null || testStage === void 0 ? void 0 : testStage.length) {
|
|
1749
|
+
(0, cookie_utils_1.setCookie)(SlConst.SL_TEST_STAGE, testStage);
|
|
1750
|
+
}
|
|
1727
1751
|
(0, utils_1.sendAckEvent)(detail);
|
|
1728
1752
|
}
|
|
1729
1753
|
exports.setBaggageHandler = setBaggageHandler;
|
|
@@ -1762,6 +1786,7 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
1762
1786
|
contextMessageManager.incrementContextEventValue(context_message_manager_1.CONTEXT_EVENTS_KEYS.DELETE_EVENTS_RECEIVED, 1);
|
|
1763
1787
|
(0, cookie_utils_1.deleteCookie)(SlConst.SL_TEST_NAME);
|
|
1764
1788
|
(0, cookie_utils_1.deleteCookie)(SlConst.SL_EXECUTION_ID);
|
|
1789
|
+
(0, cookie_utils_1.deleteCookie)(SlConst.SL_TEST_STAGE);
|
|
1765
1790
|
}
|
|
1766
1791
|
exports.deleteContextHandler = deleteContextHandler;
|
|
1767
1792
|
function deleteBaggageHandler(contextMessageManager, colorContextManager) {
|
|
@@ -1770,6 +1795,7 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
1770
1795
|
contextMessageManager.incrementContextEventValue(context_message_manager_1.CONTEXT_EVENTS_KEYS.DELETE_EVENTS_RECEIVED, 1);
|
|
1771
1796
|
(0, cookie_utils_1.deleteCookie)(SlConst.SL_TEST_NAME);
|
|
1772
1797
|
(0, cookie_utils_1.deleteCookie)(SlConst.SL_EXECUTION_ID);
|
|
1798
|
+
(0, cookie_utils_1.deleteCookie)(SlConst.SL_TEST_STAGE);
|
|
1773
1799
|
}
|
|
1774
1800
|
exports.deleteBaggageHandler = deleteBaggageHandler;
|
|
1775
1801
|
});
|
|
@@ -9664,6 +9690,7 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
9664
9690
|
this.isRunning = false;
|
|
9665
9691
|
this._openExecutionFoundOnce = false;
|
|
9666
9692
|
this.executionPollingDisabled = false;
|
|
9693
|
+
this.externalExecutionContext = null;
|
|
9667
9694
|
validation_utils_1.ValidationUtils.verifyNotNullOrEmpty(cfg, 'agentConfig');
|
|
9668
9695
|
validation_utils_1.ValidationUtils.verifyNotNullOrEmpty(configProcess, 'configProcess');
|
|
9669
9696
|
validation_utils_1.ValidationUtils.verifyNotNullOrEmpty(checkTestStatusWatchdog, 'watchdog');
|
|
@@ -9728,6 +9755,31 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
9728
9755
|
}
|
|
9729
9756
|
});
|
|
9730
9757
|
}
|
|
9758
|
+
setExternalExecutionContext(executionId, testStage) {
|
|
9759
|
+
if (!(executionId === null || executionId === void 0 ? void 0 : executionId.length)) {
|
|
9760
|
+
if (this.externalExecutionContext) {
|
|
9761
|
+
this.logger.debug('Clearing external execution context; poll resumes managing currentExecution.');
|
|
9762
|
+
}
|
|
9763
|
+
this.externalExecutionContext = null;
|
|
9764
|
+
return;
|
|
9765
|
+
}
|
|
9766
|
+
this.externalExecutionContext = {
|
|
9767
|
+
executionId,
|
|
9768
|
+
testStage: (testStage === null || testStage === void 0 ? void 0 : testStage.length) ? testStage : null
|
|
9769
|
+
};
|
|
9770
|
+
this.setExecution(this.applyExternalExecutionContext(this._currentExecution));
|
|
9771
|
+
}
|
|
9772
|
+
applyExternalExecutionContext(execution) {
|
|
9773
|
+
var _a;
|
|
9774
|
+
if (!this.externalExecutionContext) {
|
|
9775
|
+
return execution;
|
|
9776
|
+
}
|
|
9777
|
+
return Object.assign(Object.assign({}, execution), {
|
|
9778
|
+
executionId: this.externalExecutionContext.executionId,
|
|
9779
|
+
testStage: (_a = this.externalExecutionContext.testStage) !== null && _a !== void 0 ? _a : execution === null || execution === void 0 ? void 0 : execution.testStage,
|
|
9780
|
+
buildSessionId: this.cfg.buildSessionId.value
|
|
9781
|
+
});
|
|
9782
|
+
}
|
|
9731
9783
|
setExecution(execution) {
|
|
9732
9784
|
try {
|
|
9733
9785
|
this.fireExecutionEvents(execution);
|
|
@@ -9771,7 +9823,10 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
9771
9823
|
};
|
|
9772
9824
|
}
|
|
9773
9825
|
get currentExecution() {
|
|
9774
|
-
|
|
9826
|
+
if (!this.externalExecutionContext) {
|
|
9827
|
+
return this._currentExecution;
|
|
9828
|
+
}
|
|
9829
|
+
return this.applyExternalExecutionContext(this._currentExecution);
|
|
9775
9830
|
}
|
|
9776
9831
|
set currentExecution(value) {
|
|
9777
9832
|
this._currentExecution = value;
|