suitest-js-api 3.2.0 → 3.2.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/index.d.ts +3 -10
- package/lib/testLauncher/SuitestLauncher.js +5 -1
- package/lib/texts.js +0 -3
- package/lib/utils/socketErrorMessages.js +1 -11
- package/lib/utils/testLauncherHelper.js +3 -2
- package/lib/validation/jsonSchemas.js +40 -36
- package/package.json +1 -1
- package/typeDefinition/OpenAppChain.d.ts +2 -2
- package/typeDefinition/constants/LaunchMode.d.ts +6 -0
- package/typeDefinition/modifiers.d.ts +4 -2
package/index.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ import {ScreenOrientation} from './typeDefinition/constants/ScreenOrientation';
|
|
|
39
39
|
import {CloseAppChain} from './typeDefinition/CloseAppChain';
|
|
40
40
|
import {SuspendAppChain} from './typeDefinition/SuspendAppChain';
|
|
41
41
|
import {RelativePosition} from './typeDefinition/RelativePositionChain';
|
|
42
|
+
import {LaunchMode} from './typeDefinition/constants/LaunchMode';
|
|
42
43
|
|
|
43
44
|
// --------------- Suitest Interface ---------------------- //
|
|
44
45
|
|
|
@@ -151,6 +152,7 @@ declare namespace suitest {
|
|
|
151
152
|
TAP_TYPES: TapTypes;
|
|
152
153
|
DIRECTIONS: Directions;
|
|
153
154
|
SCREEN_ORIENTATION: ScreenOrientation;
|
|
155
|
+
LAUNCH_MODE: LaunchMode;
|
|
154
156
|
|
|
155
157
|
authContext: AuthContext;
|
|
156
158
|
appContext: Context;
|
|
@@ -232,16 +234,7 @@ declare namespace suitest {
|
|
|
232
234
|
interface DeviceData {
|
|
233
235
|
id: string;
|
|
234
236
|
firmware: string;
|
|
235
|
-
|
|
236
|
-
codeName: string;
|
|
237
|
-
deviceType: string;
|
|
238
|
-
};
|
|
239
|
-
status: {
|
|
240
|
-
type: string;
|
|
241
|
-
canPair: boolean;
|
|
242
|
-
};
|
|
243
|
-
platforms: string[];
|
|
244
|
-
workingPlatforms: string[];
|
|
237
|
+
modelId: string;
|
|
245
238
|
}
|
|
246
239
|
|
|
247
240
|
interface ConfigOverride {
|
|
@@ -7,6 +7,7 @@ const {
|
|
|
7
7
|
addLauncherIpcListeners,
|
|
8
8
|
throwDebugForManyDevicesError,
|
|
9
9
|
increaseMaxListeners,
|
|
10
|
+
handleChildResult,
|
|
10
11
|
} = require('../utils/testLauncherHelper');
|
|
11
12
|
const {TEST_COMMAND, TOKEN} = require('../constants/modes');
|
|
12
13
|
const sessionConstants = require('../constants/session');
|
|
@@ -88,6 +89,8 @@ class SuitestLauncher {
|
|
|
88
89
|
throwDebugForManyDevicesError();
|
|
89
90
|
}
|
|
90
91
|
|
|
92
|
+
let finishedWithErrors = false;
|
|
93
|
+
|
|
91
94
|
try {
|
|
92
95
|
const ipcPort = await ipcServer.start({
|
|
93
96
|
...this.ownArgv,
|
|
@@ -101,7 +104,7 @@ class SuitestLauncher {
|
|
|
101
104
|
// increase stdout max listeners based on number of child processes to avoid node warning
|
|
102
105
|
increaseMaxListeners(process.stdout, devices.length, this.ownArgv.concurrency);
|
|
103
106
|
|
|
104
|
-
await runAllDevices(
|
|
107
|
+
finishedWithErrors = await runAllDevices(
|
|
105
108
|
this.restArgs,
|
|
106
109
|
this.ownArgv,
|
|
107
110
|
devicesWithDetails,
|
|
@@ -109,6 +112,7 @@ class SuitestLauncher {
|
|
|
109
112
|
);
|
|
110
113
|
} finally {
|
|
111
114
|
await closeSessionUnchained(suitest);
|
|
115
|
+
handleChildResult(finishedWithErrors);
|
|
112
116
|
}
|
|
113
117
|
} catch (error) {
|
|
114
118
|
await captureException(error);
|
package/lib/texts.js
CHANGED
|
@@ -158,9 +158,6 @@ ${leaves}`,
|
|
|
158
158
|
// ipc
|
|
159
159
|
ipcFailedToCreateServer: template`Failed to create IPC server. Port ${0} is busy.`,
|
|
160
160
|
|
|
161
|
-
// suffixes
|
|
162
|
-
'suffix.sessionWillClose': () => 'Test session will now close and all remaining Suitest commands will fail.',
|
|
163
|
-
|
|
164
161
|
// logger msg
|
|
165
162
|
sessionOpen: () => 'Connecting to Suitest ...',
|
|
166
163
|
sessionOpened: () => 'Connected to Suitest',
|
|
@@ -133,15 +133,6 @@ function getErrorMessage({response, jsonMessage, verbosity, snippets}) {
|
|
|
133
133
|
return chainUtils.translateLineResult(jsonMessage, verbosity, response);
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
/**
|
|
137
|
-
* @description check if error should be considered as fatal
|
|
138
|
-
* @param {Object} res websocket message
|
|
139
|
-
* @returns {boolean}
|
|
140
|
-
*/
|
|
141
|
-
function isErrorFatal(res) {
|
|
142
|
-
return res.result === 'fatal' || normalizeErrorType(res) === 'testIsNotStarted';
|
|
143
|
-
}
|
|
144
|
-
|
|
145
136
|
/**
|
|
146
137
|
* @description Normalize errorType
|
|
147
138
|
* @param {*} response webscoket message
|
|
@@ -169,8 +160,7 @@ module.exports = {
|
|
|
169
160
|
* @returns {string}
|
|
170
161
|
*/
|
|
171
162
|
getInfoErrorMessage: (message, prefix = '', res, stack) => {
|
|
172
|
-
const
|
|
173
|
-
const msg = prefix + stripAnsiChars(message) + suffix;
|
|
163
|
+
const msg = prefix + stripAnsiChars(message);
|
|
174
164
|
const firstStackLine = stack && getFirstStackLine(stack);
|
|
175
165
|
const nl = firstStackLine && msg.endsWith(EOL) ? '' : EOL;
|
|
176
166
|
|
|
@@ -312,7 +312,7 @@ function getChildOptions(device, port) {
|
|
|
312
312
|
* @param {Object} ownArgv - implicitly derived parameters
|
|
313
313
|
* @param {Array} devices - array with items containing full device information
|
|
314
314
|
* @param {number} ipcPort - ipc port number
|
|
315
|
-
* @returns {Promise
|
|
315
|
+
* @returns {Promise<boolean>} - finished with errors or not.
|
|
316
316
|
*/
|
|
317
317
|
function runAllDevices(cmdArgv, ownArgv, devices, ipcPort) {
|
|
318
318
|
const tests = devices.map(device => () => runTestOnDevice(
|
|
@@ -343,7 +343,8 @@ function runAllDevices(cmdArgv, ownArgv, devices, ipcPort) {
|
|
|
343
343
|
|
|
344
344
|
log.final(failedDevices.length, result.length - failedDevices.length);
|
|
345
345
|
warnNewVersionAvailable(logger, version, suitestVersion);
|
|
346
|
-
|
|
346
|
+
|
|
347
|
+
return failedDevices.length !== 0;
|
|
347
348
|
});
|
|
348
349
|
}
|
|
349
350
|
|
|
@@ -19,46 +19,50 @@ const SCREEN_ORIENTATION = require('../constants/screenOrientation');
|
|
|
19
19
|
const LAUNCH_MODE = require('../constants/launchMode');
|
|
20
20
|
const schemas = {};
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
'type': '
|
|
24
|
-
'
|
|
25
|
-
|
|
26
|
-
'
|
|
27
|
-
'
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
'
|
|
32
|
-
'type': '
|
|
33
|
-
'
|
|
34
|
-
'
|
|
35
|
-
|
|
36
|
-
'
|
|
37
|
-
'type': 'array',
|
|
38
|
-
'items': {'type': 'string'},
|
|
39
|
-
},
|
|
40
|
-
'url': {'type': 'string'},
|
|
41
|
-
'type': {'type': 'string'},
|
|
42
|
-
'toUrl': {'type': 'string'},
|
|
22
|
+
const CONFIG_OVERRIDE_PROPERTIES = {
|
|
23
|
+
'url': {'type': 'string'},
|
|
24
|
+
'suitestify': {'type': 'boolean'},
|
|
25
|
+
'domainList': {
|
|
26
|
+
'type': 'array',
|
|
27
|
+
'items': {'type': 'string'},
|
|
28
|
+
},
|
|
29
|
+
'mapRules': {
|
|
30
|
+
'type': 'array',
|
|
31
|
+
'items': {
|
|
32
|
+
'type': 'object',
|
|
33
|
+
'properties': {
|
|
34
|
+
'methods': {
|
|
35
|
+
'type': 'array',
|
|
36
|
+
'items': {'type': 'string'},
|
|
43
37
|
},
|
|
38
|
+
'url': {'type': 'string'},
|
|
39
|
+
'type': {'type': 'string'},
|
|
40
|
+
'toUrl': {'type': 'string'},
|
|
44
41
|
},
|
|
45
42
|
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
'required': ['key', 'value'],
|
|
43
|
+
},
|
|
44
|
+
'codeOverrides': {'type': 'object'},
|
|
45
|
+
'configVariables': {
|
|
46
|
+
'type': 'array',
|
|
47
|
+
'items': {
|
|
48
|
+
'type': 'object',
|
|
49
|
+
'properties': {
|
|
50
|
+
'key': {'type': 'string'},
|
|
51
|
+
'value': {'type': 'string'},
|
|
56
52
|
},
|
|
53
|
+
'required': ['key', 'value'],
|
|
57
54
|
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
},
|
|
56
|
+
'openAppOverrideTest': {
|
|
57
|
+
'type': 'string',
|
|
58
|
+
'format': 'uuid',
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
schemas[validationKeys.CONFIG_OVERRIDE] = {
|
|
63
|
+
'type': 'object',
|
|
64
|
+
'properties': {
|
|
65
|
+
...CONFIG_OVERRIDE_PROPERTIES,
|
|
62
66
|
},
|
|
63
67
|
};
|
|
64
68
|
|
|
@@ -328,8 +332,8 @@ schemas[validationKeys.TEST_LAUNCHER_TOKEN] = {
|
|
|
328
332
|
'type': 'object',
|
|
329
333
|
'properties': {
|
|
330
334
|
'configId': {'type': 'string'},
|
|
335
|
+
...CONFIG_OVERRIDE_PROPERTIES,
|
|
331
336
|
},
|
|
332
|
-
'additionalProperties': false,
|
|
333
337
|
},
|
|
334
338
|
],
|
|
335
339
|
},
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AbstractChain,
|
|
3
3
|
BaseChain,
|
|
4
|
-
|
|
4
|
+
LaunchModeModifier
|
|
5
5
|
} from './modifiers';
|
|
6
6
|
|
|
7
7
|
export interface OpenAppChain extends
|
|
8
8
|
BaseChain<OpenAppChain, OpenAppEvalResult, OpenAppAbandonedChain>,
|
|
9
|
-
|
|
9
|
+
LaunchModeModifier<OpenAppChain>
|
|
10
10
|
{}
|
|
11
11
|
|
|
12
12
|
interface OpenAppAbandonedChain extends AbstractChain {}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import {LaunchModeValues} from './constants/LaunchMode';
|
|
2
|
+
|
|
1
3
|
export interface Thenable <R> {
|
|
2
4
|
then <U> (onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
|
|
3
5
|
then <U> (onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => void): Thenable<U>;
|
|
@@ -38,8 +40,8 @@ export interface Clonable<T> {
|
|
|
38
40
|
clone(): T;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
export interface
|
|
42
|
-
launchMode(mode:
|
|
43
|
+
export interface LaunchModeModifier<T> {
|
|
44
|
+
launchMode(mode: LaunchModeValues): T;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
export interface Abandable<T> {
|