82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_firebase_test.rb', line 82
def self.available_options
[
FastlaneCore::ConfigItem.new(
key: :project_id,
env_name: 'GCP_PROJECT',
description: 'The Project ID to test in',
type: String
),
FastlaneCore::ConfigItem.new(
key: :key_file,
description: 'The key file used to authorize with Google Cloud',
type: String,
verify_block: proc do |value|
UI.user_error!('The `:key_file` parameter is required') if value.empty?
UI.user_error!("No Google Cloud Key file found at: #{value}") unless File.exist?(value)
end
),
FastlaneCore::ConfigItem.new(
key: :apk_path,
description: 'Path to the application APK on the local machine',
type: String,
verify_block: proc do |value|
UI.user_error!('The `:apk_path` parameter is required') if value.empty?
UI.user_error!("Invalid application APK: #{value}") unless File.exist?(value)
end
),
FastlaneCore::ConfigItem.new(
key: :test_apk_path,
description: 'Path to the test bundle APK on the local machine',
type: String,
verify_block: proc do |value|
UI.user_error!('The `:test_apk_path` parameter is required') if value.empty?
UI.user_error!("Invalid test APK: #{value}") unless File.exist?(value)
end
),
FastlaneCore::ConfigItem.new(
key: :test_targets,
description: 'A list of one or more test target filters to apply',
type: String,
optional: true,
default_value: nil
),
FastlaneCore::ConfigItem.new(
key: :model,
description: 'The device model to use to run the test',
type: String,
verify_block: proc do |value|
UI.user_error!('The `:model` parameter is required') if value.empty?
FirebaseTestRunner.verify_has_gcloud_binary!
model_names = Fastlane::FirebaseDevice.valid_model_names
UI.user_error!("Invalid Model Name: #{value}. Valid Model Names: #{model_names}") unless model_names.include?(value)
end
),
FastlaneCore::ConfigItem.new(
key: :version,
description: 'The Android version (API Level) to use to run the test',
type: Integer,
verify_block: proc do |value|
FirebaseTestRunner.verify_has_gcloud_binary!
version_numbers = Fastlane::FirebaseDevice.valid_version_numbers
UI.user_error!("Invalid Version Number: #{value}. Valid Version Numbers: #{version_numbers}") unless version_numbers.include?(value)
end
),
FastlaneCore::ConfigItem.new(
key: :locale,
description: 'The locale code to use when running the test',
type: String,
default_value: 'en',
verify_block: proc do |value|
FirebaseTestRunner.verify_has_gcloud_binary!
locale_codes = Fastlane::FirebaseDevice.valid_locales
UI.user_error!("Invalid Locale: #{value}. Valid Locales: #{locale_codes}") unless locale_codes.include?(value)
end
),
FastlaneCore::ConfigItem.new(
key: :orientation,
description: 'Which orientation to run the device in',
type: String,
default_value: 'portrait',
verify_block: proc do |value|
orientations = Fastlane::FirebaseDevice.valid_orientations
UI.user_error!("Invalid Orientation: #{value}. Valid Orientations: #{orientations}") unless orientations.include?(value)
end
),
FastlaneCore::ConfigItem.new(
key: :type,
description: 'The type of test to run (e.g. `instrumentation` or `robo`)',
type: String,
default_value: 'instrumentation',
verify_block: proc do |value|
types = Fastlane::FirebaseTestRunner::VALID_TEST_TYPES
UI.user_error!("Invalid Test Type: #{value}. Valid Types: #{types}") unless types.include?(value)
end
),
FastlaneCore::ConfigItem.new(
key: :test_run_id,
description: 'A unique ID used to identify this test run',
default_value_dynamic: true,
optional: true,
type: String
),
FastlaneCore::ConfigItem.new(
key: :results_output_dir,
description: 'The path to the folder where we will store the results of this test run',
default_value_dynamic: true,
optional: true,
type: String
),
FastlaneCore::ConfigItem.new(
key: :crash_on_test_failure,
description: 'If set to `true` (the default), will stop fastlane with `test_failure!`. ' \
+ 'If `false`, the action will return the test status, without interrupting the rest of your Fastlane run on failure, letting the caller handle the failure on their side',
optional: true,
type: Boolean,
default_value: true
),
]
end
|