@testim/testim-cli 3.246.0 → 3.249.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/testimDesiredCapabilitiesBuilder.js +1 -3
- package/npm-shrinkwrap.json +394 -3729
- package/package.json +1 -5
- package/player/stepActions/scripts/selectOption.js +6 -1
- package/player/stepActions/selectOptionStepAction.js +32 -26
- package/player/stepActions/stepActionRegistrar.js +1 -1
- package/workers/BaseWorker.js +2 -2
- package/workers/WorkerSelenium.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testim/testim-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.249.0",
|
|
4
4
|
"description": "Command line interface for running Testing on your CI",
|
|
5
5
|
"author": "Oren Rubin",
|
|
6
6
|
"contributors": [{
|
|
@@ -17,15 +17,11 @@
|
|
|
17
17
|
"@types/node": "10.17.24",
|
|
18
18
|
"@types/selenium-webdriver": "4.0.9",
|
|
19
19
|
"bundle-deps": "1.0.0",
|
|
20
|
-
"chai": "4.3.6",
|
|
21
|
-
"chai-as-promised": "7.1.1",
|
|
22
20
|
"gulp": "4.0.2",
|
|
23
21
|
"gulp-cli": "2.3.0",
|
|
24
22
|
"gulp-json-editor": "2.5.6",
|
|
25
23
|
"gulp-preprocess": "3.0.3",
|
|
26
24
|
"merge-stream": "2.0.0",
|
|
27
|
-
"mocha": "9.2.0",
|
|
28
|
-
"nyc": "15.1.0",
|
|
29
25
|
"proxyquire": "2.1.3",
|
|
30
26
|
"request": "2.88.2",
|
|
31
27
|
"sinon": "9.0.2",
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
+
/* eslint-disable no-restricted-syntax */ // This code only runs in Safari, not in IE.
|
|
1
2
|
module.exports = function (locatedElement, dispatchEventOnSelectElement) {
|
|
2
3
|
function closest(el, selectors) {
|
|
4
|
+
var originalMatches = Element.prototype.matches;
|
|
5
|
+
/* eslint-disable-next-line no-proto, no-undef */ // Some customers override the native Element prototype, so we need to create a new one if they messed it up.
|
|
6
|
+
var matches = originalMatches && isNativeFunction(originalMatches) ? originalMatches : document.createElement(el.tagName).__proto__.matches;
|
|
3
7
|
do {
|
|
4
|
-
if (
|
|
8
|
+
if (matches.call(el, selectors)) return el;
|
|
5
9
|
el = el.parentElement || el.parentNode;
|
|
6
10
|
} while (el !== null && el.nodeType === 1);
|
|
7
11
|
return null;
|
|
8
12
|
}
|
|
9
13
|
|
|
10
14
|
try {
|
|
15
|
+
/* eslint-disable-next-line no-undef */ // This code depends on pre-injecting this function as well.
|
|
11
16
|
var optionEl = getLocatedElement(locatedElement);
|
|
12
17
|
if (!optionEl) {
|
|
13
18
|
return { success: false, status: 'failed', result: 'option element not found' };
|
|
@@ -2,42 +2,48 @@
|
|
|
2
2
|
|
|
3
3
|
const StepAction = require('./stepAction');
|
|
4
4
|
const { extractElementId } = require('../../utils');
|
|
5
|
-
const { codeSnippets } = require('../../commons/getSessionPlayerRequire');
|
|
5
|
+
const { codeSnippets, utils } = require('../../commons/getSessionPlayerRequire');
|
|
6
6
|
const selectOption = require('./scripts/selectOption');
|
|
7
7
|
const featureFlags = require('../../commons/featureFlags');
|
|
8
8
|
|
|
9
9
|
class SelectOptionStepAction extends StepAction {
|
|
10
|
-
performAction() {
|
|
10
|
+
async performAction() {
|
|
11
11
|
const target = this.context.data[this.step.targetId || 'targetId'];
|
|
12
12
|
const { seleniumElement, locatedElement } = target;
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
.then(browserAndOS => {
|
|
16
|
-
const browserMajor = browserAndOS.browserMajor;
|
|
17
|
-
const isSafari = this.driver.isSafari();
|
|
18
|
-
const isShadowed = Boolean(this.step.element && this.step.element.isShadowed);
|
|
14
|
+
const browserAndOS = await this.driver.getBrowserAndOS();
|
|
19
15
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
const browserMajor = browserAndOS.browserMajor;
|
|
17
|
+
const isSafari = this.driver.isSafari();
|
|
18
|
+
const isShadowed = Boolean(this.step.element && this.step.element.isShadowed);
|
|
19
|
+
|
|
20
|
+
// TODO: Remove the special handling for safari < 12 after we upgrade our grid to safari 13.
|
|
21
|
+
// force use js code when element is shadow dom
|
|
22
|
+
if (!isSafari || (isSafari && browserMajor >= 13 && !isShadowed)) {
|
|
23
|
+
try {
|
|
24
|
+
const res = await this.driver.elementIdClick(extractElementId(seleniumElement));
|
|
25
|
+
return res;
|
|
26
|
+
} catch (err) {
|
|
27
|
+
// If customer overrides the native Element prototype, this click will fail for this reason. in such a case, fallback to use js code.
|
|
28
|
+
if (!err.message.includes('Cannot check the displayedness of a non-Element argument')) {
|
|
29
|
+
throw err;
|
|
24
30
|
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const safariSelectOptionDispatchEventOnSelectElement = featureFlags.flags.safariSelectOptionDispatchEventOnSelectElement.isEnabled();
|
|
35
|
+
const selectOptionCode = `
|
|
36
|
+
var getLocatedElement = ${codeSnippets.getLocatedElementCode};
|
|
37
|
+
var isNativeFunction = ${utils.isNativeFunction.toString()};
|
|
38
|
+
var selectOption = ${selectOption.toString()};
|
|
39
|
+
return selectOption.apply(null, arguments);
|
|
40
|
+
`;
|
|
25
41
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
`;
|
|
32
|
-
|
|
33
|
-
return this.driver.executeJSWithArray(selectOptionCode, [locatedElement, safariSelectOptionDispatchEventOnSelectElement])
|
|
34
|
-
.then(result => {
|
|
35
|
-
if (result.value && result.value.success) {
|
|
36
|
-
return { success: true };
|
|
37
|
-
}
|
|
38
|
-
return { success: false };
|
|
39
|
-
});
|
|
40
|
-
});
|
|
42
|
+
const result = await this.driver.executeJSWithArray(selectOptionCode, [locatedElement, safariSelectOptionDispatchEventOnSelectElement]);
|
|
43
|
+
if (result.value && result.value.success) {
|
|
44
|
+
return { success: true };
|
|
45
|
+
}
|
|
46
|
+
return { success: false };
|
|
41
47
|
}
|
|
42
48
|
}
|
|
43
49
|
|
|
@@ -90,7 +90,7 @@ module.exports = function (driver, stepActionFactory, runMode) {
|
|
|
90
90
|
'sfdc-step-sobjectdelete': SfdcStepAction,
|
|
91
91
|
'sfdc-step-findrecord': SfdcStepAction,
|
|
92
92
|
'sfdc-step-quickaction': SfdcStepAction,
|
|
93
|
-
'sfdc-step-
|
|
93
|
+
'sfdc-step-sobjectedit': SfdcStepAction,
|
|
94
94
|
'sfdc-step-sobjectvalidate': SfdcStepAction,
|
|
95
95
|
'sfdc-step-launchapp': SfdcStepAction,
|
|
96
96
|
'sfdc-step-closeconsoletabs': SfdcStepAction,
|
package/workers/BaseWorker.js
CHANGED
|
@@ -129,7 +129,7 @@ class BaseWorker {
|
|
|
129
129
|
await utils.delay(this.options.getBrowserTimeout - (Date.now() - startTime));
|
|
130
130
|
throw error;
|
|
131
131
|
}
|
|
132
|
-
}, { retries: this.options.getBrowserRetries - 1, minTimeout: 0 });
|
|
132
|
+
}, { retries: this.options.getBrowserRetries - 1, minTimeout: 0, factor: 1 });
|
|
133
133
|
perf.log('after getSlotOnce retries');
|
|
134
134
|
|
|
135
135
|
perf.log('before getBrowserOnce retries');
|
|
@@ -168,7 +168,7 @@ class BaseWorker {
|
|
|
168
168
|
}
|
|
169
169
|
throw error;
|
|
170
170
|
}
|
|
171
|
-
}, { retries: getBrowserRetriesNumber - 1, minTimeout: 0 });
|
|
171
|
+
}, { retries: getBrowserRetriesNumber - 1, minTimeout: 0, factor: 1 });
|
|
172
172
|
perf.log('after getBrowserOnce retries');
|
|
173
173
|
} catch (err) {
|
|
174
174
|
await releasePlayer(this.id, this.releaseSlotOnTestFinished, projectId, testPlayer);
|
|
@@ -66,7 +66,7 @@ class WorkerSelenium extends BaseWorker {
|
|
|
66
66
|
await this.windowUtils.validatePageIsAvailable();
|
|
67
67
|
perf.log('in WorkerSelenium after navigate');
|
|
68
68
|
} catch (err) {
|
|
69
|
-
const firefoxPageNotAvailable = (err.message.startsWith('Malformed URL') || err.message.includes('Reached error page: about:neterror')) &&
|
|
69
|
+
const firefoxPageNotAvailable = err.message && (err.message.startsWith('Malformed URL') || err.message.includes('Reached error page: about:neterror')) &&
|
|
70
70
|
browserValue === 'firefox';
|
|
71
71
|
|
|
72
72
|
const invalidURL = (err.message && err.message === 'invalid argument');
|