@testomatio/reporter 2.0.1-beta.3 → 2.0.1-beta.5-timestamp
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/lib/adapter/codecept.js +335 -293
- package/lib/adapter/cucumber/current.js +203 -195
- package/lib/adapter/cucumber/legacy.js +155 -130
- package/lib/adapter/cucumber.js +16 -5
- package/lib/adapter/cypress-plugin/index.js +105 -91
- package/lib/adapter/jasmine.js +53 -54
- package/lib/adapter/jest.js +99 -97
- package/lib/adapter/mocha.js +141 -112
- package/lib/adapter/playwright.js +231 -199
- package/lib/adapter/vitest.js +149 -150
- package/lib/adapter/webdriver.js +121 -144
- package/lib/bin/cli.js +211 -229
- package/lib/bin/reportXml.js +52 -51
- package/lib/bin/startTest.js +95 -83
- package/lib/bin/uploadArtifacts.js +61 -56
- package/lib/client.js +465 -424
- package/lib/config.js +23 -18
- package/lib/constants.js +44 -50
- package/lib/data-storage.js +188 -216
- package/lib/junit-adapter/adapter.js +20 -17
- package/lib/junit-adapter/csharp.js +14 -28
- package/lib/junit-adapter/index.js +25 -27
- package/lib/junit-adapter/java.js +53 -41
- package/lib/junit-adapter/javascript.js +27 -30
- package/lib/junit-adapter/python.js +37 -38
- package/lib/junit-adapter/ruby.js +8 -11
- package/lib/output.js +52 -44
- package/lib/pipe/bitbucket.js +230 -223
- package/lib/pipe/csv.js +126 -113
- package/lib/pipe/debug.js +99 -118
- package/lib/pipe/github.js +213 -218
- package/lib/pipe/gitlab.js +206 -183
- package/lib/pipe/html.js +321 -258
- package/lib/pipe/index.js +66 -94
- package/lib/pipe/testomatio.js +474 -429
- package/lib/reporter-functions.js +26 -28
- package/lib/reporter.js +29 -34
- package/lib/services/artifacts.js +51 -55
- package/lib/services/index.js +12 -14
- package/lib/services/key-values.js +53 -56
- package/lib/services/logger.js +245 -226
- package/lib/template/testomatio.hbs +1366 -1026
- package/lib/uploader.js +364 -295
- package/lib/utils/pipe_utils.js +85 -89
- package/lib/utils/utils.js +307 -398
- package/lib/xmlReader.js +532 -525
- package/package.json +21 -64
- package/lib/adapter/codecept.d.ts +0 -2
- package/lib/adapter/cucumber/current.d.ts +0 -14
- package/lib/adapter/cucumber/legacy.d.ts +0 -0
- package/lib/adapter/cucumber.d.ts +0 -2
- package/lib/adapter/cypress-plugin/index.d.ts +0 -2
- package/lib/adapter/jasmine.d.ts +0 -11
- package/lib/adapter/jest.d.ts +0 -13
- package/lib/adapter/mocha.d.ts +0 -2
- package/lib/adapter/nightwatch.d.ts +0 -4
- package/lib/adapter/nightwatch.js +0 -80
- package/lib/adapter/playwright.d.ts +0 -14
- package/lib/adapter/vitest.d.ts +0 -35
- package/lib/adapter/webdriver.d.ts +0 -24
- package/lib/bin/cli.d.ts +0 -2
- package/lib/bin/reportXml.d.ts +0 -2
- package/lib/bin/startTest.d.ts +0 -2
- package/lib/bin/uploadArtifacts.d.ts +0 -2
- package/lib/client.d.ts +0 -76
- package/lib/config.d.ts +0 -1
- package/lib/constants.d.ts +0 -25
- package/lib/data-storage.d.ts +0 -34
- package/lib/junit-adapter/adapter.d.ts +0 -9
- package/lib/junit-adapter/csharp.d.ts +0 -5
- package/lib/junit-adapter/index.d.ts +0 -3
- package/lib/junit-adapter/java.d.ts +0 -5
- package/lib/junit-adapter/javascript.d.ts +0 -4
- package/lib/junit-adapter/python.d.ts +0 -5
- package/lib/junit-adapter/ruby.d.ts +0 -4
- package/lib/output.d.ts +0 -11
- package/lib/package.json +0 -3
- package/lib/pipe/bitbucket.d.ts +0 -25
- package/lib/pipe/csv.d.ts +0 -47
- package/lib/pipe/debug.d.ts +0 -29
- package/lib/pipe/github.d.ts +0 -30
- package/lib/pipe/gitlab.d.ts +0 -25
- package/lib/pipe/html.d.ts +0 -35
- package/lib/pipe/index.d.ts +0 -1
- package/lib/pipe/testomatio.d.ts +0 -71
- package/lib/replay.d.ts +0 -31
- package/lib/replay.js +0 -237
- package/lib/reporter-functions.d.ts +0 -34
- package/lib/reporter.d.ts +0 -232
- package/lib/services/artifacts.d.ts +0 -33
- package/lib/services/index.d.ts +0 -9
- package/lib/services/key-values.d.ts +0 -27
- package/lib/services/logger.d.ts +0 -64
- package/lib/uploader.d.ts +0 -60
- package/lib/utils/pipe_utils.d.ts +0 -41
- package/lib/utils/utils.d.ts +0 -54
- package/lib/xmlReader.d.ts +0 -92
- package/src/adapter/codecept.js +0 -373
- package/src/adapter/cucumber/current.js +0 -228
- package/src/adapter/cucumber/legacy.js +0 -158
- package/src/adapter/cucumber.js +0 -4
- package/src/adapter/cypress-plugin/index.js +0 -110
- package/src/adapter/jasmine.js +0 -60
- package/src/adapter/jest.js +0 -107
- package/src/adapter/mocha.cjs +0 -2
- package/src/adapter/mocha.js +0 -156
- package/src/adapter/nightwatch.js +0 -88
- package/src/adapter/playwright.js +0 -254
- package/src/adapter/vitest.js +0 -183
- package/src/adapter/webdriver.js +0 -142
- package/src/bin/cli.js +0 -348
- package/src/bin/reportXml.js +0 -77
- package/src/bin/startTest.js +0 -124
- package/src/bin/uploadArtifacts.js +0 -91
- package/src/client.js +0 -508
- package/src/config.js +0 -30
- package/src/constants.js +0 -53
- package/src/data-storage.js +0 -204
- package/src/junit-adapter/adapter.js +0 -23
- package/src/junit-adapter/csharp.js +0 -28
- package/src/junit-adapter/index.js +0 -28
- package/src/junit-adapter/java.js +0 -58
- package/src/junit-adapter/javascript.js +0 -31
- package/src/junit-adapter/python.js +0 -42
- package/src/junit-adapter/ruby.js +0 -10
- package/src/output.js +0 -57
- package/src/pipe/bitbucket.js +0 -252
- package/src/pipe/csv.js +0 -140
- package/src/pipe/debug.js +0 -119
- package/src/pipe/github.js +0 -232
- package/src/pipe/gitlab.js +0 -247
- package/src/pipe/html.js +0 -373
- package/src/pipe/index.js +0 -71
- package/src/pipe/testomatio.js +0 -504
- package/src/replay.js +0 -245
- package/src/reporter-functions.js +0 -55
- package/src/reporter.cjs_decprecated +0 -21
- package/src/reporter.js +0 -33
- package/src/services/artifacts.js +0 -59
- package/src/services/index.js +0 -13
- package/src/services/key-values.js +0 -59
- package/src/services/logger.js +0 -315
- package/src/template/emptyData.svg +0 -23
- package/src/template/testomatio.hbs +0 -1081
- package/src/uploader.js +0 -376
- package/src/utils/pipe_utils.js +0 -119
- package/src/utils/utils.js +0 -416
- package/src/xmlReader.js +0 -614
|
@@ -1,52 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const { services } = require('./services');
|
|
2
|
+
const { initPlaywrightForStorage } = require('./adapter/playwright');
|
|
3
|
+
|
|
4
|
+
if (process.env.PLAYWRIGHT_TEST_BASE_URL) {
|
|
5
|
+
initPlaywrightForStorage();
|
|
6
|
+
}
|
|
7
|
+
|
|
4
8
|
/**
|
|
5
9
|
* Stores path to file as artifact and uploads it to the S3 storage
|
|
6
10
|
* @param {string | {path: string, type: string, name: string}} data - path to file or object with path, type and name
|
|
7
11
|
*/
|
|
8
12
|
function saveArtifact(data, context = null) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/Playwright supports artifacts out of the box`);
|
|
12
|
-
if (!data)
|
|
13
|
-
return;
|
|
14
|
-
index_js_1.services.artifacts.put(data, context);
|
|
13
|
+
if (!data) return;
|
|
14
|
+
services.artifacts.put(data, context);
|
|
15
15
|
}
|
|
16
|
+
|
|
16
17
|
/**
|
|
17
18
|
* Attach log message(s) to the test report
|
|
18
|
-
* @param
|
|
19
|
+
* @param {...any} args
|
|
19
20
|
*/
|
|
20
21
|
function logMessage(...args) {
|
|
21
|
-
|
|
22
|
-
throw new Error('This function is not available in Playwright framework');
|
|
23
|
-
index_js_1.services.logger._templateLiteralLog(...args);
|
|
22
|
+
services.logger._templateLiteralLog(...args);
|
|
24
23
|
}
|
|
24
|
+
|
|
25
25
|
/**
|
|
26
26
|
* Similar to "log" function but marks message in report as a step
|
|
27
|
-
* @param {
|
|
27
|
+
* @param {*} message
|
|
28
28
|
*/
|
|
29
29
|
function addStep(message) {
|
|
30
|
-
|
|
31
|
-
throw new Error('This function is not available in Playwright framework. Use playwright steps');
|
|
32
|
-
index_js_1.services.logger.step(message);
|
|
30
|
+
services.logger.step(message);
|
|
33
31
|
}
|
|
32
|
+
|
|
34
33
|
/**
|
|
35
34
|
* Add key-value pair(s) to the test report
|
|
36
|
-
* @param {
|
|
35
|
+
* @param {*} keyValue or key
|
|
37
36
|
* @param {string?} value
|
|
38
37
|
*/
|
|
39
38
|
function setKeyValue(keyValue, value = null) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
index_js_1.services.keyValues.put(keyValue);
|
|
39
|
+
if (value && typeof keyValue === 'string') {
|
|
40
|
+
keyValue = { [keyValue]: value };
|
|
41
|
+
}
|
|
42
|
+
services.keyValues.put(keyValue);
|
|
46
43
|
}
|
|
44
|
+
|
|
47
45
|
module.exports = {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
artifact: saveArtifact,
|
|
47
|
+
log: logMessage,
|
|
48
|
+
step: addStep,
|
|
49
|
+
keyValue: setKeyValue,
|
|
52
50
|
};
|
package/lib/reporter.js
CHANGED
|
@@ -1,35 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* @typedef {import('./services/index.js')} logger
|
|
20
|
-
* @typedef {import('./reporter-functions.js')} meta
|
|
21
|
-
* @typedef {import('./reporter-functions.js')} step
|
|
22
|
-
*/
|
|
23
|
-
module.exports = {
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated Use `log` or `testomat.log`
|
|
26
|
-
*/
|
|
27
|
-
testomatioLogger: index_js_1.services.logger,
|
|
28
|
-
artifact: reporter_functions_js_1.default.artifact,
|
|
29
|
-
log: reporter_functions_js_1.default.log,
|
|
30
|
-
logger: index_js_1.services.logger,
|
|
31
|
-
meta: reporter_functions_js_1.default.keyValue,
|
|
32
|
-
step: reporter_functions_js_1.default.step,
|
|
33
|
-
// TestomatClient,
|
|
34
|
-
// TRConstants,
|
|
1
|
+
const TestomatClient = require('./client');
|
|
2
|
+
const TRConstants = require('./constants');
|
|
3
|
+
const { services } = require('./services');
|
|
4
|
+
|
|
5
|
+
const reporterFunctions = require('./reporter-functions');
|
|
6
|
+
|
|
7
|
+
const testomat = {
|
|
8
|
+
// TODO: deprecate in future; use log or testomat.log
|
|
9
|
+
testomatioLogger: services.logger,
|
|
10
|
+
|
|
11
|
+
artifact: reporterFunctions.artifact,
|
|
12
|
+
log: reporterFunctions.log,
|
|
13
|
+
logger: services.logger,
|
|
14
|
+
meta: reporterFunctions.keyValue,
|
|
15
|
+
step: reporterFunctions.step,
|
|
16
|
+
|
|
17
|
+
TestomatClient,
|
|
18
|
+
TRConstants,
|
|
35
19
|
};
|
|
20
|
+
|
|
21
|
+
module.exports = testomat;
|
|
22
|
+
|
|
23
|
+
module.exports.testomatioLogger = testomat;
|
|
24
|
+
module.exports.artifact = reporterFunctions.artifact;
|
|
25
|
+
module.exports.log = reporterFunctions.log;
|
|
26
|
+
module.exports.logger = services.logger;
|
|
27
|
+
module.exports.meta = reporterFunctions.keyValue;
|
|
28
|
+
module.exports.step = reporterFunctions.step;
|
|
29
|
+
module.exports.TestomatClient = TestomatClient;
|
|
30
|
+
module.exports.TRConstants = TRConstants;
|
|
@@ -1,61 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.artifactStorage = void 0;
|
|
7
|
-
const debug_1 = __importDefault(require("debug"));
|
|
8
|
-
const data_storage_js_1 = require("../data-storage.js");
|
|
9
|
-
const debug = (0, debug_1.default)('@testomatio/reporter:services-artifacts');
|
|
1
|
+
const debug = require('debug')('@testomatio/reporter:services-artifacts');
|
|
2
|
+
const { dataStorage } = require('../data-storage');
|
|
3
|
+
|
|
10
4
|
/**
|
|
11
5
|
* Artifact storage is supposed to store file paths
|
|
12
6
|
*/
|
|
13
7
|
class ArtifactStorage {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return this.#instance;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Stores path to file as artifact and uploads it to the S3 storage
|
|
27
|
-
* @param {string | {path: string, type: string, name: string}} data - path to file or object with path, type and name
|
|
28
|
-
* @param {*} context testId or test title
|
|
29
|
-
*/
|
|
30
|
-
put(data, context = null) {
|
|
31
|
-
if (!data)
|
|
32
|
-
return;
|
|
33
|
-
debug('Save artifact:', data);
|
|
34
|
-
data_storage_js_1.dataStorage.putData('artifact', data, context);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Returns list of artifacts to upload
|
|
38
|
-
* @param {*} context testId or test context from test runner
|
|
39
|
-
* @returns {(string | {path: string, type: string, name: string})[]}
|
|
40
|
-
*/
|
|
41
|
-
get(context) {
|
|
42
|
-
let artifacts = data_storage_js_1.dataStorage.getData('artifact', context);
|
|
43
|
-
if (!artifacts || !artifacts.length)
|
|
44
|
-
return [];
|
|
45
|
-
artifacts = artifacts.map(artifactData => {
|
|
46
|
-
// artifact could be an object ({type, path, name} props) or string (just path)
|
|
47
|
-
let artifact;
|
|
48
|
-
try {
|
|
49
|
-
artifact = JSON.parse(artifactData);
|
|
50
|
-
}
|
|
51
|
-
catch (e) {
|
|
52
|
-
artifact = artifactData;
|
|
53
|
-
}
|
|
54
|
-
return artifact;
|
|
55
|
-
});
|
|
56
|
-
artifacts = artifacts.filter(artifact => !!artifact);
|
|
57
|
-
debug(`Artifacts for test ${context}:`, artifacts);
|
|
58
|
-
return artifacts.length ? artifacts : [];
|
|
8
|
+
static #instance;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Singleton
|
|
12
|
+
* @returns {ArtifactStorage}
|
|
13
|
+
*/
|
|
14
|
+
static getInstance() {
|
|
15
|
+
if (!this.#instance) {
|
|
16
|
+
this.#instance = new ArtifactStorage();
|
|
59
17
|
}
|
|
18
|
+
return this.#instance;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Stores path to file as artifact and uploads it to the S3 storage
|
|
23
|
+
* @param {string | {path: string, type: string, name: string}} data - path to file or object with path, type and name
|
|
24
|
+
* @param {*} context testId or test title
|
|
25
|
+
*/
|
|
26
|
+
put(data, context = null) {
|
|
27
|
+
if (!data) return;
|
|
28
|
+
debug('Save artifact:', data);
|
|
29
|
+
dataStorage.putData('artifact', data, context);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Returns list of artifacts to upload
|
|
34
|
+
* @param {*} context testId or test context from test runner
|
|
35
|
+
* @returns {(string | {path: string, type: string, name: string})[]}
|
|
36
|
+
*/
|
|
37
|
+
get(context) {
|
|
38
|
+
let artifacts = dataStorage.getData('artifact', context);
|
|
39
|
+
if (!artifacts || !artifacts.length) return [];
|
|
40
|
+
|
|
41
|
+
artifacts = artifacts.map(artifactData => {
|
|
42
|
+
// artifact could be an object ({type, path, name} props) or string (just path)
|
|
43
|
+
let artifact;
|
|
44
|
+
try {
|
|
45
|
+
artifact = JSON.parse(artifactData);
|
|
46
|
+
} catch (e) {
|
|
47
|
+
artifact = artifactData;
|
|
48
|
+
}
|
|
49
|
+
return artifact;
|
|
50
|
+
});
|
|
51
|
+
artifacts = artifacts.filter(artifact => !!artifact);
|
|
52
|
+
debug(`Artifacts for test ${context}:`, artifacts);
|
|
53
|
+
return artifacts.length ? artifacts : [];
|
|
54
|
+
}
|
|
60
55
|
}
|
|
61
|
-
|
|
56
|
+
|
|
57
|
+
module.exports.artifactStorage = ArtifactStorage.getInstance();
|
package/lib/services/index.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
data_storage_js_1.dataStorage.setContext(context);
|
|
14
|
-
},
|
|
1
|
+
const { logger } = require('./logger');
|
|
2
|
+
const { artifactStorage } = require('./artifacts');
|
|
3
|
+
const { keyValueStorage } = require('./key-values');
|
|
4
|
+
const { dataStorage } = require('../data-storage');
|
|
5
|
+
|
|
6
|
+
module.exports.services = {
|
|
7
|
+
logger,
|
|
8
|
+
artifacts: artifactStorage,
|
|
9
|
+
keyValues: keyValueStorage,
|
|
10
|
+
setContext: context => {
|
|
11
|
+
dataStorage.setContext(context);
|
|
12
|
+
},
|
|
15
13
|
};
|
|
@@ -1,61 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.keyValueStorage = void 0;
|
|
7
|
-
const debug_1 = __importDefault(require("debug"));
|
|
8
|
-
const data_storage_js_1 = require("../data-storage.js");
|
|
9
|
-
const debug = (0, debug_1.default)('@testomatio/reporter:services-key-value');
|
|
1
|
+
const debug = require('debug')('@testomatio/reporter:services-key-value');
|
|
2
|
+
const { dataStorage } = require('../data-storage');
|
|
3
|
+
|
|
10
4
|
class KeyValueStorage {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return this.#instance;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Stores key-value pair and passes it to reporter
|
|
24
|
-
* @param {{[key: string]: string}} keyValue - key-value pair(s) as object
|
|
25
|
-
* @param {*} context - full test title
|
|
26
|
-
*/
|
|
27
|
-
put(keyValue, context = null) {
|
|
28
|
-
if (!keyValue)
|
|
29
|
-
return;
|
|
30
|
-
data_storage_js_1.dataStorage.putData('keyvalue', keyValue, context);
|
|
31
|
-
}
|
|
32
|
-
#isKeyValueObject(smth) {
|
|
33
|
-
return smth && typeof smth === 'object' && !Array.isArray(smth) && smth !== null;
|
|
5
|
+
static #instance;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @returns {KeyValueStorage}
|
|
10
|
+
*/
|
|
11
|
+
static getInstance() {
|
|
12
|
+
if (!this.#instance) {
|
|
13
|
+
this.#instance = new KeyValueStorage();
|
|
34
14
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
15
|
+
return this.#instance;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Stores key-value pair and passes it to reporter
|
|
20
|
+
* @param {{key: string}} keyValue - key-value pair(s) as object
|
|
21
|
+
* @param {*} context - full test title
|
|
22
|
+
*/
|
|
23
|
+
put(keyValue, context = null) {
|
|
24
|
+
if (!keyValue) return;
|
|
25
|
+
dataStorage.putData('keyvalue', keyValue, context);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
#isKeyValueObject(smth) {
|
|
29
|
+
return smth && typeof smth === 'object' && !Array.isArray(smth) && smth !== null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Returns key-values pairs for the test as object
|
|
34
|
+
* @param {*} context testId or test context from test runner
|
|
35
|
+
* @returns {{[key: string]: string} | {}} key-values pairs as object, e.g. {priority: 'high', browser: 'chrome'}
|
|
36
|
+
*/
|
|
37
|
+
get(context = null) {
|
|
38
|
+
const keyValuesList = dataStorage.getData('keyvalue', context);
|
|
39
|
+
if (!keyValuesList || !keyValuesList?.length) return {};
|
|
40
|
+
|
|
41
|
+
const keyValues = {};
|
|
42
|
+
for (const keyValue of keyValuesList) {
|
|
43
|
+
if (this.#isKeyValueObject(keyValue)) {
|
|
44
|
+
Object.assign(keyValues, keyValue);
|
|
45
|
+
} else if (typeof keyValue === 'string') {
|
|
46
|
+
try {
|
|
47
|
+
Object.assign(keyValues, JSON.parse(keyValue));
|
|
48
|
+
} catch (e) {
|
|
49
|
+
debug(`Error parsing key-values for test ${context}`, keyValue);
|
|
57
50
|
}
|
|
58
|
-
|
|
51
|
+
}
|
|
59
52
|
}
|
|
53
|
+
|
|
54
|
+
return keyValues;
|
|
55
|
+
}
|
|
60
56
|
}
|
|
61
|
-
|
|
57
|
+
|
|
58
|
+
module.exports.keyValueStorage = KeyValueStorage.getInstance();
|