Skip to content

Commit c06d134

Browse files
authored
Merge pull request #4 from devicecloud-dev/add-additional-flags
support all CLI params
2 parents 9c38313 + 1ae20e3 commit c06d134

File tree

6 files changed

+238
-56
lines changed

6 files changed

+238
-56
lines changed

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,70 @@ You can use an already uploaded App binary in devicecloud.dev using the `app-bin
172172
api-key: ${{ secrets.DCD_API_KEY }}
173173
app-binary-id: <your-app-binary-id>
174174
```
175+
176+
# Specifying device orientation
177+
178+
You can specify the orientation of Android devices in degrees using the `orientation` parameter:
179+
180+
```yaml
181+
- uses: devicecloud-dev/device-cloud-for-maestro@v1
182+
with:
183+
api-key: ${{ secrets.DCD_API_KEY }}
184+
app-file: app.apk
185+
orientation: 90 # Options: 0|90|180|270
186+
```
187+
188+
# Setting device locale
189+
190+
You can set the device locale using ISO codes:
191+
192+
```yaml
193+
- uses: devicecloud-dev/device-cloud-for-maestro@v1
194+
with:
195+
api-key: ${{ secrets.DCD_API_KEY }}
196+
app-file: app.apk
197+
device-locale: de_DE # Format: ISO-639-1_ISO-3166-1
198+
```
199+
200+
# Additional app binaries
201+
202+
You can include additional app binaries either by file or by previously uploaded binary ID:
203+
204+
```yaml
205+
- uses: devicecloud-dev/device-cloud-for-maestro@v1
206+
with:
207+
api-key: ${{ secrets.DCD_API_KEY }}
208+
app-file: app.apk
209+
additional-app-files: |
210+
second-app.apk
211+
third-app.apk
212+
additional-app-binary-ids: |
213+
binary-id-1
214+
binary-id-2
215+
```
216+
217+
# Downloading artifacts
218+
219+
You can download logs, screenshots and videos for test results (BETA feature):
220+
221+
```yaml
222+
- uses: devicecloud-dev/device-cloud-for-maestro@v1
223+
with:
224+
api-key: ${{ secrets.DCD_API_KEY }}
225+
app-file: app.apk
226+
download-artifacts: FAILED # Options: ALL|FAILED
227+
```
228+
229+
Note: There is a $0.01 egress fee per result when using this feature.
230+
231+
# Specifying Maestro version
232+
233+
You can specify which version of Maestro to use (ALPHA feature):
234+
235+
```yaml
236+
- uses: devicecloud-dev/device-cloud-for-maestro@v1
237+
with:
238+
api-key: ${{ secrets.DCD_API_KEY }}
239+
app-file: app.apk
240+
maestro-version: 1.39.0
241+
```

action.yml

Lines changed: 43 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,55 +2,73 @@ name: 'Device Cloud Action'
22
author: 'devicecloud.dev'
33
description: 'Uses devicecloud.dev to execute Maestro mobile tests'
44
inputs:
5+
additional-app-binary-ids:
6+
description: 'The ID of the additional app binary(s) previously uploaded to devicecloud.dev to install before execution'
7+
required: false
8+
additional-app-files:
9+
description: 'Additional app binary(s) to install before execution'
10+
required: false
11+
android-api-level:
12+
description: 'Android API level to run your flow against'
13+
required: false
14+
android-device:
15+
description: 'Android device to run your flow against'
16+
required: false
517
api-key:
618
description: 'devicecloud.dev API Key - find this in your app settings in the devicecloud.dev dashboard'
719
required: true
8-
app-file:
9-
description: 'Path to the build artifact to upload to devicecloud.dev before running the test'
20+
api-url:
21+
description: 'The API URL to use for the devicecloud.dev service'
1022
required: false
1123
app-binary-id:
1224
description: 'The app binary already uploaded to devicecloud.dev'
1325
required: false
14-
workspace:
15-
description: 'Path to a folder that contains your test flows'
16-
required: false
17-
default: './.maestro/'
18-
env:
19-
description: 'Set of key=value entries to pass as an input to Maestro flows'
26+
app-file:
27+
description: 'Path to the build artifact to upload to devicecloud.dev before running the test'
2028
required: false
2129
async:
2230
description: 'Whether to run Upload in async fashion and not block until completed'
2331
required: false
24-
android-api-level:
25-
description: 'Android API level to run your flow against'
32+
device-locale:
33+
description: 'Locale that will be set to a device, ISO-639-1 code and uppercase ISO-3166-1 code e.g. "de_DE" for Germany'
2634
required: false
27-
ios-version:
28-
description: 'iOS version to run your flow against'
35+
download-artifacts:
36+
description: 'BETA (API may change) - download a zip containing the logs, screenshots and videos for each result in this run. Options: ALL|FAILED'
2937
required: false
30-
include-tags:
31-
description: 'List of tags that will remove flows that does not have the provided tags'
38+
env:
39+
description: 'Set of key=value entries to pass as an input to Maestro flows'
40+
required: false
41+
exclude-flows:
42+
description: 'Subdirectories to ignore when building the flow file list'
3243
required: false
3344
exclude-tags:
3445
description: 'List of tags that will remove flows containing the provided tags'
3546
required: false
36-
name:
37-
description: 'A custom name for your upload (useful for tagging commits etc)'
38-
required: false
39-
api-url:
40-
description: 'The API URL to use for the devicecloud.dev service'
47+
google-play:
48+
description: 'Run your flow against Google Play devices'
4149
required: false
42-
android-device:
43-
description: 'Android device to run your flow against'
50+
include-tags:
51+
description: 'List of tags that will remove flows that does not have the provided tags'
4452
required: false
4553
ios-device:
4654
description: 'iOS device to run your flow against'
4755
required: false
48-
exclude-flows:
49-
description: 'Subdirectories to ignore when building the flow file list'
56+
ios-version:
57+
description: 'iOS version to run your flow against'
5058
required: false
51-
google-play:
52-
description: 'Run your flow against Google Play devices'
59+
maestro-version:
60+
description: 'ALPHA pre-release - Maestro version to run your flow against'
61+
required: false
62+
name:
63+
description: 'A custom name for your upload (useful for tagging commits etc)'
5364
required: false
65+
orientation:
66+
description: 'Android only - The orientation of the device to run your flow against in degrees (0|90|180|270)'
67+
required: false
68+
workspace:
69+
description: 'Path to a folder that contains your test flows'
70+
required: false
71+
default: './.maestro/'
5472

5573
runs:
5674
using: 'node20'

dist/index.js

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32535,24 +32535,30 @@ const params_1 = __nccwpck_require__(5966);
3253532535
const child_process_1 = __nccwpck_require__(2081);
3253632536
const run = () => __awaiter(void 0, void 0, void 0, function* () {
3253732537
try {
32538-
const { apiKey, apiUrl, appFilePath, workspaceFolder, env, async, androidApiLevel, iOSVersion, includeTags, excludeTags, appBinaryId, androidDevice, iosDevice, excludeFlows, googlePlay, name, } = yield (0, params_1.getParameters)();
32538+
const { additionalAppBinaryIds, additionalAppFiles, androidApiLevel, androidDevice, apiKey, apiUrl, appBinaryId, appFilePath, async, deviceLocale, downloadArtifacts, env, excludeFlows, excludeTags, googlePlay, includeTags, iOSVersion, iosDevice, maestroVersion, name, orientation, workspaceFolder, } = yield (0, params_1.getParameters)();
3253932539
const params = {
32540-
'app-file': appFilePath,
32541-
flows: workspaceFolder,
32540+
'additional-app-binary-ids': additionalAppBinaryIds,
32541+
'additional-app-files': additionalAppFiles,
32542+
'android-api-level': androidApiLevel,
32543+
'android-device': androidDevice,
3254232544
'api-key': apiKey,
32543-
'app-binary-id': appBinaryId,
32544-
'include-tags': includeTags,
32545-
'exclude-tags': excludeTags,
32546-
env,
3254732545
'api-url': apiUrl,
32546+
'app-binary-id': appBinaryId,
32547+
'app-file': appFilePath,
3254832548
async,
32549-
'android-api-level': androidApiLevel,
32550-
'ios-version': iOSVersion,
32551-
'android-device': androidDevice,
32552-
'ios-device': iosDevice,
32549+
'device-locale': deviceLocale,
32550+
'download-artifacts': downloadArtifacts,
32551+
env,
3255332552
'exclude-flows': excludeFlows,
32553+
'exclude-tags': excludeTags,
32554+
flows: workspaceFolder,
3255432555
'google-play': googlePlay,
32556+
'include-tags': includeTags,
32557+
'ios-device': iosDevice,
32558+
'ios-version': iOSVersion,
32559+
'maestro-version': maestroVersion,
3255532560
name,
32561+
orientation,
3255632562
};
3255732563
const paramsString = Object.keys(params).reduce((acc, key) => {
3255832564
return params[key] ? `${acc} --${key} "${params[key]}"` : acc;
@@ -32693,6 +32699,23 @@ function getInferredName() {
3269332699
}
3269432700
return github.context.sha;
3269532701
}
32702+
function parseOrientation(orientation) {
32703+
if (!orientation)
32704+
return undefined;
32705+
const value = parseInt(orientation);
32706+
if ([0, 90, 180, 270].includes(value)) {
32707+
return value;
32708+
}
32709+
throw new Error(`Invalid orientation: ${orientation}. Must be 0, 90, 180, or 270`);
32710+
}
32711+
function parseDownloadArtifacts(value) {
32712+
if (!value)
32713+
return undefined;
32714+
if (value !== 'ALL' && value !== 'FAILED') {
32715+
throw new Error(`Invalid download-artifacts value: ${value}. Must be ALL or FAILED`);
32716+
}
32717+
return value;
32718+
}
3269632719
function getParameters() {
3269732720
return __awaiter(this, void 0, void 0, function* () {
3269832721
const apiUrl = core.getInput('api-url', { required: false }) ||
@@ -32713,6 +32736,12 @@ function getParameters() {
3271332736
const iosDevice = parseIOSDevice(core.getInput('ios-device', { required: false }));
3271432737
const excludeFlows = core.getInput('exclude-flows', { required: false });
3271532738
const googlePlay = core.getInput('google-play', { required: false }) === 'true';
32739+
const additionalAppBinaryIds = parseTags(core.getInput('additional-app-binary-ids', { required: false }));
32740+
const additionalAppFiles = parseTags(core.getInput('additional-app-files', { required: false }));
32741+
const deviceLocale = core.getInput('device-locale', { required: false });
32742+
const downloadArtifacts = parseDownloadArtifacts(core.getInput('download-artifacts', { required: false }));
32743+
const maestroVersion = core.getInput('maestro-version', { required: false });
32744+
const orientation = parseOrientation(core.getInput('orientation', { required: false }));
3271632745
if (!(appFilePath !== '') !== (appBinaryId !== '')) {
3271732746
throw new Error('Either app-file or app-binary-id must be used');
3271832747
}
@@ -32738,6 +32767,12 @@ function getParameters() {
3273832767
iosDevice,
3273932768
excludeFlows,
3274032769
googlePlay,
32770+
additionalAppBinaryIds,
32771+
additionalAppFiles,
32772+
deviceLocale,
32773+
downloadArtifacts,
32774+
maestroVersion,
32775+
orientation,
3274132776
};
3274232777
});
3274332778
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "dcd-github-action",
33
"description": "run maestro tests on devicecloud.dev",
44
"author": "devicecloud.dev",
5-
"version": "1.0.1",
5+
"version": "1.1.0",
66
"main": "src/index.ts",
77
"license": "MIT",
88
"engines": {

src/index.ts

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,53 @@ import { execSync } from 'child_process';
55
const run = async (): Promise<void> => {
66
try {
77
const {
8+
additionalAppBinaryIds,
9+
additionalAppFiles,
10+
androidApiLevel,
11+
androidDevice,
812
apiKey,
913
apiUrl,
14+
appBinaryId,
1015
appFilePath,
11-
workspaceFolder,
12-
env,
1316
async,
14-
androidApiLevel,
15-
iOSVersion,
16-
includeTags,
17-
excludeTags,
18-
appBinaryId,
19-
androidDevice,
20-
iosDevice,
17+
deviceLocale,
18+
downloadArtifacts,
19+
env,
2120
excludeFlows,
21+
excludeTags,
2222
googlePlay,
23+
includeTags,
24+
iOSVersion,
25+
iosDevice,
26+
maestroVersion,
2327
name,
28+
orientation,
29+
workspaceFolder,
2430
} = await getParameters();
2531

2632
const params: Record<string, any> = {
27-
'app-file': appFilePath,
28-
flows: workspaceFolder,
33+
'additional-app-binary-ids': additionalAppBinaryIds,
34+
'additional-app-files': additionalAppFiles,
35+
'android-api-level': androidApiLevel,
36+
'android-device': androidDevice,
2937
'api-key': apiKey,
30-
'app-binary-id': appBinaryId,
31-
'include-tags': includeTags,
32-
'exclude-tags': excludeTags,
33-
env,
3438
'api-url': apiUrl,
39+
'app-binary-id': appBinaryId,
40+
'app-file': appFilePath,
3541
async,
36-
'android-api-level': androidApiLevel,
37-
'ios-version': iOSVersion,
38-
'android-device': androidDevice,
39-
'ios-device': iosDevice,
42+
'device-locale': deviceLocale,
43+
'download-artifacts': downloadArtifacts,
44+
env,
4045
'exclude-flows': excludeFlows,
46+
'exclude-tags': excludeTags,
47+
flows: workspaceFolder,
4148
'google-play': googlePlay,
49+
'include-tags': includeTags,
50+
'ios-device': iosDevice,
51+
'ios-version': iOSVersion,
52+
'maestro-version': maestroVersion,
4253
name,
54+
orientation,
4355
};
4456

4557
const paramsString = Object.keys(params).reduce((acc, key) => {

0 commit comments

Comments
 (0)