fastlane-plugin-run_tests_firebase_testlab 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6a2f08d5395b10f14f913b802d1f34bdd0efdc3
|
4
|
+
data.tar.gz: ee7be8d83547a5dc1c3133d8009023c651095363
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58cc561b4d8c90f8c017767d5fd8d6745f7ca8566ea389222fb73a7044d0076671afed0a7fe7580f34bfa4e58fcac1fed9f0be6fa1d843154fe5e1a686d14e87
|
7
|
+
data.tar.gz: b100b3dd863eea12dc3df707faeb177ee3c413f11033068847a237678aa2662ce3319de51f77dabef12ad216bbb81e4bd7e93dc749e1b6143aaae3c1e8fdc53b
|
data/README.md
CHANGED
@@ -6,13 +6,11 @@ Status](https://travis-ci.org/pink-room/fastlane-plugin-run_tests_firebase_testl
|
|
6
6
|
[![Gem
|
7
7
|
Version](https://badge.fury.io/rb/fastlane-plugin-run_tests_firebase_testlab.svg)](https://badge.fury.io/rb/fastlane-plugin-run_tests_firebase_testlab)
|
8
8
|
|
9
|
-
Please, read [this](https://medium.com/pink-room-club/android-continuous-integration-using-fastlane-and-circleci-2-0-part-i-7204e2e7b8b) blog post if you want to know better
|
10
|
-
how to use this plugin.
|
9
|
+
Please, read [this](https://medium.com/pink-room-club/android-continuous-integration-using-fastlane-and-circleci-2-0-part-i-7204e2e7b8b) blog post if you want to know better how to use this plugin.
|
11
10
|
|
12
11
|
## Getting Started
|
13
12
|
|
14
13
|
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-run_tests_firebase_testlab`, add it to your project by running:
|
15
|
-
|
16
14
|
```bash
|
17
15
|
fastlane add_plugin run_tests_firebase_testlab
|
18
16
|
```
|
@@ -36,8 +34,12 @@ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plu
|
|
36
34
|
```
|
37
35
|
run_tests_firebase_testlab(
|
38
36
|
project_id: "your-firebase-project-id",
|
39
|
-
|
40
|
-
|
37
|
+
devices: [
|
38
|
+
{
|
39
|
+
model: "Nexus6P",
|
40
|
+
version: "27"
|
41
|
+
}
|
42
|
+
]);
|
41
43
|
```
|
42
44
|
|
43
45
|
### Parameters
|
@@ -61,45 +63,52 @@ run_tests_firebase_testlab(
|
|
61
63
|
</tr>
|
62
64
|
|
63
65
|
<tr>
|
64
|
-
<td><b>
|
65
|
-
<td>
|
66
|
+
<td><b>devices</b></td>
|
67
|
+
<td>A list of devices to test the App on</td>
|
66
68
|
<td>No</td>
|
67
69
|
<td>-</td>
|
68
70
|
</tr>
|
69
71
|
|
70
72
|
<tr>
|
71
|
-
<td><b>
|
73
|
+
<td><b>device[model]</b></td>
|
74
|
+
<td>A device model on which the tests will run</td>
|
75
|
+
<td>No</td>
|
76
|
+
<td>-</td>
|
77
|
+
</tr>
|
78
|
+
|
79
|
+
<tr>
|
80
|
+
<td><b>device[version]</b></td>
|
72
81
|
<td>The Android api version of the device</td>
|
73
82
|
<td>No</td>
|
74
83
|
<td>-</td>
|
75
84
|
</tr>
|
76
85
|
|
77
86
|
<tr>
|
78
|
-
<td>
|
79
|
-
<td>The
|
87
|
+
<td>device[locale]</td>
|
88
|
+
<td>The locale to test against</td>
|
80
89
|
<td>Yes</td>
|
81
|
-
<td>
|
90
|
+
<td>en_US</td>
|
82
91
|
</tr>
|
83
92
|
|
84
93
|
<tr>
|
85
|
-
<td>
|
86
|
-
<td>The
|
94
|
+
<td>device[orientation]</td>
|
95
|
+
<td>The orientation of the device</td>
|
87
96
|
<td>Yes</td>
|
88
|
-
<td>
|
97
|
+
<td>portrait</td>
|
89
98
|
</tr>
|
90
99
|
|
91
100
|
<tr>
|
92
|
-
<td>
|
93
|
-
<td>The
|
101
|
+
<td>app_apk</td>
|
102
|
+
<td>The path for your app apk</td>
|
94
103
|
<td>Yes</td>
|
95
|
-
<td>
|
104
|
+
<td>app/build/outputs/apk/debug/<br>app-debug.apk</td>
|
96
105
|
</tr>
|
97
106
|
|
98
107
|
<tr>
|
99
|
-
<td>
|
100
|
-
<td>The
|
108
|
+
<td>android_test_apk</td>
|
109
|
+
<td>The path for your android test apk</td>
|
101
110
|
<td>Yes</td>
|
102
|
-
<td>
|
111
|
+
<td>app/build/outputs/apk/androidTest/<br>debug/app-debug-androidTest.apk</td>
|
103
112
|
</tr>
|
104
113
|
|
105
114
|
<tr>
|
data/lib/fastlane/plugin/run_tests_firebase_testlab/actions/run_tests_firebase_testlab_action.rb
CHANGED
@@ -12,6 +12,8 @@ module Fastlane
|
|
12
12
|
def self.run(params)
|
13
13
|
UI.message("Starting run_tests_firebase_testlab plugin...")
|
14
14
|
|
15
|
+
validate_params(params)
|
16
|
+
|
15
17
|
if params[:gcloud_service_key_file].nil?
|
16
18
|
UI.message("Save Google Cloud credentials.")
|
17
19
|
File.open(@client_secret_file, 'w') do |file|
|
@@ -35,7 +37,7 @@ module Fastlane
|
|
35
37
|
"--type instrumentation "\
|
36
38
|
"--app #{params[:app_apk]} "\
|
37
39
|
"--test #{params[:android_test_apk]} "\
|
38
|
-
"
|
40
|
+
"#{create_devices_params(params)}"\
|
39
41
|
"--timeout #{params[:timeout]} "\
|
40
42
|
"#{params[:extra_options]} > #{PIPE} 2>&1")
|
41
43
|
remove_pipe_if_exists
|
@@ -94,16 +96,32 @@ module Fastlane
|
|
94
96
|
description: "Your Firebase project id",
|
95
97
|
is_string: true,
|
96
98
|
optional: false),
|
99
|
+
FastlaneCore::ConfigItem.new(key: :devices,
|
100
|
+
env_name: "DEVICES",
|
101
|
+
description: "Devices to test the App on",
|
102
|
+
type: Array,
|
103
|
+
optional: true,
|
104
|
+
verify_block: proc do |devices|
|
105
|
+
devices.each do |d|
|
106
|
+
if d.class != Hash
|
107
|
+
UI.user_error!("Each device must be represented by a Hash object, #{d.class} found")
|
108
|
+
end
|
109
|
+
check_has_property(d, :model)
|
110
|
+
check_has_property(d, :version)
|
111
|
+
set_default_property(d, :locale, "en_US")
|
112
|
+
set_default_property(d, :orientation, "portrait")
|
113
|
+
end
|
114
|
+
end),
|
97
115
|
FastlaneCore::ConfigItem.new(key: :model,
|
98
116
|
env_name: "MODEL",
|
99
117
|
description: "The device's model on which the tests will be run",
|
100
118
|
is_string: true,
|
101
|
-
optional:
|
119
|
+
optional: true),
|
102
120
|
FastlaneCore::ConfigItem.new(key: :version,
|
103
121
|
env_name: "VERSION",
|
104
122
|
description: "The Android api version of the device",
|
105
123
|
is_string: true,
|
106
|
-
optional:
|
124
|
+
optional: true),
|
107
125
|
FastlaneCore::ConfigItem.new(key: :app_apk,
|
108
126
|
env_name: "APP_APK",
|
109
127
|
description: "The path for your app apk. Default: app/build/outputs/apk/debug/app-debug.apk",
|
@@ -181,8 +199,12 @@ module Fastlane
|
|
181
199
|
[
|
182
200
|
'run_tests_firebase_testlab(
|
183
201
|
project_id: "your-firebase-project-id",
|
184
|
-
|
185
|
-
|
202
|
+
devices: [
|
203
|
+
{
|
204
|
+
model: "Nexus6P",
|
205
|
+
version: "27"
|
206
|
+
}
|
207
|
+
],
|
186
208
|
delete_firebase_files: true
|
187
209
|
)'
|
188
210
|
]
|
@@ -192,6 +214,67 @@ module Fastlane
|
|
192
214
|
:testing
|
193
215
|
end
|
194
216
|
|
217
|
+
def self.check_has_property(device, property)
|
218
|
+
UI.user_error!("Each device must have #{property} property") unless device.key?(property)
|
219
|
+
end
|
220
|
+
|
221
|
+
private_class_method :check_has_property
|
222
|
+
|
223
|
+
def self.set_default_property(device, property, default)
|
224
|
+
unless device.key?(property)
|
225
|
+
device[property] = default
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
private_class_method :set_default_property
|
230
|
+
|
231
|
+
def self.validate_params(params)
|
232
|
+
if has_old_device_params(params)
|
233
|
+
UI.deprecated("The 'model', 'version', 'locale' and 'orientation' params are deprecated and will be removed in version 1.0!")
|
234
|
+
unless params[:devices].nil?
|
235
|
+
UI.user_error!("You can't use 'devices' param and 'model', 'version', "\
|
236
|
+
"'locale' and 'orientation' params at the same time")
|
237
|
+
end
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
private_class_method :validate_params
|
242
|
+
|
243
|
+
def self.has_old_device_params(params)
|
244
|
+
!(params[:model].nil? || params[:version].nil? || params[:locale].nil? || params[:orientation].nil?)
|
245
|
+
end
|
246
|
+
|
247
|
+
private_class_method :has_old_device_params
|
248
|
+
|
249
|
+
def self.create_devices_params(params)
|
250
|
+
if has_old_device_params(params)
|
251
|
+
params[:devices] = [
|
252
|
+
{
|
253
|
+
model: params[:model],
|
254
|
+
version: params[:version],
|
255
|
+
locale: params[:locale],
|
256
|
+
orientation: params[:orientation]
|
257
|
+
}
|
258
|
+
]
|
259
|
+
end
|
260
|
+
|
261
|
+
devices_params = ""
|
262
|
+
|
263
|
+
params[:devices].each do |device|
|
264
|
+
devices_params += create_device_param(device)
|
265
|
+
end
|
266
|
+
|
267
|
+
devices_params
|
268
|
+
end
|
269
|
+
|
270
|
+
private_class_method :create_devices_params
|
271
|
+
|
272
|
+
def self.create_device_param(device)
|
273
|
+
"--device model=#{device[:model]},version=#{device[:version]},locale=#{device[:locale]},orientation=#{device[:orientation]} "
|
274
|
+
end
|
275
|
+
|
276
|
+
private_class_method :create_device_param
|
277
|
+
|
195
278
|
def self.scrape_bucket_url
|
196
279
|
File.open(@test_console_output_file).each do |line|
|
197
280
|
url = line.scan(/\[(.*)\]/).last&.first
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-run_tests_firebase_testlab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bruno Correia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|