@mablhq/mabl-cli 1.62.1 → 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/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/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/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 +8 -3
- 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,133 @@
|
|
|
1
|
+
const appium = require('appium');
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
const APPIUM_SERVER_READY = 'APPIUM_SERVER_READY';
|
|
10
|
+
const APPIUM_SERVER_SHUTDOWN = 'APPIUM_SERVER_SHUTDOWN';
|
|
11
|
+
const APPIUM_SERVER_LOG = 'APPIUM_SERVER_LOG';
|
|
12
|
+
const APPIUM_SERVER_PARENT_ALIVE = 'APPIUM_SERVER_PARENT_ALIVE';
|
|
13
|
+
const APPIUM_SERVER_CHECK_IN = 'APPIUM_SERVER_CHECK_IN';
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
const CHECK_IN_FAIL_LIMIT_MILLIS = 15_000;
|
|
17
|
+
|
|
18
|
+
const CHECK_IN_INTERVAL_MILLIS = 5_000;
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
const appiumConfig = JSON.parse(process.argv[2]);
|
|
22
|
+
|
|
23
|
+
if (appiumConfig.androidHome) {
|
|
24
|
+
process.env.ANDROID_HOME = appiumConfig.androidHome;
|
|
25
|
+
delete appiumConfig.androidHome;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
appiumConfig.allowInsecure = ['chromedriver_autodownload'];
|
|
31
|
+
|
|
32
|
+
let server;
|
|
33
|
+
let shutdownCalled = false;
|
|
34
|
+
let lastKnownCheckInTime = Date.now();
|
|
35
|
+
let intervalCheckIn;
|
|
36
|
+
|
|
37
|
+
appium
|
|
38
|
+
.main({...appiumConfig, logHandler: logHandlerFunc})
|
|
39
|
+
.then((serverInstance) => {
|
|
40
|
+
server = serverInstance;
|
|
41
|
+
process.send({type: APPIUM_SERVER_READY});
|
|
42
|
+
lastKnownCheckInTime = Date.now();
|
|
43
|
+
intervalCheckIn = global.setInterval(
|
|
44
|
+
checkInOnParent,
|
|
45
|
+
CHECK_IN_INTERVAL_MILLIS,
|
|
46
|
+
);
|
|
47
|
+
})
|
|
48
|
+
.catch((error) => {
|
|
49
|
+
|
|
50
|
+
throw error;
|
|
51
|
+
});
|
|
52
|
+
process.on('message', (message) => {
|
|
53
|
+
switch (message) {
|
|
54
|
+
case APPIUM_SERVER_PARENT_ALIVE:
|
|
55
|
+
lastKnownCheckInTime = Date.now();
|
|
56
|
+
break;
|
|
57
|
+
case APPIUM_SERVER_SHUTDOWN:
|
|
58
|
+
shutdownCalled = true;
|
|
59
|
+
server.close().catch((error) => {
|
|
60
|
+
|
|
61
|
+
throw error;
|
|
62
|
+
});
|
|
63
|
+
break;
|
|
64
|
+
default:
|
|
65
|
+
console.log('unsupported message', message);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
function logHandlerFunc(logLevel, log) {
|
|
71
|
+
process.send({
|
|
72
|
+
type: APPIUM_SERVER_LOG,
|
|
73
|
+
payload: {
|
|
74
|
+
logLevel,
|
|
75
|
+
log,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
const originalExit = process.exit;
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
process.exit = (code) => {
|
|
86
|
+
if (shutdownCalled) {
|
|
87
|
+
global.clearInterval(intervalCheckIn);
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
originalExit();
|
|
91
|
+
process.kill();
|
|
92
|
+
}
|
|
93
|
+
if (code && code > 0) {
|
|
94
|
+
const stack = new Error().stack;
|
|
95
|
+
process.send({
|
|
96
|
+
type: APPIUM_SERVER_LOG,
|
|
97
|
+
payload: {
|
|
98
|
+
logLevel: 'error',
|
|
99
|
+
log: `process.exit() call prevented - ${stack}`,
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
process.on('disconnect', () => {
|
|
107
|
+
console.log(
|
|
108
|
+
'[runAppiumServer.js] lost connection to parent process, terminating',
|
|
109
|
+
);
|
|
110
|
+
originalExit();
|
|
111
|
+
process.kill();
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
function checkInOnParent() {
|
|
116
|
+
try {
|
|
117
|
+
process.send({type: APPIUM_SERVER_CHECK_IN});
|
|
118
|
+
const currentTime = Date.now();
|
|
119
|
+
const timeSinceLastCheckIn = currentTime - lastKnownCheckInTime;
|
|
120
|
+
if (timeSinceLastCheckIn > CHECK_IN_FAIL_LIMIT_MILLIS) {
|
|
121
|
+
console.log(
|
|
122
|
+
'[runAppiumServer.js] parent process has gone dark, terminating',
|
|
123
|
+
);
|
|
124
|
+
global.clearInterval(intervalCheckIn);
|
|
125
|
+
originalExit();
|
|
126
|
+
process.kill();
|
|
127
|
+
}
|
|
128
|
+
lastKnownCheckInTime = currentTime;
|
|
129
|
+
} catch (error) {
|
|
130
|
+
console.error('Could not run checkin function', error);
|
|
131
|
+
}
|
|
132
|
+
return;
|
|
133
|
+
}
|