@testim/testim-cli 3.243.0 → 3.244.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/testimAnalytics.js +8 -3
- package/npm-shrinkwrap.json +176 -176
- package/package.json +1 -1
- package/player/stepActions/scripts/doClick.js +3 -1
- package/player/stepActions/scripts/html5dragAction.js +3 -1
- package/player/stepActions/scripts/html5dragActionV2.js +3 -1
- package/player/stepActions/scripts/runCode.js +23 -6
- package/player/stepActions/scripts/scroll.js +1 -6
- package/player/stepActions/scripts/setText.js +4 -1
- package/utils.js +2 -6
- package/utils.test.js +1 -1
package/package.json
CHANGED
|
@@ -3,23 +3,40 @@
|
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
const runCode = function (eventData, preCompiledCode) {
|
|
6
|
+
typeof Object.tstassign !== 'function' && (Object.tstassign = function (n, t) {
|
|
7
|
+
'use strict';
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
if (n == null) throw new TypeError('Cannot convert undefined or null to object'); for (var r = Object(n), e = 1; e < arguments.length; e++) { var o = arguments[e]; if (o != null) for (var a in o)Object.prototype.hasOwnProperty.call(o, a) && (r[a] = o[a]); } return r;
|
|
10
|
+
});
|
|
11
|
+
Object.assign = typeof Object.assign !== 'function' ? Object.tstassign : Object.assign;
|
|
9
12
|
|
|
10
13
|
function appendToStorage(name, data) {
|
|
11
14
|
const sessionItem = 'data-testim-' + name;
|
|
15
|
+
|
|
16
|
+
const nativeFuncErrMsg = 'Native sessionStorage is not available';
|
|
17
|
+
function isNativeFunction(fn) {
|
|
18
|
+
if (!fn || !fn.toString) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return fn.toString().indexOf('[native code]') > -1;
|
|
22
|
+
}
|
|
12
23
|
try {
|
|
24
|
+
if (![window.sessionStorage.setItem, window.sessionStorage.getItem].every(isNativeFunction)) {
|
|
25
|
+
throw new Error(nativeFuncErrMsg);
|
|
26
|
+
}
|
|
13
27
|
const oldData = JSON.parse(window.sessionStorage.getItem(sessionItem) || '{}');
|
|
14
28
|
const newData = Object.tstassign({}, oldData, data);
|
|
15
29
|
window.sessionStorage.setItem(sessionItem, JSON.stringify(newData));
|
|
16
30
|
} catch (err) {
|
|
17
|
-
// any
|
|
31
|
+
// any variation QuotaExceededError from browsers
|
|
18
32
|
const isQuotaExceededError = err.message.toLowerCase().indexOf('quota') > -1;
|
|
33
|
+
const isNativeFunctionError = err.message === nativeFuncErrMsg;
|
|
34
|
+
|
|
19
35
|
if (err.message.indexOf('sessionStorage') > -1 || // Chrome + Firefox
|
|
20
36
|
err.message.indexOf('The operation is insecure') > -1 || // Safari
|
|
21
37
|
err.message.indexOf('SecurityError') > -1 || // Edge
|
|
22
|
-
isQuotaExceededError
|
|
38
|
+
isQuotaExceededError ||
|
|
39
|
+
isNativeFunctionError
|
|
23
40
|
) {
|
|
24
41
|
var storage = document.head.querySelector('#testim-storage-backup');
|
|
25
42
|
if (!storage) {
|
|
@@ -30,13 +47,13 @@ const runCode = function (eventData, preCompiledCode) {
|
|
|
30
47
|
const oldData = JSON.parse(storage.getAttribute(sessionItem) || '{}');
|
|
31
48
|
const newData = Object.tstassign({}, oldData, data);
|
|
32
49
|
storage.setAttribute(sessionItem, JSON.stringify(newData));
|
|
33
|
-
if (isQuotaExceededError) {
|
|
50
|
+
if (isQuotaExceededError || isNativeFunctionError) {
|
|
34
51
|
try {
|
|
35
52
|
window.sessionStorage.removeItem(sessionItem);
|
|
36
53
|
} catch (e) {
|
|
37
54
|
// Prevents future retries from looking in sessionStorage with old data
|
|
38
55
|
}
|
|
39
|
-
window.TSTA.useFallbackStorage = true;
|
|
56
|
+
(window.TSTA = window.TSTA || {}).useFallbackStorage = true;
|
|
40
57
|
}
|
|
41
58
|
return;
|
|
42
59
|
}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/* eslint-disable no-var */
|
|
3
|
-
/* eslint-disable no-redeclare */
|
|
4
|
-
/* eslint-disable object-shorthand */
|
|
5
|
-
/* eslint-disable one-var */
|
|
6
|
-
/* eslint-disable operator-linebreak */
|
|
1
|
+
/* globals getLocatedElement, elementScrollTo */
|
|
7
2
|
|
|
8
3
|
'use strict';
|
|
9
4
|
|
package/utils.js
CHANGED
|
@@ -71,20 +71,16 @@ function getRunConfigByBrowserName(browser, saucelabs, browserstack) {
|
|
|
71
71
|
return _.merge(selectedBrowser, selectedOS);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
function handleAngularURIComponent(part) {
|
|
75
|
-
return part.replace(/(~|\/)/g, m => ({ '~': '~~', '/': '~2F' }[m]));
|
|
76
|
-
}
|
|
77
|
-
|
|
78
74
|
function getTestUrl(editorUrl, projectId, testId, resultId, branch) {
|
|
79
75
|
let testUrl = '';
|
|
80
|
-
branch = branch ?
|
|
76
|
+
branch = branch ? encodeURIComponent(branch) : 'master';
|
|
81
77
|
if (projectId && testId) {
|
|
82
78
|
testUrl = `${editorUrl}/#/project/${projectId}/branch/${branch}/test/${testId}`;
|
|
83
79
|
if (resultId) {
|
|
84
80
|
testUrl += `?result-id=${resultId}`;
|
|
85
81
|
}
|
|
86
82
|
}
|
|
87
|
-
return
|
|
83
|
+
return testUrl;
|
|
88
84
|
}
|
|
89
85
|
|
|
90
86
|
function isPromise(obj) {
|
package/utils.test.js
CHANGED
|
@@ -32,7 +32,7 @@ describe('utils', () => {
|
|
|
32
32
|
expect(utils.getTestUrl('http://localhost:8080', 'project', 'test', 'result', 'normal-branch-name'))
|
|
33
33
|
.to.equal('http://localhost:8080/#/project/project/branch/normal-branch-name/test/test?result-id=result');
|
|
34
34
|
expect(utils.getTestUrl('http://localhost:8080', 'project', 'test', 'result', 'branch/with/slashes'))
|
|
35
|
-
.to.equal('http://localhost:8080/#/project/project/branch/branch
|
|
35
|
+
.to.equal('http://localhost:8080/#/project/project/branch/branch%2Fwith%2Fslashes/test/test?result-id=result');
|
|
36
36
|
expect(utils.getTestUrl('http://localhost:8080', 'project', 'test', 'result', 'branch with spaces'))
|
|
37
37
|
.to.equal('http://localhost:8080/#/project/project/branch/branch%20with%20spaces/test/test?result-id=result');
|
|
38
38
|
expect(utils.getTestUrl('http://localhost:8080', 'project', 'test', 'result', 'encoded%20branch'))
|