fastlane-plugin-android_testlab_script_swit 0.1.35 → 0.1.37
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/android_testlab_script_swit/actions/android_testlab_script_swit_action.rb +66 -15
- data/lib/fastlane/plugin/android_testlab_script_swit/helper/android_testlab_script_swit_helper.rb +4 -0
- data/lib/fastlane/plugin/android_testlab_script_swit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c022838ee298ef493126bee4d45b3f57189b067498ace65b91e82e282de84ba
|
4
|
+
data.tar.gz: 6739c6875e6b390e16ed55f13cc7f23a8f73f32b9c71290c229abad624d548df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 610d1881b5e91edfe3dc2c45209b611009495c91338a4fcdd2db6217e0c0be78db0d7bc93f3d77a331fbf2852cdafcc7ac88c827e7bdf14642a076821326ace2
|
7
|
+
data.tar.gz: afd6ff095e267d2e73409a4182c76792bb2718a8d2a95241869035c0f8d70d848f399554d61e0c5d9343b882a43fef654a453602f7ead2cfc7279febd9498e18
|
data/lib/fastlane/plugin/android_testlab_script_swit/actions/android_testlab_script_swit_action.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'fastlane/action'
|
2
2
|
require 'json'
|
3
3
|
require 'fileutils'
|
4
|
+
require 'httparty'
|
5
|
+
require 'open-uri'
|
4
6
|
|
5
7
|
module Fastlane
|
6
8
|
module Actions
|
@@ -23,7 +25,7 @@ module Fastlane
|
|
23
25
|
robo_script_option = params[:robo_script_path].nil? ? "" : "--robo-script #{params[:robo_script_path]} "
|
24
26
|
|
25
27
|
# Run Firebase Test Lab
|
26
|
-
Helper.run_tests(params[:gcloud_components_channel], "--type #{params[:type]} "\
|
28
|
+
result_url = Helper.run_tests(params[:gcloud_components_channel], "--type #{params[:type]} "\
|
27
29
|
"--app #{params[:app_apk]} "\
|
28
30
|
"#{"--test #{params[:app_test_apk]} " unless params[:app_test_apk].nil?}"\
|
29
31
|
"#{"--use-orchestrator " if params[:type] == "instrumentation" && params[:use_orchestrator]}"\
|
@@ -36,24 +38,45 @@ module Fastlane
|
|
36
38
|
"--format=json 1>#{Helper.if_need_dir(params[:console_log_file_name])}"
|
37
39
|
)
|
38
40
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
41
|
+
wait_for_test_to_complete(test_results_url)
|
42
|
+
|
43
|
+
swit_webhook_url = params[:swit_webhook_url]
|
44
|
+
swit_webhook_payload = params[:swit_webhook_payload]
|
45
|
+
|
46
|
+
HTTParty.post(swit_webhook_url, body: swit_webhook_payload.to_json, headers: { 'Content-Type' => 'application/json' })
|
47
|
+
|
48
|
+
# json = JSON.parse(File.read(params[:console_log_file_name]))
|
49
|
+
# UI.message("Test status: #{json}")
|
50
|
+
#
|
51
|
+
# # Fetch results
|
52
|
+
# download_dir = params[:download_dir]
|
53
|
+
# if download_dir
|
54
|
+
# UI.message("Fetch results from Firebase Test Lab results bucket")
|
55
|
+
# json.each do |status|
|
56
|
+
# axis = status["axis_value"]
|
57
|
+
# Helper.if_need_dir("#{download_dir}/#{axis}")
|
58
|
+
# Helper.copy_from_gcs("#{results_bucket}/#{results_dir}/#{axis}", download_dir)
|
59
|
+
# Helper.set_public("#{results_bucket}/#{results_dir}/#{axis}")
|
60
|
+
# end
|
61
|
+
# end
|
53
62
|
|
54
63
|
UI.message("Finish Action")
|
55
64
|
end
|
56
65
|
|
66
|
+
def wait_for_test_to_complete(url)
|
67
|
+
require 'open-uri'
|
68
|
+
|
69
|
+
loop do
|
70
|
+
html = open(url).read
|
71
|
+
|
72
|
+
if html.include?("Test is complete")
|
73
|
+
break
|
74
|
+
else
|
75
|
+
sleep(10) # wait for a few seconds before checking again.
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
57
80
|
# Short Detils
|
58
81
|
def self.description
|
59
82
|
"Android Firebase TestLab with Robo Script Test"
|
@@ -146,6 +169,20 @@ module Fastlane
|
|
146
169
|
type: String,
|
147
170
|
optional: false),
|
148
171
|
|
172
|
+
# swit_webhook url (true)
|
173
|
+
FastlaneCore::ConfigItem.new(key: :swit_webhook_url,
|
174
|
+
env_name: "SWIT_WEBHOOK_URL",
|
175
|
+
description: "The Swit WebHOOK URL",
|
176
|
+
type: String,
|
177
|
+
optional: true),
|
178
|
+
|
179
|
+
# swit_webhook payload (false)
|
180
|
+
FastlaneCore::ConfigItem.new(key: :swit_webhook_payload,
|
181
|
+
env_name: "SWIT_WEBHOOK_PAYLOAD",
|
182
|
+
description: "The Swit WebHOOK PAYLOAD",
|
183
|
+
type: String,
|
184
|
+
optional: true),
|
185
|
+
|
149
186
|
# test apk (false)
|
150
187
|
FastlaneCore::ConfigItem.new(key: :app_test_apk,
|
151
188
|
env_name: "APP_TEST_APK",
|
@@ -241,10 +278,24 @@ module Fastlane
|
|
241
278
|
platform == :android
|
242
279
|
end
|
243
280
|
|
281
|
+
#
|
244
282
|
def self.output
|
245
283
|
[['console_output.log', 'A console log when running Firebase Test Lab with gcloud']]
|
246
284
|
end
|
247
285
|
|
286
|
+
#
|
287
|
+
def wait_for_test_to_complete(url)
|
288
|
+
loop do
|
289
|
+
html = open(url).read
|
290
|
+
|
291
|
+
if html.include?("TestLab is complete")
|
292
|
+
break
|
293
|
+
else
|
294
|
+
sleep(10) # wait for 10 seconds before checking again
|
295
|
+
end
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
248
299
|
def self.example_code
|
249
300
|
|
250
301
|
end
|
data/lib/fastlane/plugin/android_testlab_script_swit/helper/android_testlab_script_swit_helper.rb
CHANGED
@@ -105,6 +105,10 @@ module Fastlane
|
|
105
105
|
return success, body
|
106
106
|
end
|
107
107
|
|
108
|
+
def self.swit_body_text(body_text)
|
109
|
+
|
110
|
+
end
|
111
|
+
|
108
112
|
def self.make_github_text(json, project_id, bucket, dir, test_type)
|
109
113
|
prefix = "<img src=\"https://github.com/cats-oss/fastlane-plugin-firebase_test_lab_android/blob/master/art/firebase_test_lab_logo.png?raw=true\" width=\"65%\" loading=\"lazy\" />"
|
110
114
|
cells = json.map { |data|
|