Skip to content

Commit 07a35ed

Browse files
committed
update step.sh and step.yml to enhance metadata handling and refine variable options - bump to v1
1 parent 638ca25 commit 07a35ed

File tree

3 files changed

+154
-80
lines changed

3 files changed

+154
-80
lines changed

bitrise.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ app:
55
envs:
66
# If you want to share this step into a StepLib
77
- BITRISE_STEP_ID: device-cloud-for-maestro
8-
- BITRISE_STEP_VERSION: "0.0.11"
8+
- BITRISE_STEP_VERSION: "1.0.0"
99
- BITRISE_STEP_GIT_CLONE_URL: https://github.com/devicecloud-dev/bitrise-integration.git
1010
- MY_STEPLIB_REPO_FORK_GIT_URL: [email protected]:devicecloud-dev/bitrise-integration.git
1111

step.sh

Lines changed: 74 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -13,125 +13,153 @@ if [ -n "$env_list" ]; then
1313
fi
1414

1515
# Define minimum DCD version
16-
DCD_VERSION="@devicecloud.dev/dcd@>=3.3.6"
16+
DCD_VERSION="@devicecloud.dev/dcd@>=4.2.5"
17+
18+
# Parse metadata list (similar to env_list)
19+
metadata_parsed=""
20+
if [ -n "$metadata" ]; then
21+
while IFS='=' read -r key value; do
22+
if [ -n "$key" ]; then
23+
metadata_parsed="$metadata_parsed -m $key=$value"
24+
fi
25+
done <<< "$metadata"
26+
fi
1727

1828
# Refine variables
1929
[[ "$async" == "true" ]] && is_async="true"
2030
[[ "$google_play" == "true" ]] && is_google_play="true"
21-
[[ "$x86_arch" == "true" ]] && is_x86_arch="true"
2231
[[ "$ignore_sha_check" == "true" ]] && is_ignore_sha_check="true"
23-
[[ "$skip_chrome_onboarding" == "true" ]] && is_skip_chrome_onboarding="true"
32+
[[ "$show_crosshairs" == "true" ]] && is_show_crosshairs="true"
33+
[[ "$maestro_chrome_onboarding" == "true" ]] && is_maestro_chrome_onboarding="true"
34+
[[ "$android_no_snapshot" == "true" ]] && is_android_no_snapshot="true"
2435
[[ "$debug" == "true" ]] && is_debug="true"
2536
[[ "$json" == "true" ]] && is_json="true"
2637
[[ "$json_file" == "true" ]] && is_json_file="true"
38+
[[ "$dry_run" == "true" ]] && is_dry_run="true"
2739
# Change to source directory
2840
cd $BITRISE_SOURCE_DIR
2941

3042
EXIT_CODE=0
3143

3244
# Log all variables for debugging
3345
echo "DCD variables:"
34-
echo "additional_app_binary_ids: $additional_app_binary_ids"
35-
echo "additional_app_files: $additional_app_files"
46+
echo "allure_path: $allure_path"
3647
echo "android_api_level: $android_api_level"
3748
echo "android_device: $android_device"
49+
echo "android_no_snapshot: $android_no_snapshot"
3850
echo "api_key: $api_key"
3951
echo "api_url: $api_url"
4052
echo "app_binary_id: $app_binary_id"
4153
echo "app_file: $app_file"
54+
echo "artifacts_path: $artifacts_path"
4255
echo "async: $async"
56+
echo "config: $config"
4357
echo "device_locale: $device_locale"
4458
echo "download_artifacts: $download_artifacts"
59+
echo "dry_run: $dry_run"
4560
echo "env_list: $env_list"
4661
echo "exclude_flows: $exclude_flows"
4762
echo "exclude_tags: $exclude_tags"
4863
echo "google_play: $google_play"
64+
echo "html_path: $html_path"
65+
echo "ignore_sha_check: $ignore_sha_check"
4966
echo "include_tags: $include_tags"
5067
echo "ios_device: $ios_device"
5168
echo "ios_version: $ios_version"
52-
echo "is_async: $is_async"
69+
echo "json: $json"
70+
echo "json_file: $json_file"
71+
echo "json_file_name: $json_file_name"
72+
echo "junit_path: $junit_path"
73+
echo "maestro_chrome_onboarding: $maestro_chrome_onboarding"
5374
echo "maestro_version: $maestro_version"
75+
echo "metadata: $metadata"
5476
echo "name: $name"
5577
echo "orientation: $orientation"
56-
echo "retry: $retry"
57-
echo "workspace: $workspace"
5878
echo "report: $report"
59-
echo "ignore_sha_check: $ignore_sha_check"
60-
echo "skip_chrome_onboarding: $skip_chrome_onboarding"
79+
echo "retry: $retry"
6180
echo "runner_type: $runner_type"
62-
echo "is_debug: $is_debug"
63-
echo "is_json: $is_json"
64-
echo "is_json_file: $is_json_file"
65-
echo "config: $config"
66-
echo "artifacts_path: $artifacts_path"
81+
echo "show_crosshairs: $show_crosshairs"
82+
echo "workspace: $workspace"
6783

6884
echo "Running command: npx --yes \"$DCD_VERSION\" cloud --quiet \
6985
--apiKey \"$api_key\" \
70-
${api_url:+--api-url \"$api_url\"} \
71-
${app_binary_id:+--app-binary-id \"$app_binary_id\"} \
72-
${additional_app_binary_ids:+--additional-app-binary-ids \"$additional_app_binary_ids\"} \
73-
${additional_app_files:+--additional-app-files \"$additional_app_files\"} \
86+
${allure_path:+--allure-path \"$allure_path\"} \
87+
${is_android_no_snapshot:+--android-no-snapshot} \
7488
${android_api_level:+--android-api-level \"$android_api_level\"} \
7589
${android_device:+--android-device \"$android_device\"} \
90+
${api_url:+--api-url \"$api_url\"} \
91+
${app_binary_id:+--app-binary-id \"$app_binary_id\"} \
92+
${artifacts_path:+--artifacts-path \"$artifacts_path\"} \
7693
${is_async:+--async} \
94+
${config:+--config \"$config\"} \
95+
${is_debug:+--debug} \
7796
${device_locale:+--device-locale \"$device_locale\"} \
78-
${download_artifacts:+--download-artifacts} \
97+
${download_artifacts:+--download-artifacts \"$download_artifacts\"} \
98+
${is_dry_run:+--dry-run} \
7999
${exclude_flows:+--exclude-flows \"$exclude_flows\"} \
80100
${exclude_tags:+--exclude-tags \"$exclude_tags\"} \
81101
${is_google_play:+--google-play} \
102+
${html_path:+--html-path \"$html_path\"} \
103+
${is_ignore_sha_check:+--ignore-sha-check} \
82104
${include_tags:+--include-tags \"$include_tags\"} \
83-
${ios_version:+--ios-version \"$ios_version\"} \
84105
${ios_device:+--ios-device \"$ios_device\"} \
106+
${ios_version:+--ios-version \"$ios_version\"} \
107+
${is_json:+--json} \
108+
${is_json_file:+--json-file} \
109+
${json_file_name:+--json-file-name \"$json_file_name\"} \
110+
${junit_path:+--junit-path \"$junit_path\"} \
111+
${is_maestro_chrome_onboarding:+--maestro-chrome-onboarding} \
112+
${maestro_version:+--maestro-version \"$maestro_version\"} \
85113
${name:+--name \"$name\"} \
86114
${orientation:+--orientation \"$orientation\"} \
115+
${report:+--report \"$report\"} \
87116
${retry:+--retry \"$retry\"} \
88-
${maestro_version:+--maestro-version \"$maestro_version\"} \
117+
${runner_type:+--runner-type \"$runner_type\"} \
118+
${is_show_crosshairs:+--show-crosshairs} \
89119
${env_list_parsed} \
90-
${report:+--report "$report"} \
91-
${is_ignore_sha_check:+--ignore-sha-check} \
92-
${is_skip_chrome_onboarding:+--skip-chrome-onboarding} \
93-
${runner_type:+--runner-type "$runner_type"} \
94-
${is_debug:+--debug} \
95-
${is_json:+--json} \
96-
${is_json_file:+--json-file} \
97-
${config:+--config "$config"} \
98-
${artifacts_path:+--artifacts-path "$artifacts_path"} \
120+
${metadata_parsed} \
99121
\"$app_file\" \"$workspace\""
100122

101123
# Capture the command output and display it
102124
echo "Waiting for full test results so we can parse outputs... this may take a while for non-async tests"
103125
echo "Check status at https://console.devicecloud.dev/results"
104126
OUTPUT=$(npx --yes "$DCD_VERSION" cloud --quiet \
105127
--apiKey "$api_key" \
106-
${api_url:+--api-url "$api_url"} \
107-
${app_binary_id:+--app-binary-id "$app_binary_id"} \
108-
${additional_app_binary_ids:+--additional-app-binary-ids "$additional_app_binary_ids"} \
109-
${additional_app_files:+--additional-app-files "$additional_app_files"} \
128+
${allure_path:+--allure-path "$allure_path"} \
129+
${is_android_no_snapshot:+--android-no-snapshot} \
110130
${android_api_level:+--android-api-level "$android_api_level"} \
111131
${android_device:+--android-device "$android_device"} \
132+
${api_url:+--api-url "$api_url"} \
133+
${app_binary_id:+--app-binary-id "$app_binary_id"} \
134+
${artifacts_path:+--artifacts-path "$artifacts_path"} \
112135
${is_async:+--async} \
136+
${config:+--config "$config"} \
137+
${is_debug:+--debug} \
113138
${device_locale:+--device-locale "$device_locale"} \
114139
${download_artifacts:+--download-artifacts "$download_artifacts"} \
140+
${is_dry_run:+--dry-run} \
115141
${exclude_flows:+--exclude-flows "$exclude_flows"} \
116142
${exclude_tags:+--exclude-tags "$exclude_tags"} \
117143
${is_google_play:+--google-play} \
144+
${html_path:+--html-path "$html_path"} \
145+
${is_ignore_sha_check:+--ignore-sha-check} \
118146
${include_tags:+--include-tags "$include_tags"} \
119-
${ios_version:+--ios-version "$ios_version"} \
120147
${ios_device:+--ios-device "$ios_device"} \
148+
${ios_version:+--ios-version "$ios_version"} \
149+
${is_json:+--json} \
150+
${is_json_file:+--json-file} \
151+
${json_file_name:+--json-file-name "$json_file_name"} \
152+
${junit_path:+--junit-path "$junit_path"} \
153+
${is_maestro_chrome_onboarding:+--maestro-chrome-onboarding} \
154+
${maestro_version:+--maestro-version "$maestro_version"} \
121155
${name:+--name "$name"} \
122156
${orientation:+--orientation "$orientation"} \
123-
${retry:+--retry "$retry"} \
124-
${maestro_version:+--maestro-version "$maestro_version"} \
125-
${env_list_parsed} \
126157
${report:+--report "$report"} \
127-
${is_ignore_sha_check:+--ignore-sha-check} \
128-
${is_skip_chrome_onboarding:+--skip-chrome-onboarding} \
158+
${retry:+--retry "$retry"} \
129159
${runner_type:+--runner-type "$runner_type"} \
130-
${is_debug:+--debug} \
131-
${is_json:+--json} \
132-
${is_json_file:+--json-file} \
133-
${config:+--config "$config"} \
134-
${artifacts_path:+--artifacts-path "$artifacts_path"} \
160+
${is_show_crosshairs:+--show-crosshairs} \
161+
${env_list_parsed} \
162+
${metadata_parsed} \
135163
"$app_file" "$workspace" 2>&1) || EXIT_CODE=$?
136164
echo "$OUTPUT"
137165

step.yml

Lines changed: 79 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,32 @@ inputs:
8383
- env_list: ""
8484
opts:
8585
title: "Environment Variables"
86-
summary: "List of environment variables to pass to the test seperated by newlines (e.g. MY_VAR=my_value <newline> MY_OTHER_VAR=other_value)"
86+
summary: "List of environment variables to pass to the test separated by newlines (e.g. MY_VAR=my_value <newline> MY_OTHER_VAR=other_value)"
87+
is_expand: true
88+
is_required: false
89+
90+
- metadata: ""
91+
opts:
92+
title: "Metadata"
93+
summary: "Arbitrary key-value metadata to include with your test run, separated by newlines (format: key=value)"
8794
is_expand: true
8895
is_required: false
8996

9097
- async: "false"
9198
opts:
9299
title: "Async Execution"
93-
summary: "Run tests asynchronously"
100+
summary: "Run tests asynchronously (exit immediately without waiting for results)"
101+
is_expand: true
102+
is_required: false
103+
default_value: "false"
104+
value_options:
105+
- "true"
106+
- "false"
107+
108+
- dry_run: "false"
109+
opts:
110+
title: "Dry Run"
111+
summary: "Simulate the run without actually triggering the upload/test, useful for debugging workflow issues"
94112
is_expand: true
95113
is_required: false
96114
default_value: "false"
@@ -105,6 +123,17 @@ inputs:
105123
is_expand: true
106124
is_required: false
107125

126+
- android_no_snapshot: "false"
127+
opts:
128+
title: "Android No Snapshot"
129+
summary: "[Android only] Force cold boot instead of using snapshot boot. Automatically enabled for API 35+ but can be used to force cold boot on older API levels."
130+
is_expand: true
131+
is_required: false
132+
default_value: "false"
133+
value_options:
134+
- "true"
135+
- "false"
136+
108137
- ios_version: ""
109138
opts:
110139
title: "iOS Version"
@@ -151,20 +180,6 @@ inputs:
151180
is_expand: true
152181
is_required: false
153182

154-
- additional_app_binary_ids: ""
155-
opts:
156-
title: "Additional App Binary IDs"
157-
summary: "Comma-separated list of additional app binary IDs"
158-
is_expand: true
159-
is_required: false
160-
161-
- additional_app_files: ""
162-
opts:
163-
title: "Additional App Files"
164-
summary: "Comma-separated list of additional app file paths"
165-
is_expand: true
166-
is_required: false
167-
168183
- device_locale: ""
169184
opts:
170185
title: "Device Locale"
@@ -189,57 +204,81 @@ inputs:
189204
- orientation: ""
190205
opts:
191206
title: "Device Orientation"
192-
summary: "Device orientation in degrees"
193-
is_expand: true
194-
is_required: false
195-
196-
- retry: ""
197-
opts:
198-
title: "Retry Count"
199-
summary: "Number of times to retry failed tests"
207+
summary: "[Android only] Device orientation (0 = portrait, 90 = landscape)"
200208
is_expand: true
201209
is_required: false
210+
value_options:
211+
- "0"
212+
- "90"
202213

203-
- x86_arch: "false"
214+
- show_crosshairs: "false"
204215
opts:
205-
title: "x86 Architecture"
206-
summary: "Whether to use x86 architecture for Android emulation"
216+
title: "Show Crosshairs"
217+
summary: "[Android only] Display crosshairs for screen interactions during test execution"
207218
is_expand: true
208219
is_required: false
209220
default_value: "false"
210221
value_options:
211222
- "true"
212223
- "false"
213224

214-
- skip_chrome_onboarding: "false"
225+
- maestro_chrome_onboarding: "false"
215226
opts:
216-
title: "Skip Chrome Onboarding"
217-
summary: "[Android only] Skip Chrome browser onboarding screens when running tests"
227+
title: "Maestro Chrome Onboarding"
228+
summary: "[Android only] Force Maestro-based Chrome onboarding - note: this will slow your tests but can fix browser related crashes"
218229
is_expand: true
219230
is_required: false
220231
default_value: "false"
221232
value_options:
222233
- "true"
223234
- "false"
224235

236+
- retry: ""
237+
opts:
238+
title: "Retry Count"
239+
summary: "Number of times to retry failed tests"
240+
is_expand: true
241+
is_required: false
242+
225243
- runner_type: ""
226244
opts:
227245
title: "Runner Type"
228246
summary: "[experimental] The type of runner to use - note: anything other than default will incur premium pricing tiers"
229247
is_expand: true
230248
is_required: false
231249

232-
- report: "junit"
250+
- report: ""
233251
opts:
234252
title: "Report Format"
235-
summary: "Generate a report in the specified format"
253+
summary: "Generate and download test reports in the specified format"
236254
is_expand: true
237255
is_required: false
238-
default_value: "junit"
239256
value_options:
257+
- "allure"
240258
- "junit"
241259
- "html"
242260

261+
- junit_path: ""
262+
opts:
263+
title: "JUnit Report Path"
264+
summary: "Custom file path for downloaded JUnit report (requires report=junit, default: ./report.xml)"
265+
is_expand: true
266+
is_required: false
267+
268+
- allure_path: ""
269+
opts:
270+
title: "Allure Report Path"
271+
summary: "Custom file path for downloaded Allure report (requires report=allure, default: ./report.html)"
272+
is_expand: true
273+
is_required: false
274+
275+
- html_path: ""
276+
opts:
277+
title: "HTML Report Path"
278+
summary: "Custom file path for downloaded HTML report (requires report=html, default: ./report.html)"
279+
is_expand: true
280+
is_required: false
281+
243282
- ignore_sha_check: "false"
244283
opts:
245284
title: "Ignore SHA Check"
@@ -291,6 +330,13 @@ inputs:
291330
- "true"
292331
- "false"
293332

333+
- json_file_name: ""
334+
opts:
335+
title: "JSON File Name"
336+
summary: "Custom name for the JSON file (can also include relative path). Requires json_file to be true."
337+
is_expand: true
338+
is_required: false
339+
294340
- config: ""
295341
opts:
296342
title: "Config File"

0 commit comments

Comments
 (0)