@mablhq/mabl-cli 2.5.4 → 2.8.18
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 +14 -0
- package/api/types.js +1 -0
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumPageDelegate.js +3 -0
- package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractPageDelegate.js +3 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +11 -6
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +6 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +3 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +1 -1
- package/cli.js +1 -1
- package/commands/commandUtil/codeInsights.js +7 -1
- package/domUtil/index.js +1 -1
- package/execution/index.js +9 -9
- package/http/axiosProxyConfig.js +2 -25
- package/index.d.ts +1 -0
- package/mablApi/index.js +1 -1
- package/mablscript/importer.js +2 -0
- package/mablscript/mobile/steps/PushFileStep.js +27 -0
- package/mablscript/mobile/tests/steps/PushFileStep.mobiletest.js +55 -0
- package/mablscript/steps/CreateVariableStep.js +23 -0
- package/mablscript/types/CreateVariableStepDescriptor.js +1 -0
- package/mablscript/types/mobile/PushFileDescriptor.js +2 -0
- package/mablscriptFind/index.js +1 -1
- package/mobile/index.js +2 -0
- package/mobile/types.js +2 -0
- package/package.json +6 -4
- package/proxy/index.js +2 -2
- package/resources/mablFind.js +1 -1
- package/upload/index.js +2 -5
- package/upload/index.js.LICENSE.txt +27 -0
- package/util/asyncUtil.js +9 -7
- package/util/fileUploadUtil.js +33 -1
- package/util/logUtils.js +14 -8
- package/util/pureUtil.js +9 -1
package/mablscript/importer.js
CHANGED
|
@@ -63,6 +63,7 @@ const NavigateHomeStep_1 = require("./mobile/steps/NavigateHomeStep");
|
|
|
63
63
|
const CreateVariableStepDescriptor_1 = require("./types/CreateVariableStepDescriptor");
|
|
64
64
|
const JavaScriptDescriptor_1 = require("./types/JavaScriptDescriptor");
|
|
65
65
|
const MablStepV2_1 = require("./MablStepV2");
|
|
66
|
+
const PushFileStep_1 = require("./mobile/steps/PushFileStep");
|
|
66
67
|
const ActionTypes = [
|
|
67
68
|
AwaitDownloadAction_1.AwaitDownloadAction,
|
|
68
69
|
AwaitPDFDownloadAction_1.AwaitPDFDownloadAction,
|
|
@@ -122,6 +123,7 @@ const MobileStepTypes = [
|
|
|
122
123
|
EnterTextStep_2.EnterTextStep,
|
|
123
124
|
SetOrientationStep_1.SetOrientationStep,
|
|
124
125
|
ScrollStep_1.ScrollStep,
|
|
126
|
+
PushFileStep_1.PushFileStep,
|
|
125
127
|
];
|
|
126
128
|
const SyntheticActionCodes = [
|
|
127
129
|
'autologin',
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PushFileStep = void 0;
|
|
4
|
+
const MablStepV2_1 = require("../../MablStepV2");
|
|
5
|
+
class PushFileStep extends MablStepV2_1.MablStepV2 {
|
|
6
|
+
constructor(descriptor) {
|
|
7
|
+
super(PushFileStep.stepName, descriptor, PushFileStep.stepName);
|
|
8
|
+
}
|
|
9
|
+
stepDescription() {
|
|
10
|
+
const filesLength = this.descriptor.files.length;
|
|
11
|
+
if (filesLength > 1) {
|
|
12
|
+
return `Push ${filesLength} files to the test device`;
|
|
13
|
+
}
|
|
14
|
+
const firstFile = this.descriptor.files[0];
|
|
15
|
+
if (firstFile.file.name) {
|
|
16
|
+
return `Push the file "${firstFile.file.name}" to the test device at path "${firstFile.path}"`;
|
|
17
|
+
}
|
|
18
|
+
return `Push file to the test device at path "${firstFile.path}"`;
|
|
19
|
+
}
|
|
20
|
+
static fromYaml(_stepName, stepDescriptor) {
|
|
21
|
+
return new PushFileStep(stepDescriptor);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.PushFileStep = PushFileStep;
|
|
25
|
+
PushFileStep.stepName = 'PushFile';
|
|
26
|
+
PushFileStep.yamlMablScriptNames = [PushFileStep.stepName];
|
|
27
|
+
PushFileStep.stepVersion = 2;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const StepTestsUtil_1 = require("../StepTestsUtil");
|
|
4
|
+
const PushFileStep_1 = require("../../steps/PushFileStep");
|
|
5
|
+
describe('Push File steps parse correctly', () => {
|
|
6
|
+
it('Parses a PushFile step', () => {
|
|
7
|
+
const pushFileDescriptor = {
|
|
8
|
+
id: 'pushItRealGood',
|
|
9
|
+
files: [
|
|
10
|
+
{
|
|
11
|
+
file: {
|
|
12
|
+
id: 'id-1',
|
|
13
|
+
name: 'candy1.jpeg',
|
|
14
|
+
},
|
|
15
|
+
path: '@mabl.sandbox:documents/Presentation.key',
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
const steps = [
|
|
20
|
+
{
|
|
21
|
+
PushFile: pushFileDescriptor,
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
(0, StepTestsUtil_1.parseAndValidateYamlConversion)(steps, PushFileStep_1.PushFileStep.stepName, pushFileDescriptor);
|
|
25
|
+
const pushFileStep = new PushFileStep_1.PushFileStep(pushFileDescriptor);
|
|
26
|
+
expect(pushFileStep.stepId()).toEqual(pushFileDescriptor.id);
|
|
27
|
+
const stepDescription = pushFileStep.stepDescription();
|
|
28
|
+
expect(stepDescription).toEqual(`Push the file \"candy1.jpeg\" to the test device at path \"@mabl.sandbox:documents/Presentation.key\"`);
|
|
29
|
+
});
|
|
30
|
+
it('Humanizes a push file step with multiple files', () => {
|
|
31
|
+
const pushFileDescriptor = {
|
|
32
|
+
id: 'pushItRealGood',
|
|
33
|
+
files: [
|
|
34
|
+
{
|
|
35
|
+
file: {
|
|
36
|
+
id: 'id-1',
|
|
37
|
+
name: 'candy1.jpeg',
|
|
38
|
+
},
|
|
39
|
+
path: '@mabl.sandbox:documents/Presentation.key',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
file: {
|
|
43
|
+
id: 'id-2',
|
|
44
|
+
name: 'candy2.jpeg',
|
|
45
|
+
},
|
|
46
|
+
path: '@mabl.sandbox:documents/Presentations.key',
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
};
|
|
50
|
+
const pushFileStep = new PushFileStep_1.PushFileStep(pushFileDescriptor);
|
|
51
|
+
expect(pushFileStep.stepId()).toEqual(pushFileDescriptor.id);
|
|
52
|
+
const stepDescription = pushFileStep.stepDescription();
|
|
53
|
+
expect(stepDescription).toEqual(`Push 2 files to the test device`);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -21,6 +21,9 @@ class CreateVariableStep extends MablStep_1.MablStep {
|
|
|
21
21
|
}
|
|
22
22
|
calculateGenerationType() {
|
|
23
23
|
if (this.actions.length === 2 && this.actions[0] instanceof FindAction_1.FindAction) {
|
|
24
|
+
if (this.actions[0].findDescriptor.findType === domUtil_1.FindType.FIND_COOKIE) {
|
|
25
|
+
return CreateVariableStepDescriptor_1.VariableGenerator.COOKIE_ATTRIBUTE;
|
|
26
|
+
}
|
|
24
27
|
if (this.actions[1] instanceof ExtractAction_1.ExtractAction) {
|
|
25
28
|
return CreateVariableStepDescriptor_1.VariableGenerator.ATTRIBUTE;
|
|
26
29
|
}
|
|
@@ -45,6 +48,21 @@ class CreateVariableStep extends MablStep_1.MablStep {
|
|
|
45
48
|
toStepDescriptor() {
|
|
46
49
|
let step;
|
|
47
50
|
switch (this.generationType) {
|
|
51
|
+
case CreateVariableStepDescriptor_1.VariableGenerator.COOKIE_ATTRIBUTE:
|
|
52
|
+
const cookieFindAction = this.actions[0];
|
|
53
|
+
const cookieFind = cookieFindAction.toDescriptor();
|
|
54
|
+
step = {
|
|
55
|
+
name: this.variableName,
|
|
56
|
+
generator: {
|
|
57
|
+
type: CreateVariableStepDescriptor_1.VariableGenerator.COOKIE_ATTRIBUTE,
|
|
58
|
+
cookieSelector: cookieFind.findTarget,
|
|
59
|
+
attribute: this.actions[1].extractionAttribute,
|
|
60
|
+
},
|
|
61
|
+
find: cookieFind,
|
|
62
|
+
descriptorToActionMap: new Map().set(cookieFind, cookieFindAction),
|
|
63
|
+
actionCode: this.actionCode,
|
|
64
|
+
};
|
|
65
|
+
break;
|
|
48
66
|
case CreateVariableStepDescriptor_1.VariableGenerator.ATTRIBUTE:
|
|
49
67
|
const findAction = this.actions[0];
|
|
50
68
|
const find = findAction.toDescriptor();
|
|
@@ -186,6 +204,11 @@ class CreateVariableStep extends MablStep_1.MablStep {
|
|
|
186
204
|
generator.pattern,
|
|
187
205
|
]));
|
|
188
206
|
break;
|
|
207
|
+
case CreateVariableStepDescriptor_1.VariableGenerator.COOKIE_ATTRIBUTE:
|
|
208
|
+
actions.push(new FindAction_1.FindAction('find_cookie', [generator.cookieSelector]));
|
|
209
|
+
const extractCookieArgs = [generator.attribute];
|
|
210
|
+
actions.push(new ExtractAction_1.ExtractAction('extract_attribute', extractCookieArgs));
|
|
211
|
+
break;
|
|
189
212
|
}
|
|
190
213
|
const step = new CreateVariableStep('as', [variableName], actions);
|
|
191
214
|
step.setStepId(stepArgs.id);
|
|
@@ -4,6 +4,7 @@ exports.VariableGenerator = void 0;
|
|
|
4
4
|
var VariableGenerator;
|
|
5
5
|
(function (VariableGenerator) {
|
|
6
6
|
VariableGenerator["ATTRIBUTE"] = "ATTRIBUTE";
|
|
7
|
+
VariableGenerator["COOKIE_ATTRIBUTE"] = "COOKIE_ATTRIBUTE";
|
|
7
8
|
VariableGenerator["ELEMENT_COUNT"] = "ELEMENT_COUNT";
|
|
8
9
|
VariableGenerator["EMAIL"] = "EMAIL";
|
|
9
10
|
VariableGenerator["JAVASCRIPT"] = "JAVASCRIPT";
|