@mablhq/mabl-cli 1.61.8 → 2.0.3
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/Globals.js +11 -7
- package/api/basicApiClient.js +10 -10
- package/api/mablApiClient.js +39 -1
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +6 -6
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +8 -0
- 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 +10 -3
- package/commands/tests/testsUtil.js +45 -15
- package/commands/tests/tests_cmds/run-mobile.js +218 -0
- package/commands/tests/tests_cmds/run.js +11 -9
- 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 +4 -1
- package/http/RequestFilteringHttpAgent.js +3 -3
- package/http/axiosProxyConfig.js +27 -22
- package/http/httpUtil.js +6 -10
- package/mablApi/index.js +1 -1
- package/mablscript/MablAction.js +1 -1
- package/mablscript/MablStep.js +28 -2
- package/mablscript/MablStepV2.js +51 -0
- package/mablscript/MablSymbol.js +6 -2
- package/mablscript/actions/ExtractAction.js +11 -6
- package/mablscript/actions/FindAction.js +5 -5
- package/mablscript/actions/JavaScriptAction.js +19 -12
- package/mablscript/importer.js +97 -14
- 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 +71 -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 +287 -0
- package/mablscript/mobile/tests/steps/EnterTextStep.mobiletest.js +74 -0
- package/mablscript/mobile/tests/steps/GeneralHumanization.mobiletest.js +167 -0
- package/mablscript/mobile/tests/steps/NavigateBackStep.mobiletest.js +22 -0
- package/mablscript/mobile/tests/steps/NavigateHomeStep.mobiletest.js +22 -0
- package/mablscript/mobile/tests/steps/ScrollStep.mobiletest.js +112 -0
- package/mablscript/mobile/tests/steps/SetOrientationStep.mobiletest.js +27 -0
- package/mablscript/mobile/tests/steps/TapStep.mobiletest.js +53 -0
- package/mablscript/steps/AssertStep.js +48 -38
- package/mablscript/steps/AssertStepOld.js +30 -2
- package/mablscript/steps/CreateVariableStep.js +9 -2
- package/mablscript/steps/EchoStep.js +4 -3
- package/mablscript/steps/ElseIfConditionStep.js +8 -2
- package/mablscript/steps/ElseStep.js +2 -1
- package/mablscript/steps/EndStep.js +2 -1
- package/mablscript/steps/EvaluateJavaScriptStep.js +6 -1
- package/mablscript/steps/IfConditionStep.js +17 -10
- package/mablscript/steps/SendHttpRequestStep.js +4 -3
- package/mablscript/steps/WaitStep.js +4 -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/package.json +13 -6
- package/resources/pdf-viewer/embeddedPdfDetection.js +1 -14
- 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/webdriver/index.js +41 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MobileFindAction = void 0;
|
|
4
|
+
const MablAction_1 = require("../../../MablAction");
|
|
5
|
+
class MobileFindAction extends MablAction_1.MablAction {
|
|
6
|
+
constructor(findDescriptor) {
|
|
7
|
+
super('MobileFindAction', [[]]);
|
|
8
|
+
this.findDescriptor = findDescriptor;
|
|
9
|
+
}
|
|
10
|
+
toDescriptor() {
|
|
11
|
+
return this.findDescriptor;
|
|
12
|
+
}
|
|
13
|
+
toYaml() {
|
|
14
|
+
return this.findDescriptor;
|
|
15
|
+
}
|
|
16
|
+
getInputVariables() {
|
|
17
|
+
return MablAction_1.MablAction.findUniqueVariableReferencesInValue(this.findDescriptor);
|
|
18
|
+
}
|
|
19
|
+
static fromDescriptor(mobileFindDescriptor) {
|
|
20
|
+
return new MobileFindAction(mobileFindDescriptor);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.MobileFindAction = MobileFindAction;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isStepWithFind = exports.humanizeCustomFind = exports.getDescriptionForMobileStep = exports.getSimpleIOSElementName = exports.getSimpleAndroidElementName = void 0;
|
|
4
|
+
const domUtil_1 = require("../../../domUtil");
|
|
5
|
+
const mablscriptFind_1 = require("../../../mablscriptFind");
|
|
6
|
+
function getSimpleAndroidElementName(className) {
|
|
7
|
+
if (!className) {
|
|
8
|
+
return 'unknown';
|
|
9
|
+
}
|
|
10
|
+
const parts = className.split('.');
|
|
11
|
+
return parts[parts.length - 1];
|
|
12
|
+
}
|
|
13
|
+
exports.getSimpleAndroidElementName = getSimpleAndroidElementName;
|
|
14
|
+
function getSimpleIOSElementName(elementName) {
|
|
15
|
+
if (!elementName) {
|
|
16
|
+
return 'unknown';
|
|
17
|
+
}
|
|
18
|
+
const parts = elementName.split('XCUIElementType');
|
|
19
|
+
if (parts.length > 1) {
|
|
20
|
+
return parts[1];
|
|
21
|
+
}
|
|
22
|
+
return 'unknown';
|
|
23
|
+
}
|
|
24
|
+
exports.getSimpleIOSElementName = getSimpleIOSElementName;
|
|
25
|
+
function getDescriptionForMobileStep(predicateAction, descriptor) {
|
|
26
|
+
var _a;
|
|
27
|
+
const findTarget = (_a = descriptor.find) === null || _a === void 0 ? void 0 : _a.findTarget;
|
|
28
|
+
if ((0, domUtil_1.isMobileFindSpecification)(findTarget)) {
|
|
29
|
+
if ((0, domUtil_1.isWebViewFindElementDescriptor)(descriptor.find)) {
|
|
30
|
+
return getDescriptionForWebViewStep(predicateAction, descriptor.find);
|
|
31
|
+
}
|
|
32
|
+
const selector = findTarget.selector;
|
|
33
|
+
if (selector.android && Object.keys(selector.android).length) {
|
|
34
|
+
if (selector.android.text) {
|
|
35
|
+
return `${predicateAction} element with text "${selector.android.text}"`;
|
|
36
|
+
}
|
|
37
|
+
return `${predicateAction} "${getSimpleAndroidElementName(selector.android.class)}" element`;
|
|
38
|
+
}
|
|
39
|
+
else if (selector.iOS) {
|
|
40
|
+
if (selector.iOS.name) {
|
|
41
|
+
return `${predicateAction} "${selector.iOS.name}" element`;
|
|
42
|
+
}
|
|
43
|
+
if (selector.iOS.label) {
|
|
44
|
+
return `${predicateAction} element with text "${selector.iOS.label}"`;
|
|
45
|
+
}
|
|
46
|
+
return `${predicateAction} the "${getSimpleIOSElementName(selector.iOS.type)}" element`;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return `${predicateAction} unknown element`;
|
|
50
|
+
}
|
|
51
|
+
exports.getDescriptionForMobileStep = getDescriptionForMobileStep;
|
|
52
|
+
function getDescriptionForWebViewStep(predicateAction, webViewElementDescriptor) {
|
|
53
|
+
if ((0, domUtil_1.isFindElementDescriptor)(webViewElementDescriptor.webView.descriptor)) {
|
|
54
|
+
const elementDescription = (0, mablscriptFind_1.humanizeFindOneDescriptor)(webViewElementDescriptor.webView.descriptor.findTarget);
|
|
55
|
+
return `${predicateAction} ${elementDescription}`;
|
|
56
|
+
}
|
|
57
|
+
return `Unknown webview descriptor type.`;
|
|
58
|
+
}
|
|
59
|
+
function humanizeCustomFind(descriptor) {
|
|
60
|
+
if (isStepWithFind(descriptor)) {
|
|
61
|
+
if ((0, domUtil_1.isMobileFindCustomDescriptor)(descriptor.find)) {
|
|
62
|
+
return `xpath: ${descriptor.find.findTarget.xpath}`;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return `custom find`;
|
|
66
|
+
}
|
|
67
|
+
exports.humanizeCustomFind = humanizeCustomFind;
|
|
68
|
+
function isStepWithFind(value) {
|
|
69
|
+
return !!(value === null || value === void 0 ? void 0 : value.find);
|
|
70
|
+
}
|
|
71
|
+
exports.isStepWithFind = isStepWithFind;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadRawStepIntoMablStep = exports.parseAndValidateYamlConversion = void 0;
|
|
4
|
+
const js_yaml_1 = require("js-yaml");
|
|
5
|
+
const importer_1 = require("../../importer");
|
|
6
|
+
function parseAndValidateYamlConversion(steps, expectedStepName, expectedDescriptor) {
|
|
7
|
+
const yamlfiedSteps = (0, js_yaml_1.dump)(steps);
|
|
8
|
+
const loadedSteps = (0, importer_1.loadYamlSteps)(yamlfiedSteps, true);
|
|
9
|
+
expect(loadedSteps[0].name).toEqual(expectedStepName);
|
|
10
|
+
expect(loadedSteps[0].descriptor).toEqual(expectedDescriptor);
|
|
11
|
+
const yamlfied = (0, importer_1.yamlifyTheLoadedSteps)(loadedSteps);
|
|
12
|
+
expect(yamlfied).toEqual(yamlfiedSteps);
|
|
13
|
+
}
|
|
14
|
+
exports.parseAndValidateYamlConversion = parseAndValidateYamlConversion;
|
|
15
|
+
function loadRawStepIntoMablStep(step) {
|
|
16
|
+
const yamlfiedSteps = (0, js_yaml_1.dump)([step]);
|
|
17
|
+
const loadedSteps = (0, importer_1.loadYamlSteps)(yamlfiedSteps, true);
|
|
18
|
+
return loadedSteps[0];
|
|
19
|
+
}
|
|
20
|
+
exports.loadRawStepIntoMablStep = loadRawStepIntoMablStep;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AndroidTestLabWebViewClickCounterMobileFindDescriptor = exports.iOSTestLabWebViewClickCounterMobileFindDescriptor = exports.AndroidWebViewTextFieldMobileFindDescriptor = exports.iOSWebViewTextFieldMobileFindDescriptor = void 0;
|
|
4
|
+
const domUtil_1 = require("../../../domUtil");
|
|
5
|
+
exports.iOSWebViewTextFieldMobileFindDescriptor = {
|
|
6
|
+
findType: domUtil_1.FindType.FIND_ONE,
|
|
7
|
+
findTarget: {
|
|
8
|
+
selector: {
|
|
9
|
+
iOS: {
|
|
10
|
+
accessible: false,
|
|
11
|
+
rect: {
|
|
12
|
+
width: 390,
|
|
13
|
+
x: 0,
|
|
14
|
+
y: 175,
|
|
15
|
+
height: 635,
|
|
16
|
+
},
|
|
17
|
+
xpath: '//XCUIElementTypeApplication/XCUIElementTypeWindow/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeWebView',
|
|
18
|
+
visible: true,
|
|
19
|
+
index: 1,
|
|
20
|
+
alternateXPaths: [],
|
|
21
|
+
type: 'XCUIElementTypeWebView',
|
|
22
|
+
enabled: true,
|
|
23
|
+
},
|
|
24
|
+
uuid: '',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
webView: {
|
|
28
|
+
descriptor: {
|
|
29
|
+
findTarget: {
|
|
30
|
+
selector: {
|
|
31
|
+
bounding_width: '155',
|
|
32
|
+
visible: 'true',
|
|
33
|
+
tag_name: 'input',
|
|
34
|
+
namespace_uri: 'http://www.w3.org/1999/xhtml',
|
|
35
|
+
label: 'Regex pattern restriction (simple ip address-like):',
|
|
36
|
+
title: 'HTML5 Input Type test',
|
|
37
|
+
uuid: '',
|
|
38
|
+
url: 'https://storage.googleapis.com/public-dev-test-lab/input/inputtypes.html',
|
|
39
|
+
xpath: '//html[1]/body[1]/form[1]/table[1]/tbody[1]/tr[17]/td[2]/input[1]',
|
|
40
|
+
inputElementType: 'text',
|
|
41
|
+
name: 'input-regex',
|
|
42
|
+
id: 'input-regex',
|
|
43
|
+
bounding_height: '21',
|
|
44
|
+
bounding_x: '333',
|
|
45
|
+
bounding_y: '288',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
findType: domUtil_1.FindType.FIND_ONE,
|
|
49
|
+
},
|
|
50
|
+
title: 'HTML5 Input Type test',
|
|
51
|
+
url: 'https://storage.googleapis.com/public-dev-test-lab/input/inputtypes.html',
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
exports.AndroidWebViewTextFieldMobileFindDescriptor = {
|
|
55
|
+
findType: domUtil_1.FindType.FIND_ONE,
|
|
56
|
+
findTarget: {
|
|
57
|
+
selector: {
|
|
58
|
+
android: {
|
|
59
|
+
displayed: true,
|
|
60
|
+
checkable: false,
|
|
61
|
+
clickable: false,
|
|
62
|
+
index: 0,
|
|
63
|
+
focusable: false,
|
|
64
|
+
alternateXPaths: [],
|
|
65
|
+
enabled: true,
|
|
66
|
+
longClickable: false,
|
|
67
|
+
rect: {
|
|
68
|
+
width: 1440,
|
|
69
|
+
x: 0,
|
|
70
|
+
y: 280,
|
|
71
|
+
height: 2196,
|
|
72
|
+
},
|
|
73
|
+
password: false,
|
|
74
|
+
xpath: '//hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/androidx.compose.ui.platform.ComposeView/android.view.View/android.view.View/android.view.View/android.view.ViewGroup/android.webkit.WebView',
|
|
75
|
+
bounds: '[0,280][1440,2476]',
|
|
76
|
+
focused: false,
|
|
77
|
+
checked: false,
|
|
78
|
+
text: '',
|
|
79
|
+
class: 'android.webkit.WebView',
|
|
80
|
+
scrollable: false,
|
|
81
|
+
selected: false,
|
|
82
|
+
},
|
|
83
|
+
uuid: '',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
webView: {
|
|
87
|
+
descriptor: {
|
|
88
|
+
findTarget: {
|
|
89
|
+
selector: {
|
|
90
|
+
bounding_width: '191',
|
|
91
|
+
visible: 'true',
|
|
92
|
+
tag_name: 'input',
|
|
93
|
+
namespace_uri: 'http://www.w3.org/1999/xhtml',
|
|
94
|
+
label: 'Regex pattern restriction (simple ip address-like):',
|
|
95
|
+
title: 'HTML5 Input Type test',
|
|
96
|
+
uuid: '',
|
|
97
|
+
url: 'https://storage.googleapis.com/public-dev-test-lab/input/inputtypes.html',
|
|
98
|
+
xpath: '//html[1]/body[1]/form[1]/table[1]/tbody[1]/tr[17]/td[2]/input[1]',
|
|
99
|
+
inputElementType: 'text',
|
|
100
|
+
name: 'input-regex',
|
|
101
|
+
id: 'input-regex',
|
|
102
|
+
bounding_height: '21',
|
|
103
|
+
bounding_x: '92',
|
|
104
|
+
bounding_y: '476',
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
findType: domUtil_1.FindType.FIND_ONE,
|
|
108
|
+
},
|
|
109
|
+
title: 'HTML5 Input Type test',
|
|
110
|
+
url: 'https://storage.googleapis.com/public-dev-test-lab/input/inputtypes.html',
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
exports.iOSTestLabWebViewClickCounterMobileFindDescriptor = {
|
|
114
|
+
findType: domUtil_1.FindType.FIND_ONE,
|
|
115
|
+
findTarget: {
|
|
116
|
+
selector: {
|
|
117
|
+
iOS: {
|
|
118
|
+
accessible: false,
|
|
119
|
+
rect: {
|
|
120
|
+
width: 390,
|
|
121
|
+
x: 0,
|
|
122
|
+
y: 143,
|
|
123
|
+
height: 334,
|
|
124
|
+
},
|
|
125
|
+
visible: true,
|
|
126
|
+
xpath: '//XCUIElementTypeApplication/XCUIElementTypeWindow/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeWebView',
|
|
127
|
+
alternateXPaths: [],
|
|
128
|
+
type: 'XCUIElementTypeWebView',
|
|
129
|
+
enabled: true,
|
|
130
|
+
},
|
|
131
|
+
uuid: '',
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
webView: {
|
|
135
|
+
descriptor: {
|
|
136
|
+
findTarget: {
|
|
137
|
+
selector: {
|
|
138
|
+
bounding_width: '69',
|
|
139
|
+
visible: 'true',
|
|
140
|
+
tag_name: 'button',
|
|
141
|
+
namespace_uri: 'http://www.w3.org/1999/xhtml',
|
|
142
|
+
title: 'test lab - click counter',
|
|
143
|
+
uuid: '',
|
|
144
|
+
url: 'https://storage.googleapis.com/public-dev-test-lab/click/click-counter.html',
|
|
145
|
+
xpath: '//html[1]/body[1]/div[1]/button[1]',
|
|
146
|
+
id: 'click-me-button',
|
|
147
|
+
text: 'Click me',
|
|
148
|
+
bounding_height: '29',
|
|
149
|
+
bounding_x: '40',
|
|
150
|
+
bounding_y: '125',
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
findType: domUtil_1.FindType.FIND_ONE,
|
|
154
|
+
},
|
|
155
|
+
title: 'test lab - click counter',
|
|
156
|
+
url: 'https://storage.googleapis.com/public-dev-test-lab/click/click-counter.html',
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
exports.AndroidTestLabWebViewClickCounterMobileFindDescriptor = {
|
|
160
|
+
findType: domUtil_1.FindType.FIND_ONE,
|
|
161
|
+
findTarget: {
|
|
162
|
+
selector: {
|
|
163
|
+
android: {
|
|
164
|
+
displayed: true,
|
|
165
|
+
checkable: false,
|
|
166
|
+
clickable: false,
|
|
167
|
+
index: 0,
|
|
168
|
+
focusable: false,
|
|
169
|
+
alternateXPaths: [],
|
|
170
|
+
enabled: true,
|
|
171
|
+
longClickable: false,
|
|
172
|
+
rect: {
|
|
173
|
+
width: 1000,
|
|
174
|
+
x: 0,
|
|
175
|
+
y: 280,
|
|
176
|
+
height: 700,
|
|
177
|
+
},
|
|
178
|
+
password: false,
|
|
179
|
+
xpath: '//hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/androidx.compose.ui.platform.ComposeView/android.view.View/android.view.View/android.view.View/android.view.ViewGroup/android.webkit.WebView',
|
|
180
|
+
bounds: '[0,280][1000,980]',
|
|
181
|
+
focused: false,
|
|
182
|
+
checked: false,
|
|
183
|
+
text: '',
|
|
184
|
+
class: 'android.webkit.WebView',
|
|
185
|
+
scrollable: false,
|
|
186
|
+
selected: false,
|
|
187
|
+
},
|
|
188
|
+
uuid: '',
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
webView: {
|
|
192
|
+
descriptor: {
|
|
193
|
+
findTarget: {
|
|
194
|
+
selector: {
|
|
195
|
+
bounding_width: '67',
|
|
196
|
+
visible: 'true',
|
|
197
|
+
tag_name: 'button',
|
|
198
|
+
namespace_uri: 'http://www.w3.org/1999/xhtml',
|
|
199
|
+
title: 'test lab - click counter',
|
|
200
|
+
uuid: '',
|
|
201
|
+
url: 'https://storage.googleapis.com/public-dev-test-lab/click/click-counter.html',
|
|
202
|
+
xpath: '//html[1]/body[1]/div[1]/button[1]',
|
|
203
|
+
id: 'click-me-button',
|
|
204
|
+
text: 'Click me',
|
|
205
|
+
bounding_height: '21',
|
|
206
|
+
bounding_x: '40',
|
|
207
|
+
bounding_y: '115',
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
findType: domUtil_1.FindType.FIND_ONE,
|
|
211
|
+
},
|
|
212
|
+
title: 'test lab - click counter',
|
|
213
|
+
url: 'https://storage.googleapis.com/public-dev-test-lab/click/click-counter.html',
|
|
214
|
+
},
|
|
215
|
+
};
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const domUtil_1 = require("../../../../domUtil");
|
|
4
|
+
const CreateVariableStepDescriptor_1 = require("../../../types/CreateVariableStepDescriptor");
|
|
5
|
+
const CreateVariableMobileStep_1 = require("../../steps/CreateVariableMobileStep");
|
|
6
|
+
const StepTestsUtil_1 = require("../StepTestsUtil");
|
|
7
|
+
describe('CreateVariable mobile steps parse correctly', () => {
|
|
8
|
+
it('Parses a CreateVariable mobile step with variable pattern', () => {
|
|
9
|
+
const stepDescriptor = {
|
|
10
|
+
generator: {
|
|
11
|
+
pattern: `my value: {{digit:3}}`,
|
|
12
|
+
type: CreateVariableStepDescriptor_1.VariableGenerator.PATTERN,
|
|
13
|
+
},
|
|
14
|
+
name: 'myValue',
|
|
15
|
+
};
|
|
16
|
+
const steps = [
|
|
17
|
+
{
|
|
18
|
+
CreateVariable: stepDescriptor,
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
(0, StepTestsUtil_1.parseAndValidateYamlConversion)(steps, CreateVariableMobileStep_1.CreateVariableMobileStep.stepName, stepDescriptor);
|
|
22
|
+
});
|
|
23
|
+
it('Parses a CreateVariable mobile step for generating email address', () => {
|
|
24
|
+
const stepDescriptor = {
|
|
25
|
+
generator: {
|
|
26
|
+
type: CreateVariableStepDescriptor_1.VariableGenerator.EMAIL,
|
|
27
|
+
},
|
|
28
|
+
name: 'email',
|
|
29
|
+
};
|
|
30
|
+
const steps = [
|
|
31
|
+
{
|
|
32
|
+
CreateVariable: stepDescriptor,
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
(0, StepTestsUtil_1.parseAndValidateYamlConversion)(steps, CreateVariableMobileStep_1.CreateVariableMobileStep.stepName, stepDescriptor);
|
|
36
|
+
});
|
|
37
|
+
it('Parses a CreateVariable mobile step for element attribute (Android)', () => {
|
|
38
|
+
const stepDescriptor = {
|
|
39
|
+
find: {
|
|
40
|
+
findType: domUtil_1.FindType.FIND_ONE,
|
|
41
|
+
findTarget: {
|
|
42
|
+
selector: {
|
|
43
|
+
android: {
|
|
44
|
+
text: 'Profile',
|
|
45
|
+
},
|
|
46
|
+
uuid: '',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
generator: {
|
|
51
|
+
attribute: 'text',
|
|
52
|
+
type: CreateVariableStepDescriptor_1.VariableGenerator.ATTRIBUTE,
|
|
53
|
+
},
|
|
54
|
+
name: 'profile',
|
|
55
|
+
};
|
|
56
|
+
const steps = [
|
|
57
|
+
{
|
|
58
|
+
CreateVariable: stepDescriptor,
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
(0, StepTestsUtil_1.parseAndValidateYamlConversion)(steps, CreateVariableMobileStep_1.CreateVariableMobileStep.stepName, stepDescriptor);
|
|
62
|
+
});
|
|
63
|
+
it('Parses a CreateVariable mobile step for element attribute (iOS)', () => {
|
|
64
|
+
const stepDescriptor = {
|
|
65
|
+
find: {
|
|
66
|
+
findType: domUtil_1.FindType.FIND_ONE,
|
|
67
|
+
findTarget: {
|
|
68
|
+
selector: {
|
|
69
|
+
iOS: {
|
|
70
|
+
name: `PROFILE`,
|
|
71
|
+
},
|
|
72
|
+
uuid: '',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
generator: {
|
|
77
|
+
attribute: 'name',
|
|
78
|
+
type: CreateVariableStepDescriptor_1.VariableGenerator.ATTRIBUTE,
|
|
79
|
+
},
|
|
80
|
+
name: 'profile',
|
|
81
|
+
};
|
|
82
|
+
const steps = [
|
|
83
|
+
{
|
|
84
|
+
CreateVariable: stepDescriptor,
|
|
85
|
+
},
|
|
86
|
+
];
|
|
87
|
+
(0, StepTestsUtil_1.parseAndValidateYamlConversion)(steps, CreateVariableMobileStep_1.CreateVariableMobileStep.stepName, stepDescriptor);
|
|
88
|
+
});
|
|
89
|
+
it('Parses a CreateVariable mobile step for element count (Android)', () => {
|
|
90
|
+
const stepDescriptor = {
|
|
91
|
+
find: {
|
|
92
|
+
findType: domUtil_1.FindType.FIND_ALL,
|
|
93
|
+
findTarget: {
|
|
94
|
+
xpath: "//android.widget.TextView[@text='Car']",
|
|
95
|
+
},
|
|
96
|
+
foundElementSelectors: {
|
|
97
|
+
android: {
|
|
98
|
+
xpath: "//android.widget.TextView[@text='Car']",
|
|
99
|
+
},
|
|
100
|
+
uuid: '',
|
|
101
|
+
},
|
|
102
|
+
primarySelectors: {
|
|
103
|
+
xpath: "//android.widget.TextView[@text='Car']",
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
generator: {
|
|
107
|
+
type: CreateVariableStepDescriptor_1.VariableGenerator.ELEMENT_COUNT,
|
|
108
|
+
},
|
|
109
|
+
name: 'count',
|
|
110
|
+
};
|
|
111
|
+
const steps = [
|
|
112
|
+
{
|
|
113
|
+
CreateVariable: stepDescriptor,
|
|
114
|
+
},
|
|
115
|
+
];
|
|
116
|
+
(0, StepTestsUtil_1.parseAndValidateYamlConversion)(steps, CreateVariableMobileStep_1.CreateVariableMobileStep.stepName, stepDescriptor);
|
|
117
|
+
});
|
|
118
|
+
it('Parses a CreateVariable mobile step for element count (iOS)', () => {
|
|
119
|
+
const stepDescriptor = {
|
|
120
|
+
find: {
|
|
121
|
+
findType: domUtil_1.FindType.FIND_ALL,
|
|
122
|
+
findTarget: {
|
|
123
|
+
xpath: "//XCUIElementTypeStaticText[@name='Car']",
|
|
124
|
+
},
|
|
125
|
+
foundElementSelectors: {
|
|
126
|
+
android: {
|
|
127
|
+
xpath: "//android.widget.TextView[@text='Car']",
|
|
128
|
+
},
|
|
129
|
+
uuid: '',
|
|
130
|
+
},
|
|
131
|
+
primarySelectors: {
|
|
132
|
+
xpath: "//android.widget.TextView[@text='Car']",
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
generator: {
|
|
136
|
+
type: CreateVariableStepDescriptor_1.VariableGenerator.ELEMENT_COUNT,
|
|
137
|
+
},
|
|
138
|
+
name: 'count',
|
|
139
|
+
};
|
|
140
|
+
const steps = [
|
|
141
|
+
{
|
|
142
|
+
CreateVariable: stepDescriptor,
|
|
143
|
+
},
|
|
144
|
+
];
|
|
145
|
+
(0, StepTestsUtil_1.parseAndValidateYamlConversion)(steps, CreateVariableMobileStep_1.CreateVariableMobileStep.stepName, stepDescriptor);
|
|
146
|
+
});
|
|
147
|
+
it('Parses a CreateVariable mobile step for JavaScript snippet (Android)', () => {
|
|
148
|
+
const stepDescriptor = {
|
|
149
|
+
generator: {
|
|
150
|
+
javaScript: { encodedJS: 'myScript' },
|
|
151
|
+
type: CreateVariableStepDescriptor_1.VariableGenerator.JAVASCRIPT,
|
|
152
|
+
},
|
|
153
|
+
name: 'result',
|
|
154
|
+
};
|
|
155
|
+
const steps = [
|
|
156
|
+
{
|
|
157
|
+
CreateVariable: stepDescriptor,
|
|
158
|
+
},
|
|
159
|
+
];
|
|
160
|
+
(0, StepTestsUtil_1.parseAndValidateYamlConversion)(steps, CreateVariableMobileStep_1.CreateVariableMobileStep.stepName, stepDescriptor);
|
|
161
|
+
});
|
|
162
|
+
it('Parses a CreateVariable mobile step for element count (iOS)', () => {
|
|
163
|
+
const stepDescriptor = {
|
|
164
|
+
generator: {
|
|
165
|
+
javaScript: { encodedJS: 'myScript' },
|
|
166
|
+
type: CreateVariableStepDescriptor_1.VariableGenerator.JAVASCRIPT,
|
|
167
|
+
},
|
|
168
|
+
name: 'result',
|
|
169
|
+
};
|
|
170
|
+
const steps = [
|
|
171
|
+
{
|
|
172
|
+
CreateVariable: stepDescriptor,
|
|
173
|
+
},
|
|
174
|
+
];
|
|
175
|
+
(0, StepTestsUtil_1.parseAndValidateYamlConversion)(steps, CreateVariableMobileStep_1.CreateVariableMobileStep.stepName, stepDescriptor);
|
|
176
|
+
});
|
|
177
|
+
it('Humanizes a Create variable from pattern step', () => {
|
|
178
|
+
const stepDescriptor = {
|
|
179
|
+
CreateVariable: {
|
|
180
|
+
generator: {
|
|
181
|
+
pattern: `my value: {{digit:3}}`,
|
|
182
|
+
type: CreateVariableStepDescriptor_1.VariableGenerator.PATTERN,
|
|
183
|
+
},
|
|
184
|
+
name: 'myValue',
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
const step = (0, StepTestsUtil_1.loadRawStepIntoMablStep)(stepDescriptor);
|
|
188
|
+
expect(step.stepDescription()).toEqual(`Assign variable \"myValue\" value from string generated with format \"my value: {{digit:3}}\"`);
|
|
189
|
+
});
|
|
190
|
+
it('Humanizes a Create variable from email step', () => {
|
|
191
|
+
const stepDescriptor = {
|
|
192
|
+
CreateVariable: {
|
|
193
|
+
generator: {
|
|
194
|
+
type: CreateVariableStepDescriptor_1.VariableGenerator.EMAIL,
|
|
195
|
+
},
|
|
196
|
+
name: 'email',
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
const step = (0, StepTestsUtil_1.loadRawStepIntoMablStep)(stepDescriptor);
|
|
200
|
+
expect(step.stepDescription()).toEqual(`Generate a new mabl mailbox email address`);
|
|
201
|
+
});
|
|
202
|
+
it('Humanizes a Create variable from element attribute step (android)', () => {
|
|
203
|
+
const stepDescriptor = {
|
|
204
|
+
CreateVariable: {
|
|
205
|
+
find: {
|
|
206
|
+
findType: domUtil_1.FindType.FIND_ONE,
|
|
207
|
+
findTarget: {
|
|
208
|
+
selector: {
|
|
209
|
+
android: {
|
|
210
|
+
text: 'Profile',
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
generator: {
|
|
216
|
+
attribute: 'text',
|
|
217
|
+
type: CreateVariableStepDescriptor_1.VariableGenerator.ATTRIBUTE,
|
|
218
|
+
},
|
|
219
|
+
name: 'profile',
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
const step = (0, StepTestsUtil_1.loadRawStepIntoMablStep)(stepDescriptor);
|
|
223
|
+
expect(step.stepDescription()).toEqual(`Assign variable \"profile\" value from element attribute \"text\"`);
|
|
224
|
+
});
|
|
225
|
+
it('Humanizes a Create variable from element attribute step (iOS)', () => {
|
|
226
|
+
const stepDescriptor = {
|
|
227
|
+
CreateVariable: {
|
|
228
|
+
find: {
|
|
229
|
+
findType: domUtil_1.FindType.FIND_ONE,
|
|
230
|
+
findTarget: {
|
|
231
|
+
selector: {
|
|
232
|
+
iOS: {
|
|
233
|
+
name: `PROFILE`,
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
generator: {
|
|
239
|
+
attribute: 'name',
|
|
240
|
+
type: CreateVariableStepDescriptor_1.VariableGenerator.ATTRIBUTE,
|
|
241
|
+
},
|
|
242
|
+
name: 'profile',
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
const step = (0, StepTestsUtil_1.loadRawStepIntoMablStep)(stepDescriptor);
|
|
246
|
+
expect(step.stepDescription()).toEqual(`Assign variable \"profile\" value from element attribute \"name\"`);
|
|
247
|
+
});
|
|
248
|
+
it('Humanizes a Create variable from element count', () => {
|
|
249
|
+
const stepDescriptor = {
|
|
250
|
+
CreateVariable: {
|
|
251
|
+
find: {
|
|
252
|
+
findType: domUtil_1.FindType.FIND_ALL,
|
|
253
|
+
findTarget: {
|
|
254
|
+
xpath: "//android.widget.TextView[@text='Car']",
|
|
255
|
+
},
|
|
256
|
+
foundElementSelectors: {
|
|
257
|
+
android: {
|
|
258
|
+
xpath: "//android.widget.TextView[@text='Car']",
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
primarySelectors: {
|
|
262
|
+
xpath: "//android.widget.TextView[@text='Car']",
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
generator: {
|
|
266
|
+
type: CreateVariableStepDescriptor_1.VariableGenerator.ELEMENT_COUNT,
|
|
267
|
+
},
|
|
268
|
+
name: 'count',
|
|
269
|
+
},
|
|
270
|
+
};
|
|
271
|
+
const step = (0, StepTestsUtil_1.loadRawStepIntoMablStep)(stepDescriptor);
|
|
272
|
+
expect(step.stepDescription()).toEqual(`Assign variable \"count\" value from element count using xpath: //android.widget.TextView[@text='Car']`);
|
|
273
|
+
});
|
|
274
|
+
it('Humanizes a Create variable from script snippet', () => {
|
|
275
|
+
const stepDescriptor = {
|
|
276
|
+
CreateVariable: {
|
|
277
|
+
generator: {
|
|
278
|
+
javaScript: { encodedJS: 'myScript' },
|
|
279
|
+
type: CreateVariableStepDescriptor_1.VariableGenerator.JAVASCRIPT,
|
|
280
|
+
},
|
|
281
|
+
name: 'result',
|
|
282
|
+
},
|
|
283
|
+
};
|
|
284
|
+
const step = (0, StepTestsUtil_1.loadRawStepIntoMablStep)(stepDescriptor);
|
|
285
|
+
expect(step.stepDescription()).toEqual(`Assign variable \"result\" using script`);
|
|
286
|
+
});
|
|
287
|
+
});
|