@mablhq/mabl-cli 1.62.1 → 2.1.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/api/basicApiClient.js +10 -10
- package/api/mablApiClient.js +39 -1
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +6 -6
- package/cli.js +1 -0
- package/commands/app-files/app-files.js +5 -0
- package/commands/app-files/app-files_cmds/create.js +98 -0
- package/commands/app-files/app-files_cmds/delete.js +31 -0
- package/commands/app-files/app-files_cmds/download.js +50 -0
- package/commands/app-files/app-files_cmds/list.js +72 -0
- package/commands/config/config_cmds/install.js +92 -0
- package/commands/constants.js +9 -2
- package/commands/tests/testsUtil.js +9 -1
- package/commands/tests/tests_cmds/run-mobile.js +218 -0
- package/commands/tests/tests_cmds/run.js +1 -1
- package/core/util.js +36 -2
- package/env/defaultEnv.js +2 -1
- package/env/dev.js +2 -1
- package/env/env.js +3 -1
- package/env/local.js +2 -1
- package/env/prod.js +2 -1
- package/execution/index.js +13 -1
- package/execution/runAppiumServer.js +133 -0
- package/http/MablHttpAgent.js +1 -4
- package/http/RequestFilteringHttpAgent.js +3 -3
- package/http/axiosProxyConfig.js +10 -7
- package/http/httpUtil.js +10 -6
- package/index.js +3 -2
- package/mablApi/index.js +1 -1
- package/mablscript/MablAction.js +6 -2
- package/mablscript/MablStep.js +41 -5
- package/mablscript/MablStepV2.js +57 -0
- package/mablscript/MablSymbol.js +6 -2
- package/mablscript/actions/AwaitDownloadAction.js +1 -1
- package/mablscript/actions/ConditionAction.js +1 -1
- package/mablscript/actions/CountAction.js +1 -1
- package/mablscript/actions/ExtractAction.js +12 -7
- package/mablscript/actions/FindAction.js +6 -6
- package/mablscript/actions/GenerateEmailAddressAction.js +1 -1
- package/mablscript/actions/GenerateRandomStringAction.js +1 -1
- package/mablscript/actions/GetUrlAction.js +1 -1
- package/mablscript/actions/GetVariableValue.js +1 -1
- package/mablscript/actions/JavaScriptAction.js +25 -14
- package/mablscript/importer.js +99 -16
- package/mablscript/mobile/steps/CreateVariableMobileStep.js +53 -0
- package/mablscript/mobile/steps/EnterTextStep.js +41 -0
- package/mablscript/mobile/steps/NavigateBackStep.js +20 -0
- package/mablscript/mobile/steps/NavigateHomeStep.js +21 -0
- package/mablscript/mobile/steps/ScrollStep.js +37 -0
- package/mablscript/mobile/steps/SetOrientationStep.js +20 -0
- package/mablscript/mobile/steps/TapStep.js +37 -0
- package/mablscript/mobile/steps/actions/MobileFindAction.js +23 -0
- package/mablscript/mobile/steps/stepUtil.js +74 -0
- package/mablscript/mobile/tests/StepTestsUtil.js +20 -0
- package/mablscript/mobile/tests/TestMobileFindDescriptors.js +215 -0
- package/mablscript/mobile/tests/steps/CreateVariableMobileStep.mobiletest.js +298 -0
- package/mablscript/mobile/tests/steps/EnterTextStep.mobiletest.js +79 -0
- package/mablscript/mobile/tests/steps/GeneralHumanization.mobiletest.js +167 -0
- package/mablscript/mobile/tests/steps/NavigateBackStep.mobiletest.js +27 -0
- package/mablscript/mobile/tests/steps/NavigateHomeStep.mobiletest.js +27 -0
- package/mablscript/mobile/tests/steps/ScrollStep.mobiletest.js +121 -0
- package/mablscript/mobile/tests/steps/SetOrientationStep.mobiletest.js +32 -0
- package/mablscript/mobile/tests/steps/TapStep.mobiletest.js +57 -0
- package/mablscript/steps/AccessibilityCheck.js +20 -9
- package/mablscript/steps/AssertStep.js +54 -39
- package/mablscript/steps/AssertStepOld.js +35 -4
- package/mablscript/steps/AwaitTabStep.js +5 -2
- package/mablscript/steps/AwaitUploadsStep.js +6 -4
- package/mablscript/steps/ClearCookiesStep.js +6 -4
- package/mablscript/steps/ClickAndHoldStep.js +10 -3
- package/mablscript/steps/ClickStep.js +10 -3
- package/mablscript/steps/CreateVariableStep.js +25 -8
- package/mablscript/steps/DoubleClickStep.js +10 -3
- package/mablscript/steps/DownloadStep.js +4 -2
- package/mablscript/steps/EchoStep.js +8 -5
- package/mablscript/steps/ElseIfConditionStep.js +14 -4
- package/mablscript/steps/ElseStep.js +8 -5
- package/mablscript/steps/EndStep.js +8 -5
- package/mablscript/steps/EnterAuthCodeStep.js +10 -3
- package/mablscript/steps/EnterTextStep.js +8 -2
- package/mablscript/steps/EvaluateFlowStep.js +5 -2
- package/mablscript/steps/EvaluateJavaScriptStep.js +15 -4
- package/mablscript/steps/HoverStep.js +10 -3
- package/mablscript/steps/IfConditionStep.js +25 -12
- package/mablscript/steps/NavigateStep.js +5 -2
- package/mablscript/steps/OpenEmailStep.js +5 -2
- package/mablscript/steps/ReleaseStep.js +10 -3
- package/mablscript/steps/RemoveCookieStep.js +5 -2
- package/mablscript/steps/RightClickStep.js +10 -3
- package/mablscript/steps/SelectStep.js +9 -3
- package/mablscript/steps/SendHttpRequestStep.js +8 -4
- package/mablscript/steps/SendKeyStep.js +10 -3
- package/mablscript/steps/SetCookieStep.js +5 -2
- package/mablscript/steps/SetFilesStep.js +9 -3
- package/mablscript/steps/SetViewportStep.js +5 -3
- package/mablscript/steps/SwitchContextStep.js +14 -3
- package/mablscript/steps/SyntheticStep.js +1 -1
- package/mablscript/steps/VisitUrlStep.js +5 -2
- package/mablscript/steps/WaitStep.js +8 -4
- package/mablscript/steps/WaitUntilStep.js +6 -3
- package/mablscript/types/GetVariableDescriptor.js +8 -3
- package/mablscript/types/mobile/CreateVariableMobileStepDescriptor.js +9 -0
- package/mablscript/types/mobile/EnterTextStepDescriptor.js +2 -0
- package/mablscript/types/mobile/NavigateBackStepDescriptor.js +2 -0
- package/mablscript/types/mobile/NavigateHomeStepDescriptor.js +2 -0
- package/mablscript/types/mobile/ScrollStepDescriptor.js +2 -0
- package/mablscript/types/mobile/SetOrientationStepDescriptor.js +8 -0
- package/mablscript/types/mobile/StepWithMobileFindDescriptor.js +2 -0
- package/mablscript/types/mobile/TapStepDescriptor.js +8 -0
- package/mablscriptFind/index.js +1 -1
- package/observers/ObserverBase.js +9 -0
- package/observers/mockObserver.js +3 -3
- package/package.json +11 -6
- package/resources/webdriver.js +21 -0
- package/upload/index.js +5 -0
- package/util/FileCache.js +180 -0
- package/util/Lazy.js +90 -0
- package/util/MobileAppFileCache.js +102 -0
- package/util/RichPromise.js +3 -1
- package/util/javaScriptStepMigration.js +1 -0
- package/webdriver/index.js +41 -0
|
@@ -9,7 +9,7 @@ const ActionsUtils_1 = require("./ActionsUtils");
|
|
|
9
9
|
class ReleaseStep extends MablStep_1.MablStep {
|
|
10
10
|
constructor(name, args, actions) {
|
|
11
11
|
var _a;
|
|
12
|
-
super(name, args, actions);
|
|
12
|
+
super(name, args, actions, 'release');
|
|
13
13
|
this.findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(this.actions);
|
|
14
14
|
this.releaseArgs = (_a = this.parseArgs(args)) !== null && _a !== void 0 ? _a : { isHtml5: false };
|
|
15
15
|
}
|
|
@@ -39,21 +39,28 @@ class ReleaseStep extends MablStep_1.MablStep {
|
|
|
39
39
|
find,
|
|
40
40
|
isHtml5: this.releaseArgs.isHtml5,
|
|
41
41
|
descriptorToActionMap: new Map().set(find, this.findAction),
|
|
42
|
+
actionCode: this.actionCode,
|
|
42
43
|
};
|
|
43
44
|
default:
|
|
44
45
|
throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType}`);
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
getFormattedStep(_fullLocatorsOn) {
|
|
48
|
-
|
|
49
|
+
const step = {
|
|
49
50
|
Release: {
|
|
50
51
|
...super.annotationsAsYml(),
|
|
51
52
|
...this.findAction.toYaml(),
|
|
52
53
|
},
|
|
53
54
|
};
|
|
55
|
+
if (this.stepId()) {
|
|
56
|
+
step.Release.id = this.stepId();
|
|
57
|
+
}
|
|
58
|
+
return step;
|
|
54
59
|
}
|
|
55
60
|
static fromYaml(_stepName, stepArgs) {
|
|
56
|
-
|
|
61
|
+
const step = new ReleaseStep('release', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
|
|
62
|
+
step.setStepId(stepArgs.id);
|
|
63
|
+
return step;
|
|
57
64
|
}
|
|
58
65
|
toMablscript() {
|
|
59
66
|
const args = (0, MablAction_1.convertObjectToMablscriptArgs)(this.releaseArgs);
|
|
@@ -7,7 +7,7 @@ const CookieUtils_1 = require("./CookieUtils");
|
|
|
7
7
|
const domUtil_1 = require("../../domUtil");
|
|
8
8
|
class RemoveCookieStep extends MablStep_1.MablStep {
|
|
9
9
|
constructor(name, args, actions) {
|
|
10
|
-
super(name, args, actions);
|
|
10
|
+
super(name, args, actions, 'remove_cookie');
|
|
11
11
|
this.cookieName = CookieUtils_1.CookieUtils.normalizeName(this.getActionArgs()[0].name);
|
|
12
12
|
}
|
|
13
13
|
getStepName() {
|
|
@@ -16,10 +16,13 @@ class RemoveCookieStep extends MablStep_1.MablStep {
|
|
|
16
16
|
toStepDescriptor() {
|
|
17
17
|
return {
|
|
18
18
|
name: this.cookieName,
|
|
19
|
+
actionCode: this.actionCode,
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
22
|
static fromYaml(_stepName, stepArgs) {
|
|
22
|
-
|
|
23
|
+
const step = new RemoveCookieStep('remove_cookie', [stepArgs], []);
|
|
24
|
+
step.setStepId(stepArgs.id);
|
|
25
|
+
return step;
|
|
23
26
|
}
|
|
24
27
|
toMablscript() {
|
|
25
28
|
return `remove_cookie({ name : "${(0, domUtil_1.escapeMablscriptString)(this.cookieName)}" })`;
|
|
@@ -7,7 +7,7 @@ const domUtil_1 = require("../../domUtil");
|
|
|
7
7
|
const ActionsUtils_1 = require("./ActionsUtils");
|
|
8
8
|
class RightClickStep extends MablStep_1.MablStep {
|
|
9
9
|
constructor(name, args, actions) {
|
|
10
|
-
super(name, args, actions);
|
|
10
|
+
super(name, args, actions, 'right_click');
|
|
11
11
|
this.findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(this.actions);
|
|
12
12
|
}
|
|
13
13
|
getStepName() {
|
|
@@ -23,21 +23,28 @@ class RightClickStep extends MablStep_1.MablStep {
|
|
|
23
23
|
return {
|
|
24
24
|
find,
|
|
25
25
|
descriptorToActionMap: new Map().set(find, this.findAction),
|
|
26
|
+
actionCode: this.actionCode,
|
|
26
27
|
};
|
|
27
28
|
default:
|
|
28
29
|
throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType}`);
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
getFormattedStep(_fullLocatorsOn) {
|
|
32
|
-
|
|
33
|
+
const step = {
|
|
33
34
|
RightClick: {
|
|
34
35
|
...super.annotationsAsYml(),
|
|
35
36
|
...this.findAction.toYaml(),
|
|
36
37
|
},
|
|
37
38
|
};
|
|
39
|
+
if (this.stepId()) {
|
|
40
|
+
step.RightClick.id = this.stepId();
|
|
41
|
+
}
|
|
42
|
+
return step;
|
|
38
43
|
}
|
|
39
44
|
static fromYaml(_stepName, stepArgs) {
|
|
40
|
-
|
|
45
|
+
const step = new RightClickStep('right_click', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
|
|
46
|
+
step.setStepId(stepArgs.id);
|
|
47
|
+
return step;
|
|
41
48
|
}
|
|
42
49
|
toMablscript() {
|
|
43
50
|
return `${this.findAction.toMablscript()}.right_click()`;
|
|
@@ -7,7 +7,7 @@ const MablStep_1 = require("../MablStep");
|
|
|
7
7
|
const domUtil_1 = require("../../domUtil");
|
|
8
8
|
class SelectStep extends MablStep_1.MablStep {
|
|
9
9
|
constructor(name, args, actions) {
|
|
10
|
-
super(name, args, actions);
|
|
10
|
+
super(name, args, actions, 'select');
|
|
11
11
|
this.selectOptions = this.getActionArgs()[0];
|
|
12
12
|
this.selectOptionType = this.getActionArgs()[1];
|
|
13
13
|
this.validate();
|
|
@@ -45,18 +45,24 @@ class SelectStep extends MablStep_1.MablStep {
|
|
|
45
45
|
delete stepArgs.selectorAncestors;
|
|
46
46
|
delete stepArgs.selectOptionType;
|
|
47
47
|
const selectOptions = stepArgs;
|
|
48
|
-
|
|
48
|
+
const step = new SelectStep('select', [selectOptions, selectOptionType], [findAction]);
|
|
49
|
+
step.setStepId(stepArgs.id);
|
|
50
|
+
return step;
|
|
49
51
|
}
|
|
50
52
|
getFormattedStep(_fullLocatorsOn) {
|
|
51
53
|
const step = this.selectOptions;
|
|
52
54
|
const { find, ...ymlStep } = step;
|
|
53
|
-
|
|
55
|
+
const finalStep = {
|
|
54
56
|
Select: {
|
|
55
57
|
...ymlStep,
|
|
56
58
|
...super.annotationsAsYml(),
|
|
57
59
|
...this.findAction.toYaml(),
|
|
58
60
|
},
|
|
59
61
|
};
|
|
62
|
+
if (this.stepId()) {
|
|
63
|
+
finalStep.Select.id = this.stepId();
|
|
64
|
+
}
|
|
65
|
+
return finalStep;
|
|
60
66
|
}
|
|
61
67
|
toMablscript() {
|
|
62
68
|
const selectOptionType = this.selectOptionType
|
|
@@ -10,11 +10,11 @@ const evalAssertionType = {};
|
|
|
10
10
|
Object.entries(AssertStep_1.assertionStepToField).forEach(([stepType, field]) => (evalAssertionType[field] = `${stepType.split('Assert')[1]}`));
|
|
11
11
|
class SendHttpRequestStep extends MablStep_1.MablStep {
|
|
12
12
|
constructor(name, args, actions) {
|
|
13
|
-
super(name, args, actions);
|
|
13
|
+
super(name, args, actions, 'send_http_request');
|
|
14
14
|
this.sendRequest = this.getActionArgs()[0];
|
|
15
15
|
}
|
|
16
16
|
getStepName() {
|
|
17
|
-
return
|
|
17
|
+
return SendHttpRequestStep.stepName;
|
|
18
18
|
}
|
|
19
19
|
toStepDescriptor() {
|
|
20
20
|
const formatted = JSON.parse(JSON.stringify(this.sendRequest));
|
|
@@ -24,6 +24,7 @@ class SendHttpRequestStep extends MablStep_1.MablStep {
|
|
|
24
24
|
assertion: evalAssertionType[assertion.assertion],
|
|
25
25
|
}));
|
|
26
26
|
}
|
|
27
|
+
formatted.actionCode = this.actionCode;
|
|
27
28
|
return formatted;
|
|
28
29
|
}
|
|
29
30
|
static fromYaml(_stepName, stepArgs) {
|
|
@@ -35,7 +36,9 @@ class SendHttpRequestStep extends MablStep_1.MablStep {
|
|
|
35
36
|
assertion: AssertStep_1.assertionStepToField[`Assert${assertion.assertion}`],
|
|
36
37
|
}));
|
|
37
38
|
}
|
|
38
|
-
|
|
39
|
+
const step = new SendHttpRequestStep(SendHttpRequestStep.stepName, [formatted], []);
|
|
40
|
+
step.setStepId(stepArgs.id);
|
|
41
|
+
return step;
|
|
39
42
|
}
|
|
40
43
|
toMablscript() {
|
|
41
44
|
return `send_http_request(${(0, domUtil_1.buildStepArgumentString)({
|
|
@@ -52,8 +55,9 @@ class SendHttpRequestStep extends MablStep_1.MablStep {
|
|
|
52
55
|
}
|
|
53
56
|
}
|
|
54
57
|
exports.SendHttpRequestStep = SendHttpRequestStep;
|
|
58
|
+
SendHttpRequestStep.stepName = 'SendHttpRequest';
|
|
55
59
|
SendHttpRequestStep.mablScriptStepNames = ['send_http_request'];
|
|
56
|
-
SendHttpRequestStep.yamlMablScriptNames = [
|
|
60
|
+
SendHttpRequestStep.yamlMablScriptNames = [SendHttpRequestStep.stepName];
|
|
57
61
|
var HttpResponseAssertion;
|
|
58
62
|
(function (HttpResponseAssertion) {
|
|
59
63
|
function toComparisonDescriptor(assertion) {
|
|
@@ -8,7 +8,7 @@ const SendKeyStepDescriptor_1 = require("../types/SendKeyStepDescriptor");
|
|
|
8
8
|
const STEP_NAME = 'SendKeys';
|
|
9
9
|
class SendKeyStep extends MablStep_1.MablStep {
|
|
10
10
|
constructor(name, args, actions) {
|
|
11
|
-
super(name, args, actions);
|
|
11
|
+
super(name, args, actions, 'send_keys');
|
|
12
12
|
if (this.actions.length !== 1 && !(this.actions[0] instanceof FindAction_1.FindAction)) {
|
|
13
13
|
throw new Error(`${name} step should have one sub-action and it should be a find`);
|
|
14
14
|
}
|
|
@@ -43,24 +43,31 @@ class SendKeyStep extends MablStep_1.MablStep {
|
|
|
43
43
|
find,
|
|
44
44
|
keys: this.keys,
|
|
45
45
|
descriptorToActionMap: new Map().set(find, this.findAction),
|
|
46
|
+
actionCode: this.actionCode,
|
|
46
47
|
};
|
|
47
48
|
default:
|
|
48
49
|
throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType}`);
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
getFormattedStep() {
|
|
52
|
-
|
|
53
|
+
const step = {
|
|
53
54
|
[STEP_NAME]: {
|
|
54
55
|
...super.annotationsAsYml(),
|
|
55
56
|
sendKeys: this.keys,
|
|
56
57
|
...this.findAction.toYaml(),
|
|
57
58
|
},
|
|
58
59
|
};
|
|
60
|
+
if (this.stepId()) {
|
|
61
|
+
step[STEP_NAME].id = this.stepId();
|
|
62
|
+
}
|
|
63
|
+
return step;
|
|
59
64
|
}
|
|
60
65
|
static fromYaml(_stepName, stepArgs) {
|
|
61
|
-
|
|
66
|
+
const step = new SendKeyStep('send_keys', stepArgs.sendKeys, [
|
|
62
67
|
FindAction_1.FindAction.findActionFromStepArgs(stepArgs),
|
|
63
68
|
]);
|
|
69
|
+
step.setStepId(stepArgs.id);
|
|
70
|
+
return step;
|
|
64
71
|
}
|
|
65
72
|
toMablscript() {
|
|
66
73
|
const keysToSend = this.keys
|
|
@@ -7,7 +7,7 @@ const CookieUtils_1 = require("./CookieUtils");
|
|
|
7
7
|
const domUtil_1 = require("../../domUtil");
|
|
8
8
|
class SetCookieStep extends MablStep_1.MablStep {
|
|
9
9
|
constructor(name, args, actions) {
|
|
10
|
-
super(name, args, actions);
|
|
10
|
+
super(name, args, actions, 'set_cookie');
|
|
11
11
|
const cookieSelector = this.getActionArgs()[0];
|
|
12
12
|
this.cookieName = CookieUtils_1.CookieUtils.normalizeName(cookieSelector.name);
|
|
13
13
|
this.cookieValue = CookieUtils_1.CookieUtils.normalizeValue(cookieSelector.value);
|
|
@@ -32,10 +32,13 @@ class SetCookieStep extends MablStep_1.MablStep {
|
|
|
32
32
|
name: this.cookieName,
|
|
33
33
|
value: this.cookieValue,
|
|
34
34
|
options: this.cookieOptions,
|
|
35
|
+
actionCode: this.actionCode,
|
|
35
36
|
};
|
|
36
37
|
}
|
|
37
38
|
static fromYaml(_stepName, stepArgs) {
|
|
38
|
-
|
|
39
|
+
const step = new SetCookieStep('set_cookie', [stepArgs], []);
|
|
40
|
+
step.setStepId(stepArgs.id);
|
|
41
|
+
return step;
|
|
39
42
|
}
|
|
40
43
|
toMablscript() {
|
|
41
44
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
@@ -7,7 +7,7 @@ const MablStep_1 = require("../MablStep");
|
|
|
7
7
|
const domUtil_1 = require("../../domUtil");
|
|
8
8
|
class SetFilesStep extends MablStep_1.MablStep {
|
|
9
9
|
constructor(name, args, actions) {
|
|
10
|
-
super(name, args, actions);
|
|
10
|
+
super(name, args, actions, 'set_files');
|
|
11
11
|
this.files = this.getActionArgs();
|
|
12
12
|
this.validate();
|
|
13
13
|
this.findAction = this.actions[0];
|
|
@@ -37,18 +37,24 @@ class SetFilesStep extends MablStep_1.MablStep {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
getFormattedStep(_fullLocatorsOn) {
|
|
40
|
-
|
|
40
|
+
const step = {
|
|
41
41
|
SetFiles: {
|
|
42
42
|
...super.annotationsAsYml(),
|
|
43
43
|
...this.findAction.toYaml(),
|
|
44
44
|
files: this.files,
|
|
45
45
|
},
|
|
46
46
|
};
|
|
47
|
+
if (this.stepId()) {
|
|
48
|
+
step.SetFiles.id = this.stepId();
|
|
49
|
+
}
|
|
50
|
+
return step;
|
|
47
51
|
}
|
|
48
52
|
static fromYaml(_stepName, stepArgs) {
|
|
49
|
-
|
|
53
|
+
const step = new SetFilesStep('set_files', stepArgs.files, [
|
|
50
54
|
FindAction_1.FindAction.findActionFromStepArgs(stepArgs),
|
|
51
55
|
]);
|
|
56
|
+
step.setStepId(stepArgs.id);
|
|
57
|
+
return step;
|
|
52
58
|
}
|
|
53
59
|
toMablscript() {
|
|
54
60
|
const files = this.files
|
|
@@ -4,7 +4,7 @@ exports.SetViewportStep = void 0;
|
|
|
4
4
|
const MablStep_1 = require("../MablStep");
|
|
5
5
|
class SetViewportStep extends MablStep_1.MablStep {
|
|
6
6
|
constructor(name, args, actions) {
|
|
7
|
-
super(name, args, actions);
|
|
7
|
+
super(name, args, actions, 'set_viewport');
|
|
8
8
|
const viewportArg = this.getActionArgs()[0];
|
|
9
9
|
this.size = viewportArg === null || viewportArg === void 0 ? void 0 : viewportArg.size;
|
|
10
10
|
}
|
|
@@ -12,10 +12,12 @@ class SetViewportStep extends MablStep_1.MablStep {
|
|
|
12
12
|
return 'SetViewport';
|
|
13
13
|
}
|
|
14
14
|
toStepDescriptor() {
|
|
15
|
-
return { size: this.size };
|
|
15
|
+
return { size: this.size, actionCode: this.actionCode };
|
|
16
16
|
}
|
|
17
17
|
static fromYaml(_stepName, stepArgs) {
|
|
18
|
-
|
|
18
|
+
const step = new SetViewportStep('set_viewport', [stepArgs], []);
|
|
19
|
+
step.setStepId(stepArgs.id);
|
|
20
|
+
return step;
|
|
19
21
|
}
|
|
20
22
|
toMablscript() {
|
|
21
23
|
let sizeArg;
|
|
@@ -7,7 +7,7 @@ const SwitchContextStepDescriptor_1 = require("../types/SwitchContextStepDescrip
|
|
|
7
7
|
const domUtil_1 = require("../../domUtil");
|
|
8
8
|
class SwitchContextStep extends MablStep_1.MablStep {
|
|
9
9
|
constructor(name, args, actions) {
|
|
10
|
-
super(name, args, actions);
|
|
10
|
+
super(name, args, actions, 'switch_context_to');
|
|
11
11
|
const maybeRoot = this.getActionArgs()[0];
|
|
12
12
|
if (maybeRoot !== undefined && maybeRoot !== 'root') {
|
|
13
13
|
throw new Error(`Unexpected argument for ${name} step: ${JSON.stringify(maybeRoot)}`);
|
|
@@ -15,6 +15,7 @@ class SwitchContextStep extends MablStep_1.MablStep {
|
|
|
15
15
|
if (maybeRoot === 'root') {
|
|
16
16
|
this.switch = {
|
|
17
17
|
frame: 'root',
|
|
18
|
+
actionCode: this.actionCode,
|
|
18
19
|
};
|
|
19
20
|
Object.freeze(this.switch);
|
|
20
21
|
return;
|
|
@@ -32,6 +33,7 @@ class SwitchContextStep extends MablStep_1.MablStep {
|
|
|
32
33
|
tab: findDescriptor,
|
|
33
34
|
find: findDescriptor,
|
|
34
35
|
descriptorToActionMap: new Map().set(findDescriptor, this.findAction),
|
|
36
|
+
actionCode: this.actionCode,
|
|
35
37
|
};
|
|
36
38
|
Object.freeze(this.switch);
|
|
37
39
|
return;
|
|
@@ -41,6 +43,7 @@ class SwitchContextStep extends MablStep_1.MablStep {
|
|
|
41
43
|
frame: findDescriptor,
|
|
42
44
|
find: findDescriptor,
|
|
43
45
|
descriptorToActionMap: new Map().set(findDescriptor, this.findAction),
|
|
46
|
+
actionCode: this.actionCode,
|
|
44
47
|
};
|
|
45
48
|
Object.freeze(this.switch);
|
|
46
49
|
return;
|
|
@@ -86,13 +89,21 @@ class SwitchContextStep extends MablStep_1.MablStep {
|
|
|
86
89
|
if ((0, SwitchContextStepDescriptor_1.isSwitchRoot)(step) && step.frame === 'root') {
|
|
87
90
|
formatted[stepName].switch = 'root';
|
|
88
91
|
}
|
|
92
|
+
if (this.stepId()) {
|
|
93
|
+
formatted[stepName].id = this.stepId();
|
|
94
|
+
}
|
|
89
95
|
return formatted;
|
|
90
96
|
}
|
|
91
97
|
static fromYaml(_stepName, stepArgs) {
|
|
98
|
+
let step;
|
|
92
99
|
if (stepArgs.switch) {
|
|
93
|
-
|
|
100
|
+
step = new SwitchContextStep('switch_context_to', [stepArgs.switch], []);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
step = new SwitchContextStep('switch_context_to', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
|
|
94
104
|
}
|
|
95
|
-
|
|
105
|
+
step.setStepId(stepArgs.id);
|
|
106
|
+
return step;
|
|
96
107
|
}
|
|
97
108
|
toMablscript() {
|
|
98
109
|
var _a;
|
|
@@ -5,7 +5,7 @@ const MablStep_1 = require("../MablStep");
|
|
|
5
5
|
exports.DEFAULT_STEP_SOURCE_INDEX_IN_FLOW = -1;
|
|
6
6
|
class SyntheticStep extends MablStep_1.MablStep {
|
|
7
7
|
constructor(name, args = [], actions = [], stepSourceIndexInFlow = exports.DEFAULT_STEP_SOURCE_INDEX_IN_FLOW) {
|
|
8
|
-
super(name, args, actions);
|
|
8
|
+
super(name, args, actions, name);
|
|
9
9
|
this.stepSourceIndexInFlow = stepSourceIndexInFlow;
|
|
10
10
|
this.actionSourceIndexInStep = 0;
|
|
11
11
|
}
|
|
@@ -6,7 +6,7 @@ const MablAction_1 = require("../MablAction");
|
|
|
6
6
|
const domUtil_1 = require("../../domUtil");
|
|
7
7
|
class VisitUrlStep extends MablStep_1.MablStep {
|
|
8
8
|
constructor(name, args, actions) {
|
|
9
|
-
super(name, args, actions);
|
|
9
|
+
super(name, args, actions, 'visit_url');
|
|
10
10
|
const arg = this.getActionArgs()[0];
|
|
11
11
|
this.url = VisitUrlStep.normalizeUrl(arg);
|
|
12
12
|
}
|
|
@@ -16,10 +16,13 @@ class VisitUrlStep extends MablStep_1.MablStep {
|
|
|
16
16
|
toStepDescriptor() {
|
|
17
17
|
return {
|
|
18
18
|
url: this.url,
|
|
19
|
+
actionCode: this.actionCode,
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
22
|
static fromYaml(_stepName, stepArgs) {
|
|
22
|
-
|
|
23
|
+
const step = new VisitUrlStep('visit_url', [stepArgs.url], []);
|
|
24
|
+
step.setStepId(stepArgs.id);
|
|
25
|
+
return step;
|
|
23
26
|
}
|
|
24
27
|
toMablscript() {
|
|
25
28
|
const resolvedUrl = this.substituteMablscriptVariable((0, domUtil_1.escapeMablscriptString)(this.url.toString()));
|
|
@@ -4,19 +4,22 @@ exports.WaitStep = void 0;
|
|
|
4
4
|
const MablStep_1 = require("../MablStep");
|
|
5
5
|
class WaitStep extends MablStep_1.MablStep {
|
|
6
6
|
constructor(name, args, actions) {
|
|
7
|
-
super(name, args, actions);
|
|
7
|
+
super(name, args, actions, 'wait');
|
|
8
8
|
this.milliseconds = WaitStep.validateWait(this.getActionArgs()[0]);
|
|
9
9
|
}
|
|
10
10
|
getStepName() {
|
|
11
|
-
return
|
|
11
|
+
return WaitStep.stepName;
|
|
12
12
|
}
|
|
13
13
|
toStepDescriptor() {
|
|
14
14
|
return {
|
|
15
15
|
milliseconds: this.milliseconds,
|
|
16
|
+
actionCode: this.actionCode,
|
|
16
17
|
};
|
|
17
18
|
}
|
|
18
19
|
static fromYaml(_stepName, stepArgs) {
|
|
19
|
-
|
|
20
|
+
const step = new WaitStep(WaitStep.stepName, [stepArgs.milliseconds], []);
|
|
21
|
+
step.setStepId(stepArgs.id);
|
|
22
|
+
return step;
|
|
20
23
|
}
|
|
21
24
|
toMablscript() {
|
|
22
25
|
return `wait(${this.milliseconds})`;
|
|
@@ -29,5 +32,6 @@ class WaitStep extends MablStep_1.MablStep {
|
|
|
29
32
|
}
|
|
30
33
|
}
|
|
31
34
|
exports.WaitStep = WaitStep;
|
|
35
|
+
WaitStep.stepName = 'Wait';
|
|
32
36
|
WaitStep.mablScriptStepNames = ['wait'];
|
|
33
|
-
WaitStep.yamlMablScriptNames = [
|
|
37
|
+
WaitStep.yamlMablScriptNames = [WaitStep.stepName];
|
|
@@ -5,7 +5,7 @@ const MablStep_1 = require("../MablStep");
|
|
|
5
5
|
const domUtil_1 = require("../../domUtil");
|
|
6
6
|
class WaitUntilStep extends MablStep_1.MablStep {
|
|
7
7
|
constructor(name, args, actions) {
|
|
8
|
-
super(name, args, actions);
|
|
8
|
+
super(name, args, actions, 'wait_until');
|
|
9
9
|
if ((0, domUtil_1.isFindElementType)(this.actions[0].getActionName())) {
|
|
10
10
|
this.findAction = this.actions[0];
|
|
11
11
|
}
|
|
@@ -23,13 +23,16 @@ class WaitUntilStep extends MablStep_1.MablStep {
|
|
|
23
23
|
return {
|
|
24
24
|
find,
|
|
25
25
|
descriptorToActionMap: new Map().set(find, this.findAction),
|
|
26
|
+
actionCode: this.actionCode,
|
|
26
27
|
};
|
|
27
28
|
default:
|
|
28
29
|
throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType} is not supported`);
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
|
-
static fromYaml(_stepName,
|
|
32
|
-
|
|
32
|
+
static fromYaml(_stepName, stepArgs) {
|
|
33
|
+
const step = new WaitUntilStep('wait', [], []);
|
|
34
|
+
step.setStepId(stepArgs.id);
|
|
35
|
+
return step;
|
|
33
36
|
}
|
|
34
37
|
toMablscript() {
|
|
35
38
|
return `${this.findAction.toMablscript()}.evaluate_presence("present").assert()`;
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.newGetVariableDescriptor = exports.isGetVariableDescriptor = void 0;
|
|
3
|
+
exports.convertGetVariableDescriptorToYaml = exports.newGetVariableDescriptor = exports.isGetVariableDescriptor = exports.GET_VARIABLE_VALUE = void 0;
|
|
4
|
+
exports.GET_VARIABLE_VALUE = 'GetVariable';
|
|
4
5
|
function isGetVariableDescriptor(value) {
|
|
5
|
-
return value.kind ===
|
|
6
|
+
return value.kind === exports.GET_VARIABLE_VALUE;
|
|
6
7
|
}
|
|
7
8
|
exports.isGetVariableDescriptor = isGetVariableDescriptor;
|
|
8
9
|
function newGetVariableDescriptor(variable) {
|
|
9
|
-
return { kind:
|
|
10
|
+
return { kind: exports.GET_VARIABLE_VALUE, variable };
|
|
10
11
|
}
|
|
11
12
|
exports.newGetVariableDescriptor = newGetVariableDescriptor;
|
|
13
|
+
function convertGetVariableDescriptorToYaml(descriptor) {
|
|
14
|
+
return { ...descriptor, variable: descriptor.variable.toString() };
|
|
15
|
+
}
|
|
16
|
+
exports.convertGetVariableDescriptorToYaml = convertGetVariableDescriptorToYaml;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isCreateVariableMobileFindStepDescriptor = void 0;
|
|
4
|
+
function isCreateVariableMobileFindStepDescriptor(value) {
|
|
5
|
+
var _a, _b, _c, _d, _e, _f;
|
|
6
|
+
return !!(((_c = (_b = (_a = value.find) === null || _a === void 0 ? void 0 : _a.findTarget) === null || _b === void 0 ? void 0 : _b.selector) === null || _c === void 0 ? void 0 : _c.iOS) ||
|
|
7
|
+
((_f = (_e = (_d = value.find) === null || _d === void 0 ? void 0 : _d.findTarget) === null || _e === void 0 ? void 0 : _e.selector) === null || _f === void 0 ? void 0 : _f.android));
|
|
8
|
+
}
|
|
9
|
+
exports.isCreateVariableMobileFindStepDescriptor = isCreateVariableMobileFindStepDescriptor;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Orientation = void 0;
|
|
4
|
+
var Orientation;
|
|
5
|
+
(function (Orientation) {
|
|
6
|
+
Orientation["Landscape"] = "LANDSCAPE";
|
|
7
|
+
Orientation["Portrait"] = "PORTRAIT";
|
|
8
|
+
})(Orientation = exports.Orientation || (exports.Orientation = {}));
|