@mablhq/mabl-cli 2.8.18 → 2.11.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/mablApiClient.js +41 -1
- package/commands/commandUtil/fileUtil.js +8 -7
- package/commands/config/config_cmds/install.js +2 -2
- package/commands/environments/environments_cmds/create.js +3 -2
- package/commands/environments/environments_cmds/update.js +1 -1
- package/commands/tests/testsUtil.js +1 -0
- package/core/execution/newman-types.js +2 -1
- package/execution/index.js +9 -9
- package/execution/index.js.LICENSE.txt +60 -0
- package/execution/runAppiumServer.js +16 -4
- package/index.d.ts +2 -0
- package/mablApi/index.js +1 -1
- package/mablscript/importer.js +6 -0
- package/mablscript/mobile/steps/InstallAppStep.js +22 -0
- package/mablscript/mobile/steps/PrepareSessionStep.js +19 -0
- package/mablscript/mobile/steps/ScrollStep.js +52 -8
- package/mablscript/mobile/steps/UninstallAppStep.js +22 -0
- package/mablscript/mobile/tests/TestMobileFindDescriptors.js +72 -1
- package/mablscript/mobile/tests/steps/InstallAppStep.mobiletest.js +20 -0
- package/mablscript/mobile/tests/steps/ScrollStep.mobiletest.js +289 -78
- package/mablscript/mobile/tests/steps/UninstallAppStep.mobiletest.js +20 -0
- package/mablscript/steps/AwaitTabStep.js +36 -8
- package/mablscript/types/mobile/InstallAppStepDescriptor.js +2 -0
- package/mablscript/types/mobile/PrepareSessionStepDescriptor.js +2 -0
- package/mablscript/types/mobile/ScrollStepDescriptor.js +14 -0
- package/mablscript/types/mobile/UninstallAppStepDescriptor.js +2 -0
- package/mablscriptFind/index.js +1 -1
- package/package.json +2 -6
- package/resources/mablFind.js +1 -1
- package/socketTunnel/index.js +2 -0
- package/socketTunnel/index.js.LICENSE.txt +66 -0
- package/upload/index.js +1 -1
package/mablscript/importer.js
CHANGED
|
@@ -64,6 +64,9 @@ const CreateVariableStepDescriptor_1 = require("./types/CreateVariableStepDescri
|
|
|
64
64
|
const JavaScriptDescriptor_1 = require("./types/JavaScriptDescriptor");
|
|
65
65
|
const MablStepV2_1 = require("./MablStepV2");
|
|
66
66
|
const PushFileStep_1 = require("./mobile/steps/PushFileStep");
|
|
67
|
+
const InstallAppStep_1 = require("./mobile/steps/InstallAppStep");
|
|
68
|
+
const UninstallAppStep_1 = require("./mobile/steps/UninstallAppStep");
|
|
69
|
+
const PrepareSessionStep_1 = require("./mobile/steps/PrepareSessionStep");
|
|
67
70
|
const ActionTypes = [
|
|
68
71
|
AwaitDownloadAction_1.AwaitDownloadAction,
|
|
69
72
|
AwaitPDFDownloadAction_1.AwaitPDFDownloadAction,
|
|
@@ -117,13 +120,16 @@ const StepTypes = [
|
|
|
117
120
|
const MobileStepTypes = [
|
|
118
121
|
AssertStep_1.AssertStep,
|
|
119
122
|
CreateVariableMobileStep_1.CreateVariableMobileStep,
|
|
123
|
+
InstallAppStep_1.InstallAppStep,
|
|
120
124
|
NavigateBackStep_1.NavigateBackStep,
|
|
121
125
|
NavigateHomeStep_1.NavigateHomeStep,
|
|
122
126
|
TapStep_1.TapStep,
|
|
123
127
|
EnterTextStep_2.EnterTextStep,
|
|
124
128
|
SetOrientationStep_1.SetOrientationStep,
|
|
125
129
|
ScrollStep_1.ScrollStep,
|
|
130
|
+
PrepareSessionStep_1.PrepareSessionStep,
|
|
126
131
|
PushFileStep_1.PushFileStep,
|
|
132
|
+
UninstallAppStep_1.UninstallAppStep,
|
|
127
133
|
];
|
|
128
134
|
const SyntheticActionCodes = [
|
|
129
135
|
'autologin',
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InstallAppStep = void 0;
|
|
4
|
+
const MablStepV2_1 = require("../../MablStepV2");
|
|
5
|
+
class InstallAppStep extends MablStepV2_1.MablStepV2 {
|
|
6
|
+
constructor(descriptor) {
|
|
7
|
+
super(InstallAppStep.stepName, descriptor, 'installApp');
|
|
8
|
+
}
|
|
9
|
+
stepDescription() {
|
|
10
|
+
if (this.descriptor.packageName) {
|
|
11
|
+
return `Install app - ${this.descriptor.packageName}`;
|
|
12
|
+
}
|
|
13
|
+
return `Install primary app under test`;
|
|
14
|
+
}
|
|
15
|
+
static fromYaml(_stepName, stepDescriptor) {
|
|
16
|
+
return new InstallAppStep(stepDescriptor);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.InstallAppStep = InstallAppStep;
|
|
20
|
+
InstallAppStep.stepName = 'InstallApp';
|
|
21
|
+
InstallAppStep.yamlMablScriptNames = [InstallAppStep.stepName];
|
|
22
|
+
InstallAppStep.stepVersion = 2;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PrepareSessionStep = void 0;
|
|
4
|
+
const MablStepV2_1 = require("../../MablStepV2");
|
|
5
|
+
class PrepareSessionStep extends MablStepV2_1.MablStepV2 {
|
|
6
|
+
constructor(descriptor) {
|
|
7
|
+
super(PrepareSessionStep.stepName, descriptor, 'prepareSession');
|
|
8
|
+
}
|
|
9
|
+
stepDescription() {
|
|
10
|
+
return `Launch and initialize app session`;
|
|
11
|
+
}
|
|
12
|
+
static fromYaml(_stepName, stepDescriptor) {
|
|
13
|
+
return new PrepareSessionStep(stepDescriptor);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.PrepareSessionStep = PrepareSessionStep;
|
|
17
|
+
PrepareSessionStep.stepName = 'PrepareSession';
|
|
18
|
+
PrepareSessionStep.yamlMablScriptNames = [PrepareSessionStep.stepName];
|
|
19
|
+
PrepareSessionStep.stepVersion = 2;
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getScrollDirectionAndPercentageFromCoordinates = exports.formatPercentageVal = exports.humanizeScrollInformation = exports.ScrollStep = void 0;
|
|
4
4
|
const MablStepV2_1 = require("../../MablStepV2");
|
|
5
|
+
const ScrollStepDescriptor_1 = require("../../types/mobile/ScrollStepDescriptor");
|
|
6
|
+
const stepUtil_1 = require("./stepUtil");
|
|
5
7
|
const STEP_NAME = 'Scroll';
|
|
6
8
|
class ScrollStep extends MablStepV2_1.MablStepV2 {
|
|
7
9
|
constructor(descriptor) {
|
|
8
10
|
super(ScrollStep.stepName, descriptor, 'scroll');
|
|
9
11
|
}
|
|
10
12
|
stepDescription() {
|
|
11
|
-
return humanizeScrollInformation(this.descriptor
|
|
13
|
+
return humanizeScrollInformation(this.descriptor);
|
|
12
14
|
}
|
|
13
15
|
static fromYaml(_stepName, stepDescriptor) {
|
|
16
|
+
if (!stepDescriptor.scrollDirection) {
|
|
17
|
+
const { scrollDirection } = getScrollDirectionAndPercentageFromCoordinates(stepDescriptor.coordinates);
|
|
18
|
+
stepDescriptor.scrollDirection = scrollDirection;
|
|
19
|
+
}
|
|
20
|
+
if (!stepDescriptor.scrollType) {
|
|
21
|
+
stepDescriptor.scrollType = ScrollStepDescriptor_1.ScrollType.ScrollDeviceScreen;
|
|
22
|
+
}
|
|
14
23
|
return new ScrollStep(stepDescriptor);
|
|
15
24
|
}
|
|
16
25
|
}
|
|
@@ -18,20 +27,55 @@ exports.ScrollStep = ScrollStep;
|
|
|
18
27
|
ScrollStep.stepName = STEP_NAME;
|
|
19
28
|
ScrollStep.yamlMablScriptNames = [ScrollStep.stepName];
|
|
20
29
|
ScrollStep.stepVersion = 2;
|
|
30
|
+
function humanizeScrollInformation(stepDescriptor) {
|
|
31
|
+
switch (stepDescriptor.scrollType) {
|
|
32
|
+
case ScrollStepDescriptor_1.ScrollType.ScrollDeviceScreen: {
|
|
33
|
+
const { coordinates } = stepDescriptor;
|
|
34
|
+
return humanizeCoordinateScroll(coordinates, 'of the screen');
|
|
35
|
+
}
|
|
36
|
+
case ScrollStepDescriptor_1.ScrollType.ScrollToElement: {
|
|
37
|
+
const { find, maxScrollAttempts, scrollDirection, targetElementDescriptor, } = stepDescriptor;
|
|
38
|
+
const containerElementDescription = (0, stepUtil_1.getElementDescriptionFromMobileFindDescriptor)(find);
|
|
39
|
+
const targetElementDescription = (0, stepUtil_1.getElementDescriptionFromMobileFindDescriptor)(targetElementDescriptor);
|
|
40
|
+
return `Scroll ${scrollDirection} a maximum of ${maxScrollAttempts} times within the ${containerElementDescription} until the ${targetElementDescription} is visible`;
|
|
41
|
+
}
|
|
42
|
+
case ScrollStepDescriptor_1.ScrollType.ScrollWithinElement: {
|
|
43
|
+
const { coordinates, find } = stepDescriptor;
|
|
44
|
+
const containerElementDescription = (0, stepUtil_1.getElementDescriptionFromMobileFindDescriptor)(find);
|
|
45
|
+
return humanizeCoordinateScroll(coordinates, `within the ${containerElementDescription}`);
|
|
46
|
+
}
|
|
47
|
+
default:
|
|
48
|
+
return 'Unknown scroll step type';
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.humanizeScrollInformation = humanizeScrollInformation;
|
|
52
|
+
function humanizeCoordinateScroll(coordinates, scrollTargetActionString) {
|
|
53
|
+
const { scrollDirection, scrollPercent } = getScrollDirectionAndPercentageFromCoordinates(coordinates);
|
|
54
|
+
return `Scroll ${scrollDirection} ${scrollPercent} ${scrollTargetActionString}`;
|
|
55
|
+
}
|
|
21
56
|
function formatPercentageVal(percent) {
|
|
22
57
|
return `${Math.round(percent * 10000) / 100}%`;
|
|
23
58
|
}
|
|
24
59
|
exports.formatPercentageVal = formatPercentageVal;
|
|
25
|
-
function
|
|
60
|
+
function getScrollDirectionAndPercentageFromCoordinates(coordinates) {
|
|
61
|
+
if (!coordinates) {
|
|
62
|
+
return { scrollDirection: ScrollStepDescriptor_1.ScrollDirection.Down, scrollPercent: '80%' };
|
|
63
|
+
}
|
|
26
64
|
const yScrollDistance = Math.abs(coordinates.to.yPercent - coordinates.from.yPercent);
|
|
27
65
|
const xScrollDistance = Math.abs(coordinates.to.xPercent - coordinates.from.xPercent);
|
|
28
66
|
if (yScrollDistance > xScrollDistance) {
|
|
29
67
|
const scrollDistanceFormatted = formatPercentageVal(yScrollDistance);
|
|
30
|
-
const
|
|
31
|
-
|
|
68
|
+
const isScrollUp = coordinates.from.yPercent < coordinates.to.yPercent;
|
|
69
|
+
const scrollDirection = isScrollUp
|
|
70
|
+
? ScrollStepDescriptor_1.ScrollDirection.Up
|
|
71
|
+
: ScrollStepDescriptor_1.ScrollDirection.Down;
|
|
72
|
+
return { scrollDirection, scrollPercent: scrollDistanceFormatted };
|
|
32
73
|
}
|
|
33
74
|
const scrollDistanceFormatted = formatPercentageVal(xScrollDistance);
|
|
34
|
-
const
|
|
35
|
-
|
|
75
|
+
const isScrollLeft = coordinates.from.xPercent < coordinates.to.xPercent;
|
|
76
|
+
const scrollDirection = isScrollLeft
|
|
77
|
+
? ScrollStepDescriptor_1.ScrollDirection.Left
|
|
78
|
+
: ScrollStepDescriptor_1.ScrollDirection.Right;
|
|
79
|
+
return { scrollDirection, scrollPercent: scrollDistanceFormatted };
|
|
36
80
|
}
|
|
37
|
-
exports.
|
|
81
|
+
exports.getScrollDirectionAndPercentageFromCoordinates = getScrollDirectionAndPercentageFromCoordinates;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UninstallAppStep = void 0;
|
|
4
|
+
const MablStepV2_1 = require("../../MablStepV2");
|
|
5
|
+
class UninstallAppStep extends MablStepV2_1.MablStepV2 {
|
|
6
|
+
constructor(descriptor) {
|
|
7
|
+
super(UninstallAppStep.stepName, descriptor, 'uninstallApp');
|
|
8
|
+
}
|
|
9
|
+
stepDescription() {
|
|
10
|
+
if (this.descriptor.appId) {
|
|
11
|
+
return `Uninstall app - ${this.descriptor.appId}`;
|
|
12
|
+
}
|
|
13
|
+
return `Uninstall primary app under test`;
|
|
14
|
+
}
|
|
15
|
+
static fromYaml(_stepName, stepDescriptor) {
|
|
16
|
+
return new UninstallAppStep(stepDescriptor);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.UninstallAppStep = UninstallAppStep;
|
|
20
|
+
UninstallAppStep.stepName = 'UninstallApp';
|
|
21
|
+
UninstallAppStep.yamlMablScriptNames = [UninstallAppStep.stepName];
|
|
22
|
+
UninstallAppStep.stepVersion = 2;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AndroidTestLabWebViewClickCounterMobileFindDescriptor = exports.iOSTestLabWebViewClickCounterMobileFindDescriptor = exports.AndroidWebViewTextFieldMobileFindDescriptor = exports.iOSWebViewTextFieldMobileFindDescriptor = void 0;
|
|
3
|
+
exports.iOSTwoHorizontalScrollGrid2MobileFindDescriptor = exports.iOSVerticalGridCar75MobileFindDescriptor = exports.iOSVerticalGridContainerMobileFindDescriptor = exports.AndroidTestLabWebViewClickCounterMobileFindDescriptor = exports.iOSTestLabWebViewClickCounterMobileFindDescriptor = exports.AndroidWebViewTextFieldMobileFindDescriptor = exports.iOSWebViewTextFieldMobileFindDescriptor = void 0;
|
|
4
4
|
const domUtil_1 = require("../../../domUtil");
|
|
5
5
|
exports.iOSWebViewTextFieldMobileFindDescriptor = {
|
|
6
6
|
findType: domUtil_1.FindType.FIND_ONE,
|
|
@@ -213,3 +213,74 @@ exports.AndroidTestLabWebViewClickCounterMobileFindDescriptor = {
|
|
|
213
213
|
url: 'https://storage.googleapis.com/public-dev-test-lab/click/click-counter.html',
|
|
214
214
|
},
|
|
215
215
|
};
|
|
216
|
+
exports.iOSVerticalGridContainerMobileFindDescriptor = {
|
|
217
|
+
findTarget: {
|
|
218
|
+
selector: {
|
|
219
|
+
iOS: {
|
|
220
|
+
type: 'XCUIElementTypeOther',
|
|
221
|
+
enabled: true,
|
|
222
|
+
accessible: false,
|
|
223
|
+
rect: {
|
|
224
|
+
x: 0,
|
|
225
|
+
y: 143,
|
|
226
|
+
width: 390,
|
|
227
|
+
height: 5142,
|
|
228
|
+
},
|
|
229
|
+
index: 0,
|
|
230
|
+
xpath: '//XCUIElementTypeApplication/XCUIElementTypeWindow/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeScrollView/XCUIElementTypeOther',
|
|
231
|
+
alternateXPaths: [],
|
|
232
|
+
},
|
|
233
|
+
uuid: '',
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
findType: domUtil_1.FindType.FIND_ONE,
|
|
237
|
+
};
|
|
238
|
+
exports.iOSVerticalGridCar75MobileFindDescriptor = {
|
|
239
|
+
findTarget: {
|
|
240
|
+
selector: {
|
|
241
|
+
iOS: {
|
|
242
|
+
rect: {
|
|
243
|
+
width: 51,
|
|
244
|
+
x: 219,
|
|
245
|
+
y: 657,
|
|
246
|
+
height: 21,
|
|
247
|
+
},
|
|
248
|
+
xpath: '//XCUIElementTypeApplication/XCUIElementTypeWindow/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeScrollView/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeButton[55]/XCUIElementTypeStaticText',
|
|
249
|
+
name: 'Car 75',
|
|
250
|
+
index: 1,
|
|
251
|
+
alternateXPaths: [
|
|
252
|
+
'//XCUIElementTypeStaticText[@name="Car 75"]',
|
|
253
|
+
'//XCUIElementTypeButton[@name="Car 75"]/XCUIElementTypeStaticText',
|
|
254
|
+
],
|
|
255
|
+
label: 'Car 75',
|
|
256
|
+
type: 'XCUIElementTypeStaticText',
|
|
257
|
+
enabled: true,
|
|
258
|
+
},
|
|
259
|
+
uuid: '',
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
findType: domUtil_1.FindType.FIND_ONE,
|
|
263
|
+
};
|
|
264
|
+
exports.iOSTwoHorizontalScrollGrid2MobileFindDescriptor = {
|
|
265
|
+
findTarget: {
|
|
266
|
+
selector: {
|
|
267
|
+
uuid: 'd0efcf61-de79-49d2-91e3-dd318185576b',
|
|
268
|
+
iOS: {
|
|
269
|
+
type: 'XCUIElementTypeOther',
|
|
270
|
+
name: 'grid-2',
|
|
271
|
+
enabled: true,
|
|
272
|
+
accessible: false,
|
|
273
|
+
rect: {
|
|
274
|
+
x: 0,
|
|
275
|
+
y: 517,
|
|
276
|
+
width: 1125,
|
|
277
|
+
height: 301,
|
|
278
|
+
},
|
|
279
|
+
index: 0,
|
|
280
|
+
xpath: '//XCUIElementTypeApplication/XCUIElementTypeWindow/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeScrollView[2]/XCUIElementTypeOther/XCUIElementTypeOther',
|
|
281
|
+
alternateXPaths: ['//XCUIElementTypeOther[@name="grid-2"]'],
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
findType: domUtil_1.FindType.FIND_ONE,
|
|
286
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const InstallAppStep_1 = require("../../steps/InstallAppStep");
|
|
4
|
+
const StepTestsUtil_1 = require("../StepTestsUtil");
|
|
5
|
+
describe('Install App steps parse correctly', () => {
|
|
6
|
+
it('Parses an InstallApp step', () => {
|
|
7
|
+
const stepDescriptor = {
|
|
8
|
+
id: 'hereYouGo',
|
|
9
|
+
actionCode: 'installApp',
|
|
10
|
+
};
|
|
11
|
+
const steps = [
|
|
12
|
+
{
|
|
13
|
+
InstallApp: stepDescriptor,
|
|
14
|
+
},
|
|
15
|
+
];
|
|
16
|
+
(0, StepTestsUtil_1.parseAndValidateYamlConversion)(steps, InstallAppStep_1.InstallAppStep.stepName, stepDescriptor);
|
|
17
|
+
const tapStep = new InstallAppStep_1.InstallAppStep(stepDescriptor);
|
|
18
|
+
expect(tapStep.stepId()).toEqual(stepDescriptor.id);
|
|
19
|
+
});
|
|
20
|
+
});
|