@mablhq/mabl-cli 1.16.23 → 1.17.6
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/api/basicApiClient.js +9 -4
- package/api/mablApiClient.js +14 -7
- package/browserLauncher/browserLauncherFactory.js +2 -1
- package/browserLauncher/elementHandle.js +2 -1
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +5 -1
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +11 -9
- package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +22 -18
- package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +10 -6
- package/browserLauncher/playwrightBrowserLauncher/playwrightHttpRequest.js +5 -1
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +13 -9
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerBrowser.js +3 -2
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerBrowserLauncher.js +1 -1
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerElementHandle.js +10 -10
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerFrame.js +6 -6
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerHttpRequest.js +1 -1
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerHttpResponse.js +1 -1
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerJsHandle.js +3 -3
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerPage.js +15 -11
- package/cli.js +12 -8
- package/commands/applications/applications_cmds/describe.js +4 -4
- package/commands/applications/applications_cmds/list.js +4 -4
- package/commands/auth/auth_cmds/activate-key.js +1 -1
- package/commands/branches/branches_cmds/create.js +4 -4
- package/commands/branches/branches_cmds/describe.js +3 -3
- package/commands/branches/branches_cmds/list.js +3 -3
- package/commands/branches/branches_cmds/merge.js +4 -4
- package/commands/commandUtil/codeInsights.js +4 -2
- package/commands/commandUtil/describe.js +1 -1
- package/commands/commandUtil/fileUtil.js +5 -1
- package/commands/commandUtil/util.js +2 -2
- package/commands/config/config_cmds/delete.js +1 -1
- package/commands/config/config_cmds/set.js +1 -1
- package/commands/constants.js +3 -1
- package/commands/credentials/credentials_cmds/list.js +4 -4
- package/commands/deploy/deploy_cmds/create.js +18 -13
- package/commands/deploy/deploy_cmds/describe.js +5 -5
- package/commands/deploy/deploy_cmds/executionResultPresenter.js +1 -1
- package/commands/deploy/deploy_cmds/list.js +4 -4
- package/commands/deploy/deploy_cmds/watch.js +2 -2
- package/commands/environments/environments_cmds/create.js +7 -7
- package/commands/environments/environments_cmds/delete.js +1 -1
- package/commands/environments/environments_cmds/describe.js +4 -4
- package/commands/environments/environments_cmds/list.js +4 -4
- package/commands/environments/environments_cmds/update.js +2 -2
- package/commands/environments/environments_cmds/urls_cmds/add.js +3 -3
- package/commands/environments/environments_cmds/urls_cmds/list.js +2 -2
- package/commands/flows/flows_cmds/export.js +5 -5
- package/commands/flows/flows_cmds/list.js +2 -2
- package/commands/link-agents/link-agents_cmds/delete.js +1 -1
- package/commands/plans/plans_cmds/describe.js +4 -4
- package/commands/plans/plans_cmds/list.js +2 -2
- package/commands/test-runs/test-runs_cmds/export.js +2 -2
- package/commands/tests/executionUtil.js +5 -5
- package/commands/tests/testsUtil.js +30 -18
- package/commands/tests/tests_cmds/create.js +3 -3
- package/commands/tests/tests_cmds/edit.js +3 -3
- package/commands/tests/tests_cmds/export.js +7 -7
- package/commands/tests/tests_cmds/import.js +35 -14
- package/commands/tests/tests_cmds/list.js +3 -3
- package/commands/tests/tests_cmds/run-alpha.js +3 -3
- package/commands/tests/tests_cmds/run-cloud.js +4 -4
- package/commands/tests/tests_cmds/run-legacy.js +8 -8
- package/commands/tests/tests_cmds/run.js +13 -8
- package/commands/tests/tests_cmds/trainer_cmds/trainerUtil.js +2 -2
- package/commands/tests/tests_cmds/trainer_cmds/update.js +1 -1
- package/commands/tests/tests_cmds/trainer_cmds/version.js +2 -2
- package/commands/workspaces/workspace_cmds/copy.js +2 -2
- package/commands/workspaces/workspace_cmds/describe.js +4 -4
- package/commands/workspaces/workspace_cmds/list.js +2 -2
- package/configGenerators/flowConfigGenerator.js +1 -1
- package/configGenerators/selIdeGenerator.js +6 -6
- package/core/messaging/actions/runnerActions.js +2 -2
- package/core/trainer/openUtils.js +2 -2
- package/core/trainer/trainingSessions.js +26 -26
- package/domUtil/index.js +1 -1
- package/domUtil/index.js.LICENSE.txt +5 -5
- package/env/env.js +5 -1
- package/execution/index.js +1 -1
- package/execution/index.js.LICENSE.txt +5 -5
- package/mablApi/index.js +1 -1
- package/mablscript/AttributesConstants.js +2 -1
- package/mablscript/MablStep.js +6 -12
- package/mablscript/actions/ConditionAction.js +1 -1
- package/mablscript/actions/FindAction.js +54 -60
- package/mablscript/actions/GetUrlAction.js +1 -1
- package/mablscript/actions/GetVariableValue.js +1 -1
- package/mablscript/actions/JavaScriptAction.js +16 -16
- package/mablscript/importer.js +7 -7
- package/mablscript/steps/AccessibilityCheck.js +9 -7
- package/mablscript/steps/AssertStep.js +27 -27
- package/mablscript/steps/AssertStepOld.js +10 -10
- package/mablscript/steps/ClickAndHoldStep.js +5 -5
- package/mablscript/steps/ClickStep.js +6 -6
- package/mablscript/steps/CreateVariableStep.js +8 -8
- package/mablscript/steps/DoubleClickStep.js +7 -7
- package/mablscript/steps/EchoStep.js +2 -2
- package/mablscript/steps/EnterTextStep.js +9 -9
- package/mablscript/steps/HoverStep.js +6 -6
- package/mablscript/steps/IfConditionStep.js +8 -7
- package/mablscript/steps/NavigateStep.js +1 -1
- package/mablscript/steps/ReleaseStep.js +5 -5
- package/mablscript/steps/SelectStep.js +5 -5
- package/mablscript/steps/SendHttpRequestStep.js +1 -1
- package/mablscript/steps/SendKeyStep.js +7 -7
- package/mablscript/steps/SetFilesStep.js +5 -5
- package/mablscript/steps/SetViewportStep.js +1 -1
- package/mablscript/steps/SwitchContextStep.js +12 -12
- package/mablscript/steps/VisitUrlStep.js +1 -1
- package/mablscript/steps/WaitStep.js +1 -1
- package/mablscript/steps/WaitUntilStep.js +3 -3
- package/mablscript/types/OperatingSystemDescriptor.js +5 -1
- package/mablscript/types/VariableNamespace.js +1 -1
- package/mablscriptFind/index.js +1 -1
- package/mablscriptFind/index.js.LICENSE.txt +5 -5
- package/observers/mockObserver.js +4 -2
- package/package.json +55 -56
- package/popupDismissal/index.js +3 -3
- package/providers/authenticationProvider.js +3 -3
- package/providers/logging/loggingProvider.js +5 -1
- package/proxy/index.js +2 -1
- package/proxy/index.js.LICENSE.txt +5 -0
- package/reporters/mochAwesome/mochAwesomeReporter.js +11 -7
- package/reporters/reporter.js +1 -1
- package/resources/mablFind.js +1 -1
- package/resources/pdf-viewer/embeddedPdfDetection.js +17 -7
- package/resources/popupDismissal.js +1 -1
- package/util/RichPromise.js +1 -0
- package/util/actionabilityUtil.js +18 -14
- package/util/analytics.js +7 -3
- package/util/downloadUtil.js +6 -2
- package/util/httpUtil.js +6 -2
- package/util/logUtils.js +7 -1
- package/util/markdownUtil.js +1 -1
- package/util/pureUtil.js +5 -1
- package/util/resourceUtil.js +5 -1
|
@@ -107,7 +107,8 @@ exports.ALLOWED_ASSERTABLE_URL_ATTRS_PROPS = [
|
|
|
107
107
|
'username',
|
|
108
108
|
];
|
|
109
109
|
const ALLOWED_ASSERTABLE_URL_ATTRS_PROPS_SET = new Set(exports.ALLOWED_ASSERTABLE_URL_ATTRS_PROPS);
|
|
110
|
-
|
|
110
|
+
const isAllowedAssertableUrlAttrProps = (x) => ALLOWED_ASSERTABLE_URL_ATTRS_PROPS_SET.has(x);
|
|
111
|
+
exports.isAllowedAssertableUrlAttrProps = isAllowedAssertableUrlAttrProps;
|
|
111
112
|
exports.ALLOWED_ASSERTABLE_EMAIL_ATTRS_PROPS = [
|
|
112
113
|
'from',
|
|
113
114
|
'subject',
|
package/mablscript/MablStep.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.buildObjectString = exports.buildSourceRepresentationOfObject = exports.
|
|
|
4
4
|
const MablAction_1 = require("./MablAction");
|
|
5
5
|
const SeleniumIdeStep_1 = require("./steps/SeleniumIdeStep");
|
|
6
6
|
const MablSymbol_1 = require("./MablSymbol");
|
|
7
|
+
const domUtil_1 = require("../domUtil");
|
|
7
8
|
class MablStep extends MablAction_1.MablAction {
|
|
8
9
|
constructor(name, args, actions) {
|
|
9
10
|
super(name, args);
|
|
@@ -37,7 +38,7 @@ class MablStep extends MablAction_1.MablAction {
|
|
|
37
38
|
if (argument instanceof MablSymbol_1.MablSymbol) {
|
|
38
39
|
return argument.name;
|
|
39
40
|
}
|
|
40
|
-
if (MablAction_1.argumentIsMablVariable(argument)) {
|
|
41
|
+
if ((0, MablAction_1.argumentIsMablVariable)(argument)) {
|
|
41
42
|
const matches = argument.match(MablSymbol_1.SINGLE_VARIABLE_PATTERN_REGEX);
|
|
42
43
|
if (matches) {
|
|
43
44
|
return matches[1];
|
|
@@ -83,7 +84,7 @@ class MablStep extends MablAction_1.MablAction {
|
|
|
83
84
|
return formatted;
|
|
84
85
|
}
|
|
85
86
|
produceSelIdeFormattedSteps(_stepIndex) {
|
|
86
|
-
const selIdeEcho = SeleniumIdeStep_1.buildSeleniumIdeStep('echo');
|
|
87
|
+
const selIdeEcho = (0, SeleniumIdeStep_1.buildSeleniumIdeStep)('echo');
|
|
87
88
|
const unSupportedStepMessage = `[${this.getStepName()}] Step is not supported for Selenium IDE export`;
|
|
88
89
|
selIdeEcho.comment = unSupportedStepMessage;
|
|
89
90
|
selIdeEcho.target = unSupportedStepMessage;
|
|
@@ -124,7 +125,7 @@ function buildSourceRepresentationOfObject(object) {
|
|
|
124
125
|
if (typeof value === 'number') {
|
|
125
126
|
return `${key}: ${value}`;
|
|
126
127
|
}
|
|
127
|
-
return `${key}: "${escapeMablscriptString(value)}"`;
|
|
128
|
+
return `${key}: "${(0, domUtil_1.escapeMablscriptString)(value)}"`;
|
|
128
129
|
}
|
|
129
130
|
return `${key}: ${buildSourceRepresentationOfObject(value)}`;
|
|
130
131
|
});
|
|
@@ -140,14 +141,14 @@ function buildObjectString(objectString) {
|
|
|
140
141
|
return final;
|
|
141
142
|
}
|
|
142
143
|
if (typeof objectString[key] === 'string') {
|
|
143
|
-
return final.push(`${key}: "${escapeMablscriptString(objectString[key])}"`);
|
|
144
|
+
return final.push(`${key}: "${(0, domUtil_1.escapeMablscriptString)(objectString[key])}"`);
|
|
144
145
|
}
|
|
145
146
|
else if (typeof objectString[key] === 'number') {
|
|
146
147
|
return final.push(`${key}: ${objectString[key]}`);
|
|
147
148
|
}
|
|
148
149
|
else if (Array.isArray(objectString[key])) {
|
|
149
150
|
return final.push(`"${key}": [${objectString[key]
|
|
150
|
-
.map((arrayVal) => `"${escapeMablscriptString(arrayVal)}"`)
|
|
151
|
+
.map((arrayVal) => `"${(0, domUtil_1.escapeMablscriptString)(arrayVal)}"`)
|
|
151
152
|
.join(', ')}]`);
|
|
152
153
|
}
|
|
153
154
|
return final.push(`${key}: {${buildObjectString(objectString[key])}}`);
|
|
@@ -155,10 +156,3 @@ function buildObjectString(objectString) {
|
|
|
155
156
|
return final;
|
|
156
157
|
}
|
|
157
158
|
exports.buildObjectString = buildObjectString;
|
|
158
|
-
function escapeMablscriptString(unescapedString) {
|
|
159
|
-
return unescapedString
|
|
160
|
-
.replace(/\\/g, '\\\\')
|
|
161
|
-
.replace(/\n/g, '\\n')
|
|
162
|
-
.replace(/"/g, '\\"')
|
|
163
|
-
.replace(/\r/g, '');
|
|
164
|
-
}
|
|
@@ -35,7 +35,7 @@ class ConditionAction extends MablAction_1.MablAction {
|
|
|
35
35
|
return {
|
|
36
36
|
conditionType: ConditionDescriptor_1.ConditionType.Comparison,
|
|
37
37
|
comparisonType: ConditionDescriptor_1.ComparisonType.fromString(this.conditionAttribute),
|
|
38
|
-
comparatorValue: MablAction_1.parseArgument(this.conditionValueAttribute),
|
|
38
|
+
comparatorValue: (0, MablAction_1.parseArgument)(this.conditionValueAttribute),
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
getEvaluatePresence() {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalize = exports.isElementSelector = exports.FindAction = exports.findTypesToFormattedType = void 0;
|
|
4
|
-
const
|
|
4
|
+
const domUtil_1 = require("../../domUtil");
|
|
5
5
|
const MablAction_1 = require("../MablAction");
|
|
6
|
+
const mablscriptFind_1 = require("../../mablscriptFind");
|
|
6
7
|
const MablStep_1 = require("../MablStep");
|
|
7
8
|
exports.findTypesToFormattedType = {
|
|
8
9
|
find_all: 'FindAll',
|
|
@@ -19,14 +20,14 @@ class FindAction extends MablAction_1.MablAction {
|
|
|
19
20
|
constructor(name, args) {
|
|
20
21
|
super(name, args);
|
|
21
22
|
const actionName = this.getActionName();
|
|
22
|
-
if (!
|
|
23
|
+
if (!(0, domUtil_1.isFindType)(actionName)) {
|
|
23
24
|
throw new Error(`Unknown find type for action: ${actionName}`);
|
|
24
25
|
}
|
|
25
|
-
const findType =
|
|
26
|
+
const findType = domUtil_1.FindType.fromString(actionName);
|
|
26
27
|
const [selectors, options] = this.getActionArgs();
|
|
27
28
|
this.isValid = true;
|
|
28
29
|
switch (findType) {
|
|
29
|
-
case
|
|
30
|
+
case domUtil_1.FindType.FIND_ONE:
|
|
30
31
|
if (!isElementSelector(selectors)) {
|
|
31
32
|
this.isValid = false;
|
|
32
33
|
}
|
|
@@ -41,15 +42,15 @@ class FindAction extends MablAction_1.MablAction {
|
|
|
41
42
|
findType,
|
|
42
43
|
findTarget,
|
|
43
44
|
};
|
|
44
|
-
if (
|
|
45
|
+
if ((0, domUtil_1.isFindOptions)(options)) {
|
|
45
46
|
this.findDescriptor.findOptions = options;
|
|
46
47
|
}
|
|
47
48
|
break;
|
|
48
|
-
case
|
|
49
|
-
case
|
|
50
|
-
case
|
|
51
|
-
case
|
|
52
|
-
if (!
|
|
49
|
+
case domUtil_1.FindType.FIND_FIRST:
|
|
50
|
+
case domUtil_1.FindType.FIND_LAST:
|
|
51
|
+
case domUtil_1.FindType.FIND_ANY:
|
|
52
|
+
case domUtil_1.FindType.FIND_ALL:
|
|
53
|
+
if (!(0, domUtil_1.isCssSelector)(selectors) && !(0, domUtil_1.isXPathSelector)(selectors)) {
|
|
53
54
|
this.isValid = false;
|
|
54
55
|
}
|
|
55
56
|
this.findDescriptor = {
|
|
@@ -57,8 +58,8 @@ class FindAction extends MablAction_1.MablAction {
|
|
|
57
58
|
findTarget: selectors,
|
|
58
59
|
};
|
|
59
60
|
break;
|
|
60
|
-
case
|
|
61
|
-
if (!
|
|
61
|
+
case domUtil_1.FindType.FIND_COOKIE:
|
|
62
|
+
if (!(0, domUtil_1.isCookieSelector)(selectors)) {
|
|
62
63
|
this.isValid = false;
|
|
63
64
|
}
|
|
64
65
|
this.findDescriptor = {
|
|
@@ -66,8 +67,8 @@ class FindAction extends MablAction_1.MablAction {
|
|
|
66
67
|
findTarget: selectors,
|
|
67
68
|
};
|
|
68
69
|
break;
|
|
69
|
-
case
|
|
70
|
-
if (!
|
|
70
|
+
case domUtil_1.FindType.FIND_EMAIL:
|
|
71
|
+
if (!(0, domUtil_1.isEmailSelector)(selectors)) {
|
|
71
72
|
this.isValid = false;
|
|
72
73
|
}
|
|
73
74
|
this.findDescriptor = {
|
|
@@ -75,8 +76,8 @@ class FindAction extends MablAction_1.MablAction {
|
|
|
75
76
|
findTarget: selectors,
|
|
76
77
|
};
|
|
77
78
|
break;
|
|
78
|
-
case
|
|
79
|
-
if (selectors !== 'initial' && !
|
|
79
|
+
case domUtil_1.FindType.FIND_TAB:
|
|
80
|
+
if (selectors !== 'initial' && !(0, domUtil_1.isTabSelector)(selectors)) {
|
|
80
81
|
this.isValid = false;
|
|
81
82
|
}
|
|
82
83
|
this.findDescriptor = {
|
|
@@ -119,14 +120,14 @@ class FindAction extends MablAction_1.MablAction {
|
|
|
119
120
|
const result = {};
|
|
120
121
|
const find = this.toDescriptor();
|
|
121
122
|
switch (find.findType) {
|
|
122
|
-
case
|
|
123
|
-
case
|
|
124
|
-
case
|
|
125
|
-
case
|
|
123
|
+
case domUtil_1.FindType.FIND_FIRST:
|
|
124
|
+
case domUtil_1.FindType.FIND_LAST:
|
|
125
|
+
case domUtil_1.FindType.FIND_ANY:
|
|
126
|
+
case domUtil_1.FindType.FIND_ALL:
|
|
126
127
|
result.find_type = find.findType;
|
|
127
128
|
result.selector = find.findTarget;
|
|
128
129
|
break;
|
|
129
|
-
case
|
|
130
|
+
case domUtil_1.FindType.FIND_ONE:
|
|
130
131
|
result.selector = find.findTarget.selector;
|
|
131
132
|
if ((_a = find.findTarget.auxiliaryDescriptors) === null || _a === void 0 ? void 0 : _a.length) {
|
|
132
133
|
result.selectorAncestors = find.findTarget.auxiliaryDescriptors.map((descriptor) => descriptor.selector);
|
|
@@ -139,15 +140,15 @@ class FindAction extends MablAction_1.MablAction {
|
|
|
139
140
|
}
|
|
140
141
|
getSelIdeTarget() {
|
|
141
142
|
switch (this.findDescriptor.findType) {
|
|
142
|
-
case
|
|
143
|
-
case
|
|
144
|
-
case
|
|
145
|
-
case
|
|
146
|
-
if (
|
|
143
|
+
case domUtil_1.FindType.FIND_FIRST:
|
|
144
|
+
case domUtil_1.FindType.FIND_LAST:
|
|
145
|
+
case domUtil_1.FindType.FIND_ANY:
|
|
146
|
+
case domUtil_1.FindType.FIND_ALL:
|
|
147
|
+
if ((0, domUtil_1.isCssSelector)(this.findDescriptor.findTarget)) {
|
|
147
148
|
return `css=${this.findDescriptor.findTarget.css_query}`;
|
|
148
149
|
}
|
|
149
150
|
return `xpath=${this.findDescriptor.findTarget.xpath}`;
|
|
150
|
-
case
|
|
151
|
+
case domUtil_1.FindType.FIND_ONE:
|
|
151
152
|
return `xpath=${this.findDescriptor.findTarget.selector.xpath}`;
|
|
152
153
|
default:
|
|
153
154
|
throw new Error(`Error generating SeleniumIDE target for ${this.getActionName()}: Unimplemented find type ${this.findDescriptor.findType}`);
|
|
@@ -159,38 +160,39 @@ class FindAction extends MablAction_1.MablAction {
|
|
|
159
160
|
generateMablscriptFindOne() {
|
|
160
161
|
var _a;
|
|
161
162
|
switch (this.findDescriptor.findType) {
|
|
162
|
-
case
|
|
163
|
+
case domUtil_1.FindType.FIND_ONE: {
|
|
163
164
|
const find = this.findDescriptor;
|
|
164
165
|
const action = find.findType;
|
|
165
|
-
const selectors = ((_a = find.findTarget.auxiliaryDescriptors) === null || _a === void 0 ? void 0 : _a.length)
|
|
166
|
-
[
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
166
|
+
const selectors = ((_a = find.findTarget.auxiliaryDescriptors) === null || _a === void 0 ? void 0 : _a.length)
|
|
167
|
+
? '[' +
|
|
168
|
+
[
|
|
169
|
+
find.findTarget.selector,
|
|
170
|
+
...find.findTarget.auxiliaryDescriptors.map((descriptor) => descriptor.selector),
|
|
171
|
+
]
|
|
172
|
+
.map(mablscriptFind_1.buildElementSelectorString)
|
|
173
|
+
.join(', ') +
|
|
174
|
+
']'
|
|
175
|
+
: (0, mablscriptFind_1.buildElementSelectorString)(find.findTarget.selector);
|
|
174
176
|
const options = buildFindOptionsString(find.findOptions);
|
|
175
177
|
const args = [selectors, options].filter((str) => str).join(', ');
|
|
176
178
|
return `${action}(${args})`;
|
|
177
179
|
}
|
|
178
|
-
case
|
|
179
|
-
case
|
|
180
|
-
case
|
|
181
|
-
case
|
|
182
|
-
case
|
|
183
|
-
case
|
|
180
|
+
case domUtil_1.FindType.FIND_FIRST:
|
|
181
|
+
case domUtil_1.FindType.FIND_LAST:
|
|
182
|
+
case domUtil_1.FindType.FIND_ANY:
|
|
183
|
+
case domUtil_1.FindType.FIND_ALL:
|
|
184
|
+
case domUtil_1.FindType.FIND_COOKIE:
|
|
185
|
+
case domUtil_1.FindType.FIND_EMAIL: {
|
|
184
186
|
const find = this.findDescriptor;
|
|
185
187
|
const action = find.findType;
|
|
186
|
-
const args = buildElementSelectorString(find.findTarget);
|
|
188
|
+
const args = (0, mablscriptFind_1.buildElementSelectorString)(find.findTarget);
|
|
187
189
|
return `${action}(${args})`;
|
|
188
190
|
}
|
|
189
|
-
case
|
|
191
|
+
case domUtil_1.FindType.FIND_TAB:
|
|
190
192
|
if (this.findDescriptor.findTarget === 'initial') {
|
|
191
193
|
return `${this.findDescriptor.findType}("${this.findDescriptor.findTarget}")`;
|
|
192
194
|
}
|
|
193
|
-
return `${this.findDescriptor.findType}(${buildElementSelectorString(this.findDescriptor.findTarget)})`;
|
|
195
|
+
return `${this.findDescriptor.findType}(${(0, mablscriptFind_1.buildElementSelectorString)(this.findDescriptor.findTarget)})`;
|
|
194
196
|
default:
|
|
195
197
|
throw new Error(`Error generating mablscript: Unexpected find type in ${JSON.stringify(this.findDescriptor)}`);
|
|
196
198
|
}
|
|
@@ -226,35 +228,27 @@ function buildFindOptionsString(findOptions) {
|
|
|
226
228
|
}
|
|
227
229
|
let findOptionsFinal = '{';
|
|
228
230
|
if (findOptions.hints) {
|
|
229
|
-
findOptionsFinal += `hints: {${MablStep_1.buildObjectString(findOptions.hints).join(', ')}}`;
|
|
231
|
+
findOptionsFinal += `hints: {${(0, MablStep_1.buildObjectString)(findOptions.hints).join(', ')}}`;
|
|
230
232
|
}
|
|
231
233
|
if (findOptions.waitUntil) {
|
|
232
|
-
findOptionsFinal += `waitUntil: {${MablStep_1.buildObjectString(findOptions.waitUntil)}}`;
|
|
234
|
+
findOptionsFinal += `waitUntil: {${(0, MablStep_1.buildObjectString)(findOptions.waitUntil)}}`;
|
|
233
235
|
}
|
|
234
236
|
findOptionsFinal += '}';
|
|
235
237
|
return findOptionsFinal;
|
|
236
238
|
}
|
|
237
|
-
function buildElementSelectorString(selectorObject) {
|
|
238
|
-
const findInfoList = MablStep_1.buildObjectString(selectorObject);
|
|
239
|
-
if (!findInfoList.find((info) => info.includes('selector_type'))) {
|
|
240
|
-
findInfoList.push('selector_type: "element"');
|
|
241
|
-
}
|
|
242
|
-
findInfoList.sort();
|
|
243
|
-
return `{${findInfoList.join(', ')}}`;
|
|
244
|
-
}
|
|
245
239
|
function isElementSelector(maybeSelectors) {
|
|
246
240
|
const [target, ancestor] = Array.isArray(maybeSelectors)
|
|
247
241
|
? [...maybeSelectors]
|
|
248
242
|
: [maybeSelectors];
|
|
249
|
-
const validTarget =
|
|
243
|
+
const validTarget = (0, domUtil_1.isStandardSelector)(target) || (0, domUtil_1.isNormalizedFindDescriptor)(target);
|
|
250
244
|
const validAncestor = !ancestor ||
|
|
251
|
-
|
|
252
|
-
|
|
245
|
+
(0, domUtil_1.isStandardSelector)(ancestor) ||
|
|
246
|
+
(0, domUtil_1.isNormalizedFindDescriptor)(ancestor);
|
|
253
247
|
return !!(validTarget && validAncestor);
|
|
254
248
|
}
|
|
255
249
|
exports.isElementSelector = isElementSelector;
|
|
256
250
|
function normalize(maybeFindDescriptor) {
|
|
257
|
-
if (
|
|
251
|
+
if ((0, domUtil_1.isNormalizedFindDescriptor)(maybeFindDescriptor)) {
|
|
258
252
|
return { ...maybeFindDescriptor };
|
|
259
253
|
}
|
|
260
254
|
return { selector: maybeFindDescriptor };
|
|
@@ -11,7 +11,7 @@ class GetUrlAction extends MablAction_1.MablAction {
|
|
|
11
11
|
return `get_current_location()`;
|
|
12
12
|
}
|
|
13
13
|
toDescriptor() {
|
|
14
|
-
return GetCurrentLocationDescriptor_1.newGetCurrentLocationDescriptor();
|
|
14
|
+
return (0, GetCurrentLocationDescriptor_1.newGetCurrentLocationDescriptor)();
|
|
15
15
|
}
|
|
16
16
|
generateMablscriptFindOne() {
|
|
17
17
|
return 'get_current_location()';
|
|
@@ -17,7 +17,7 @@ class GetVariableValue extends MablAction_1.MablAction {
|
|
|
17
17
|
return `get_variable_value(${this.subVariable(this.variable.toString())})`;
|
|
18
18
|
}
|
|
19
19
|
toDescriptor() {
|
|
20
|
-
return GetVariableDescriptor_1.newGetVariableDescriptor(this.variable);
|
|
20
|
+
return (0, GetVariableDescriptor_1.newGetVariableDescriptor)(this.variable);
|
|
21
21
|
}
|
|
22
22
|
generateMablscriptFindOne() {
|
|
23
23
|
return `get_variable_value(${this.variable.name})`;
|
|
@@ -75,7 +75,7 @@ class JavaScriptAction extends MablAction_1.MablAction {
|
|
|
75
75
|
}
|
|
76
76
|
static fromDescriptor(descriptor) {
|
|
77
77
|
const { javaScript } = descriptor;
|
|
78
|
-
if (JavaScriptDescriptor_1.isReusableSnippetDescriptor(javaScript)) {
|
|
78
|
+
if ((0, JavaScriptDescriptor_1.isReusableSnippetDescriptor)(javaScript)) {
|
|
79
79
|
return new JavaScriptAction(JavaScriptAction.mablscriptName, [
|
|
80
80
|
{
|
|
81
81
|
id: javaScript.snippetId,
|
|
@@ -84,20 +84,20 @@ class JavaScriptAction extends MablAction_1.MablAction {
|
|
|
84
84
|
{ parameter_overrides: javaScript.parameterOverrides },
|
|
85
85
|
]);
|
|
86
86
|
}
|
|
87
|
-
else if (JavaScriptDescriptor_1.isInlineSnippetDescriptor(javaScript)) {
|
|
87
|
+
else if ((0, JavaScriptDescriptor_1.isInlineSnippetDescriptor)(javaScript)) {
|
|
88
88
|
return new JavaScriptAction(JavaScriptAction.mablscriptName, [
|
|
89
89
|
javaScript.inlineSnippet,
|
|
90
90
|
{ parameter_overrides: javaScript.parameterOverrides },
|
|
91
91
|
]);
|
|
92
92
|
}
|
|
93
|
-
else if (JavaScriptDescriptor_1.isLegacyReusableSnippetDescriptor(javaScript)) {
|
|
93
|
+
else if ((0, JavaScriptDescriptor_1.isLegacyReusableSnippetDescriptor)(javaScript)) {
|
|
94
94
|
return new JavaScriptAction(JavaScriptAction.mablscriptName, [
|
|
95
95
|
{
|
|
96
96
|
id: javaScript.snippetInvariantId,
|
|
97
97
|
},
|
|
98
98
|
]);
|
|
99
99
|
}
|
|
100
|
-
else if (JavaScriptDescriptor_1.isLegacyInlineJavaScriptDescriptor(javaScript)) {
|
|
100
|
+
else if ((0, JavaScriptDescriptor_1.isLegacyInlineJavaScriptDescriptor)(javaScript)) {
|
|
101
101
|
return new JavaScriptAction(JavaScriptAction.mablscriptName, [
|
|
102
102
|
javaScript.encodedJS,
|
|
103
103
|
]);
|
|
@@ -106,19 +106,19 @@ class JavaScriptAction extends MablAction_1.MablAction {
|
|
|
106
106
|
}
|
|
107
107
|
toYaml() {
|
|
108
108
|
const actionYaml = {};
|
|
109
|
-
if (JavaScriptDescriptor_1.isReusableSnippetDescriptor(this.javaScript)) {
|
|
109
|
+
if ((0, JavaScriptDescriptor_1.isReusableSnippetDescriptor)(this.javaScript)) {
|
|
110
110
|
actionYaml.snippetId = this.javaScript.snippetId;
|
|
111
111
|
actionYaml.snippetInvariantId = this.javaScript.snippetInvariantId;
|
|
112
112
|
actionYaml.parameterOverrides = this.javaScript.parameterOverrides;
|
|
113
113
|
}
|
|
114
|
-
else if (JavaScriptDescriptor_1.isInlineSnippetDescriptor(this.javaScript)) {
|
|
114
|
+
else if ((0, JavaScriptDescriptor_1.isInlineSnippetDescriptor)(this.javaScript)) {
|
|
115
115
|
actionYaml.snippet = this.javaScript.inlineSnippet;
|
|
116
116
|
actionYaml.parameterOverrides = this.javaScript.parameterOverrides;
|
|
117
117
|
}
|
|
118
|
-
else if (JavaScriptDescriptor_1.isLegacyReusableSnippetDescriptor(this.javaScript)) {
|
|
118
|
+
else if ((0, JavaScriptDescriptor_1.isLegacyReusableSnippetDescriptor)(this.javaScript)) {
|
|
119
119
|
actionYaml.snippetId = this.javaScript.snippetInvariantId;
|
|
120
120
|
}
|
|
121
|
-
else if (JavaScriptDescriptor_1.isLegacyInlineJavaScriptDescriptor(this.javaScript)) {
|
|
121
|
+
else if ((0, JavaScriptDescriptor_1.isLegacyInlineJavaScriptDescriptor)(this.javaScript)) {
|
|
122
122
|
actionYaml.code = this.javaScript.encodedJS;
|
|
123
123
|
}
|
|
124
124
|
else {
|
|
@@ -160,27 +160,27 @@ class JavaScriptAction extends MablAction_1.MablAction {
|
|
|
160
160
|
return new JavaScriptAction(MABLSCRIPT_NAME, args);
|
|
161
161
|
}
|
|
162
162
|
toMablscript() {
|
|
163
|
-
if (JavaScriptDescriptor_1.isReusableSnippetDescriptor(this.javaScript)) {
|
|
164
|
-
const snippetReference = domUtil_1.buildStepArgumentString({
|
|
163
|
+
if ((0, JavaScriptDescriptor_1.isReusableSnippetDescriptor)(this.javaScript)) {
|
|
164
|
+
const snippetReference = (0, domUtil_1.buildStepArgumentString)({
|
|
165
165
|
id: this.javaScript.snippetId,
|
|
166
166
|
invariant_id: this.javaScript.snippetInvariantId,
|
|
167
167
|
snippet_type: 'javascript',
|
|
168
168
|
});
|
|
169
|
-
const snippetOptions = `, {parameter_overrides: ${domUtil_1.buildStepArgumentString(this.javaScript.parameterOverrides)}}`;
|
|
169
|
+
const snippetOptions = `, {parameter_overrides: ${(0, domUtil_1.buildStepArgumentString)(this.javaScript.parameterOverrides)}}`;
|
|
170
170
|
return `evaluate_js(${snippetReference}${snippetOptions})`;
|
|
171
171
|
}
|
|
172
|
-
if (JavaScriptDescriptor_1.isInlineSnippetDescriptor(this.javaScript)) {
|
|
173
|
-
const snippetReference = domUtil_1.buildStepArgumentString({
|
|
172
|
+
if ((0, JavaScriptDescriptor_1.isInlineSnippetDescriptor)(this.javaScript)) {
|
|
173
|
+
const snippetReference = (0, domUtil_1.buildStepArgumentString)({
|
|
174
174
|
...this.javaScript.inlineSnippet,
|
|
175
175
|
snippet_type: 'javascript',
|
|
176
176
|
});
|
|
177
|
-
const snippetOptions = `, {parameter_overrides: ${domUtil_1.buildStepArgumentString(this.javaScript.parameterOverrides)}}`;
|
|
177
|
+
const snippetOptions = `, {parameter_overrides: ${(0, domUtil_1.buildStepArgumentString)(this.javaScript.parameterOverrides)}}`;
|
|
178
178
|
return `evaluate_js(${snippetReference}${snippetOptions})`;
|
|
179
179
|
}
|
|
180
|
-
if (JavaScriptDescriptor_1.isLegacyReusableSnippetDescriptor(this.javaScript)) {
|
|
180
|
+
if ((0, JavaScriptDescriptor_1.isLegacyReusableSnippetDescriptor)(this.javaScript)) {
|
|
181
181
|
return `evaluate_js({id: "${this.javaScript.snippetInvariantId}", snippet_type: "javascript"})`;
|
|
182
182
|
}
|
|
183
|
-
if (JavaScriptDescriptor_1.isLegacyInlineJavaScriptDescriptor(this.javaScript)) {
|
|
183
|
+
if ((0, JavaScriptDescriptor_1.isLegacyInlineJavaScriptDescriptor)(this.javaScript)) {
|
|
184
184
|
return `evaluate_js("${this.javaScript.encodedJS}")`;
|
|
185
185
|
}
|
|
186
186
|
throw new Error(`Cannot export action to mablscript: ${JSON.stringify(this.javaScript)}`);
|
package/mablscript/importer.js
CHANGED
|
@@ -99,10 +99,10 @@ const StepTypes = [
|
|
|
99
99
|
WaitStep_1.WaitStep,
|
|
100
100
|
];
|
|
101
101
|
function parseMablScript(mablscript) {
|
|
102
|
-
const ast = esprima_1.parseScript(mablscript, { loc: true });
|
|
102
|
+
const ast = (0, esprima_1.parseScript)(mablscript, { loc: true });
|
|
103
103
|
const stepStack = {};
|
|
104
104
|
let stepLine = 0;
|
|
105
|
-
estraverse_1.traverse(ast, {
|
|
105
|
+
(0, estraverse_1.traverse)(ast, {
|
|
106
106
|
enter(node) {
|
|
107
107
|
switch (node.type) {
|
|
108
108
|
case 'ExpressionStatement':
|
|
@@ -161,7 +161,7 @@ function loadMablScriptIntoSteps(parsedMablscript) {
|
|
|
161
161
|
exports.loadMablScriptIntoSteps = loadMablScriptIntoSteps;
|
|
162
162
|
function yamlifyTheLoadedSteps(translatedSteps, fullLocatorsOn = true) {
|
|
163
163
|
const steps = translatedSteps.map((step) => step.getFormattedStep(fullLocatorsOn));
|
|
164
|
-
return js_yaml_1.dump(steps);
|
|
164
|
+
return (0, js_yaml_1.dump)(steps);
|
|
165
165
|
}
|
|
166
166
|
exports.yamlifyTheLoadedSteps = yamlifyTheLoadedSteps;
|
|
167
167
|
const yamlMablscriptToObjectsStepMap = {};
|
|
@@ -169,7 +169,7 @@ StepTypes.forEach((step) => {
|
|
|
169
169
|
step.yamlMablScriptNames.forEach((name) => (yamlMablscriptToObjectsStepMap[name] = step.fromYaml));
|
|
170
170
|
});
|
|
171
171
|
function loadYamlSteps(yamlSteps) {
|
|
172
|
-
const loadedStepData = js_yaml_1.safeLoad(yamlSteps);
|
|
172
|
+
const loadedStepData = (0, js_yaml_1.safeLoad)(yamlSteps);
|
|
173
173
|
return loadedStepData.map((stepObject) => {
|
|
174
174
|
const stepName = Object.keys(stepObject)[0];
|
|
175
175
|
const stepArgs = stepObject[stepName];
|
|
@@ -239,19 +239,19 @@ function getArgumentsFromCallExpressionArgs(expressionArguments) {
|
|
|
239
239
|
break;
|
|
240
240
|
case 'Identifier':
|
|
241
241
|
const singleIdentifier = expressionArg;
|
|
242
|
-
expressionArgs.push(MablSymbol_1.formatSymbol(singleIdentifier.name));
|
|
242
|
+
expressionArgs.push((0, MablSymbol_1.formatSymbol)(singleIdentifier.name));
|
|
243
243
|
break;
|
|
244
244
|
case 'MemberExpression':
|
|
245
245
|
const memberExpression = expressionArg;
|
|
246
246
|
if (expressionArg.object.type === 'MemberExpression') {
|
|
247
247
|
const chainedVariableExpression = memberExpressionChainBuilder(memberExpression);
|
|
248
248
|
const property = memberExpression.property;
|
|
249
|
-
expressionArgs.push(MablSymbol_1.formatSymbol(`${chainedVariableExpression}.${property.name}`));
|
|
249
|
+
expressionArgs.push((0, MablSymbol_1.formatSymbol)(`${chainedVariableExpression}.${property.name}`));
|
|
250
250
|
}
|
|
251
251
|
else {
|
|
252
252
|
const identifier = memberExpression.object;
|
|
253
253
|
const property = memberExpression.property;
|
|
254
|
-
expressionArgs.push(MablSymbol_1.formatSymbol(`${identifier.name}.${property.name}`));
|
|
254
|
+
expressionArgs.push((0, MablSymbol_1.formatSymbol)(`${identifier.name}.${property.name}`));
|
|
255
255
|
}
|
|
256
256
|
break;
|
|
257
257
|
case 'ObjectExpression':
|
|
@@ -4,7 +4,7 @@ exports.AccessibilityCheckStep = exports.AccessibilityCheckSeverity = void 0;
|
|
|
4
4
|
const MablStep_1 = require("../MablStep");
|
|
5
5
|
const FindAction_1 = require("../actions/FindAction");
|
|
6
6
|
const ActionsUtils_1 = require("./ActionsUtils");
|
|
7
|
-
const
|
|
7
|
+
const domUtil_1 = require("../../domUtil");
|
|
8
8
|
var AccessibilityCheckSeverity;
|
|
9
9
|
(function (AccessibilityCheckSeverity) {
|
|
10
10
|
AccessibilityCheckSeverity["Critical"] = "critical";
|
|
@@ -32,10 +32,10 @@ class AccessibilityCheckStep extends MablStep_1.MablStep {
|
|
|
32
32
|
if (this.findAction) {
|
|
33
33
|
const find = this.findAction.toDescriptor();
|
|
34
34
|
switch (find.findType) {
|
|
35
|
-
case
|
|
36
|
-
case
|
|
37
|
-
case
|
|
38
|
-
case
|
|
35
|
+
case domUtil_1.FindType.FIND_FIRST:
|
|
36
|
+
case domUtil_1.FindType.FIND_LAST:
|
|
37
|
+
case domUtil_1.FindType.FIND_ANY:
|
|
38
|
+
case domUtil_1.FindType.FIND_ONE:
|
|
39
39
|
return {
|
|
40
40
|
...this.checkConfig,
|
|
41
41
|
find,
|
|
@@ -85,8 +85,10 @@ class AccessibilityCheckStep extends MablStep_1.MablStep {
|
|
|
85
85
|
toMablscript() {
|
|
86
86
|
var _a, _b, _c;
|
|
87
87
|
let argString = '';
|
|
88
|
-
if (((_a = this.checkConfig) === null || _a === void 0 ? void 0 : _a.tags) ||
|
|
89
|
-
|
|
88
|
+
if (((_a = this.checkConfig) === null || _a === void 0 ? void 0 : _a.tags) ||
|
|
89
|
+
((_b = this.checkConfig) === null || _b === void 0 ? void 0 : _b.disabledRules) ||
|
|
90
|
+
((_c = this.checkConfig) === null || _c === void 0 ? void 0 : _c.rules)) {
|
|
91
|
+
argString = `{${(0, MablStep_1.buildObjectString)(this.checkConfig)}}`;
|
|
90
92
|
}
|
|
91
93
|
let findAction = '';
|
|
92
94
|
if (this.findAction) {
|
|
@@ -6,7 +6,7 @@ const SeleniumIdeStep_1 = require("./SeleniumIdeStep");
|
|
|
6
6
|
const FindAction_1 = require("../actions/FindAction");
|
|
7
7
|
const MablStep_1 = require("../MablStep");
|
|
8
8
|
const ExtractAction_1 = require("../actions/ExtractAction");
|
|
9
|
-
const
|
|
9
|
+
const domUtil_1 = require("../../domUtil");
|
|
10
10
|
const GetUrlAction_1 = require("../actions/GetUrlAction");
|
|
11
11
|
const GetCurrentLocationDescriptor_1 = require("../types/GetCurrentLocationDescriptor");
|
|
12
12
|
const GetVariableValue_1 = require("../actions/GetVariableValue");
|
|
@@ -78,7 +78,7 @@ class AssertStep extends MablStep_1.MablStep {
|
|
|
78
78
|
determineIfWaitUntilStep() {
|
|
79
79
|
var _a, _b;
|
|
80
80
|
const find = this.primaryAction.toDescriptor();
|
|
81
|
-
if (
|
|
81
|
+
if ((0, domUtil_1.isFindElementDescriptor)(find)) {
|
|
82
82
|
if ((_b = (_a = find.findOptions) === null || _a === void 0 ? void 0 : _a.waitUntil) === null || _b === void 0 ? void 0 : _b.timeoutSeconds) {
|
|
83
83
|
return true;
|
|
84
84
|
}
|
|
@@ -129,23 +129,23 @@ class AssertStep extends MablStep_1.MablStep {
|
|
|
129
129
|
formatted.assertionValue = this.assertionValue;
|
|
130
130
|
}
|
|
131
131
|
const find = this.primaryAction.toDescriptor();
|
|
132
|
-
if (GetCurrentLocationDescriptor_1.isGetCurrentLocationDescriptor(find) || GetVariableDescriptor_1.isGetVariableDescriptor(find)) {
|
|
132
|
+
if ((0, GetCurrentLocationDescriptor_1.isGetCurrentLocationDescriptor)(find) || (0, GetVariableDescriptor_1.isGetVariableDescriptor)(find)) {
|
|
133
133
|
}
|
|
134
134
|
else {
|
|
135
135
|
switch (find.findType) {
|
|
136
|
-
case
|
|
137
|
-
case
|
|
136
|
+
case domUtil_1.FindType.FIND_COOKIE:
|
|
137
|
+
case domUtil_1.FindType.FIND_EMAIL:
|
|
138
138
|
formatted.findType = FindAction_1.findTypesToFormattedType[find.findType];
|
|
139
139
|
formatted.selector = find.findTarget;
|
|
140
140
|
break;
|
|
141
|
-
case
|
|
142
|
-
case
|
|
143
|
-
case
|
|
144
|
-
case
|
|
141
|
+
case domUtil_1.FindType.FIND_FIRST:
|
|
142
|
+
case domUtil_1.FindType.FIND_LAST:
|
|
143
|
+
case domUtil_1.FindType.FIND_ANY:
|
|
144
|
+
case domUtil_1.FindType.FIND_ALL:
|
|
145
145
|
formatted.findType = FindAction_1.findTypesToFormattedType[find.findType];
|
|
146
146
|
formatted.selector = find.findTarget;
|
|
147
147
|
break;
|
|
148
|
-
case
|
|
148
|
+
case domUtil_1.FindType.FIND_ONE:
|
|
149
149
|
formatted.selector = find.findTarget.selector;
|
|
150
150
|
if (find.findOptions) {
|
|
151
151
|
formatted.findOptions = find.findOptions;
|
|
@@ -185,10 +185,10 @@ class AssertStep extends MablStep_1.MablStep {
|
|
|
185
185
|
}
|
|
186
186
|
produceSelIdeFormattedSteps(stepIndex) {
|
|
187
187
|
const find = this.primaryAction.toDescriptor();
|
|
188
|
-
if (!GetCurrentLocationDescriptor_1.isGetCurrentLocationDescriptor(find) &&
|
|
189
|
-
!GetVariableDescriptor_1.isGetVariableDescriptor(find) &&
|
|
190
|
-
(find.findType ===
|
|
191
|
-
find.findType ===
|
|
188
|
+
if (!(0, GetCurrentLocationDescriptor_1.isGetCurrentLocationDescriptor)(find) &&
|
|
189
|
+
!(0, GetVariableDescriptor_1.isGetVariableDescriptor)(find) &&
|
|
190
|
+
(find.findType === domUtil_1.FindType.FIND_EMAIL ||
|
|
191
|
+
find.findType === domUtil_1.FindType.FIND_COOKIE)) {
|
|
192
192
|
return [this.unsupportedSelIdeExportStep()];
|
|
193
193
|
}
|
|
194
194
|
if (this.assertionType === 'present') {
|
|
@@ -198,7 +198,7 @@ class AssertStep extends MablStep_1.MablStep {
|
|
|
198
198
|
if (this.primaryAction instanceof GetVariableValue_1.GetVariableValue) {
|
|
199
199
|
throw new Error('Invalid state. You cannot assert presence against variable properties.');
|
|
200
200
|
}
|
|
201
|
-
const assertPresentStep = SeleniumIdeStep_1.buildSeleniumIdeStep('assertElementPresent', this);
|
|
201
|
+
const assertPresentStep = (0, SeleniumIdeStep_1.buildSeleniumIdeStep)('assertElementPresent', this);
|
|
202
202
|
assertPresentStep.target = this.primaryAction.getSelIdeTarget();
|
|
203
203
|
return [assertPresentStep];
|
|
204
204
|
}
|
|
@@ -209,21 +209,21 @@ class AssertStep extends MablStep_1.MablStep {
|
|
|
209
209
|
if (this.primaryAction instanceof GetVariableValue_1.GetVariableValue) {
|
|
210
210
|
throw new Error('Invalid state. You cannot assert presence against variable properties.');
|
|
211
211
|
}
|
|
212
|
-
const assertNotPresentStep = SeleniumIdeStep_1.buildSeleniumIdeStep('assertElementNotPresent', this);
|
|
212
|
+
const assertNotPresentStep = (0, SeleniumIdeStep_1.buildSeleniumIdeStep)('assertElementNotPresent', this);
|
|
213
213
|
assertNotPresentStep.target = this.primaryAction.getSelIdeTarget();
|
|
214
214
|
return [assertNotPresentStep];
|
|
215
215
|
}
|
|
216
|
-
return buildSeleniumIdeJsAssertion(stepIndex, (!GetCurrentLocationDescriptor_1.isGetCurrentLocationDescriptor(find) &&
|
|
217
|
-
!GetVariableDescriptor_1.isGetVariableDescriptor(find) &&
|
|
218
|
-
find.findType ===
|
|
216
|
+
return buildSeleniumIdeJsAssertion(stepIndex, (!(0, GetCurrentLocationDescriptor_1.isGetCurrentLocationDescriptor)(find) &&
|
|
217
|
+
!(0, GetVariableDescriptor_1.isGetVariableDescriptor)(find) &&
|
|
218
|
+
find.findType === domUtil_1.FindType.FIND_ONE &&
|
|
219
219
|
find.findTarget.selector.xpath) ||
|
|
220
220
|
'', this.extractAction ? this.extractAction.extractionAttribute : '', this.substituteSeleniumVariable(this.conditionAction.conditionValueAttribute || ''), this.assertionType, this);
|
|
221
221
|
}
|
|
222
222
|
unsupportedSelIdeExportStep() {
|
|
223
|
-
const seleniumStep = SeleniumIdeStep_1.buildSeleniumIdeStep('echo', this);
|
|
223
|
+
const seleniumStep = (0, SeleniumIdeStep_1.buildSeleniumIdeStep)('echo', this);
|
|
224
224
|
const findDescriptor = this.primaryAction.toDescriptor();
|
|
225
|
-
seleniumStep.value = `[${this.getStepName()}] step with find type [${FindAction_1.findTypesToFormattedType[(!GetCurrentLocationDescriptor_1.isGetCurrentLocationDescriptor(findDescriptor) &&
|
|
226
|
-
!GetVariableDescriptor_1.isGetVariableDescriptor(findDescriptor) &&
|
|
225
|
+
seleniumStep.value = `[${this.getStepName()}] step with find type [${FindAction_1.findTypesToFormattedType[(!(0, GetCurrentLocationDescriptor_1.isGetCurrentLocationDescriptor)(findDescriptor) &&
|
|
226
|
+
!(0, GetVariableDescriptor_1.isGetVariableDescriptor)(findDescriptor) &&
|
|
227
227
|
findDescriptor.findType) ||
|
|
228
228
|
'unknown']} is not supported for Selenium IDE export`;
|
|
229
229
|
return seleniumStep;
|
|
@@ -253,11 +253,11 @@ function buildSeleniumIdeJsAssertion(stepIndex, xpath, assertionAttribute, asser
|
|
|
253
253
|
const variableName = `assertVariable-${stepIndex}`;
|
|
254
254
|
let storeAttribute;
|
|
255
255
|
if (assertionAttribute !== 'innerText') {
|
|
256
|
-
storeAttribute = SeleniumIdeStep_1.buildSeleniumIdeStep('executeScript', step);
|
|
256
|
+
storeAttribute = (0, SeleniumIdeStep_1.buildSeleniumIdeStep)('executeScript', step);
|
|
257
257
|
storeAttribute.target = `return document.evaluate('${xpath}', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue['${assertionAttribute}']`;
|
|
258
258
|
}
|
|
259
259
|
else {
|
|
260
|
-
storeAttribute = SeleniumIdeStep_1.buildSeleniumIdeStep('storeText', step);
|
|
260
|
+
storeAttribute = (0, SeleniumIdeStep_1.buildSeleniumIdeStep)('storeText', step);
|
|
261
261
|
storeAttribute.target = `xpath=${xpath}`;
|
|
262
262
|
}
|
|
263
263
|
storeAttribute.value = variableName;
|
|
@@ -300,10 +300,10 @@ function buildSeleniumIdeJsAssertion(stepIndex, xpath, assertionAttribute, asser
|
|
|
300
300
|
condition = `!\${${variableName}} <= '${assertAgainst}'`;
|
|
301
301
|
break;
|
|
302
302
|
}
|
|
303
|
-
const ifStep = SeleniumIdeStep_1.buildSeleniumIdeStep('if', step);
|
|
303
|
+
const ifStep = (0, SeleniumIdeStep_1.buildSeleniumIdeStep)('if', step);
|
|
304
304
|
ifStep.target = condition;
|
|
305
|
-
const throwError = SeleniumIdeStep_1.buildSeleniumIdeStep('executeScript', step);
|
|
305
|
+
const throwError = (0, SeleniumIdeStep_1.buildSeleniumIdeStep)('executeScript', step);
|
|
306
306
|
throwError.target = `throw new Error('${exports.fieldToAssertionStep[assertionType]} step failure')`;
|
|
307
|
-
const endStep = SeleniumIdeStep_1.buildSeleniumIdeStep('end', step);
|
|
307
|
+
const endStep = (0, SeleniumIdeStep_1.buildSeleniumIdeStep)('end', step);
|
|
308
308
|
return [storeAttribute, ifStep, throwError, endStep];
|
|
309
309
|
}
|