fastlane-plugin-android_testlab_script_swit 0.1.933 → 0.1.935
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56bcf5c2ad3bcf5ef463227a72acd7dc662dcbb7a2b64b8faa5d087d107fa43b
|
4
|
+
data.tar.gz: aa1a698bdb13fc4f82c0f6ddc99eae6c0e54c28631d4fc5e3bdbdf1673c03858
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ee25e6d62df9b70039986b3c7ebe46e8624f48ecfff34acc66bb5c4bd1be0c52a252fc853a789e9a809e80bd74c537b6402536623599e47f0eb6ed84a23b97a
|
7
|
+
data.tar.gz: a93e77a0738b90e76ee6d9add3484f7adfeb4716b41cc7160e7224ea4302936aacbf9673cda4c86e3d1c7b586ac7655cc2559f3c38e39945314ea118febf212c
|
data/lib/fastlane/plugin/android_testlab_script_swit/actions/android_testlab_script_swit_action.rb
CHANGED
@@ -7,16 +7,6 @@ require 'httparty'
|
|
7
7
|
module Fastlane
|
8
8
|
module Actions
|
9
9
|
class AndroidTestlabScriptSwitAction < Action
|
10
|
-
|
11
|
-
def self.measure_time
|
12
|
-
start_time = Time.now
|
13
|
-
yield
|
14
|
-
end_time = Time.now
|
15
|
-
duration_sec_total = (end_time - start_time).round(1)
|
16
|
-
duration_min = (duration_sec_total / 60).round(1)
|
17
|
-
duration_sec = duration_sec_total % 60
|
18
|
-
return "총 #{duration_min}분 테스트"
|
19
|
-
end
|
20
10
|
|
21
11
|
# actions run
|
22
12
|
def self.run(params)
|
@@ -24,99 +14,65 @@ module Fastlane
|
|
24
14
|
UI.message("Start Action")
|
25
15
|
UI.message("********************************")
|
26
16
|
|
27
|
-
#
|
28
|
-
|
29
|
-
|
30
|
-
# Result Bucket & Dir
|
31
|
-
results_bucket = params[:firebase_test_lab_results_bucket] || "#{params[:project_id]}_test_results"
|
32
|
-
results_dir = params[:firebase_test_lab_results_dir] || "firebase_test_result_#{DateTime.now.strftime('%Y-%m-%d-%H:%M:%S')}"
|
33
|
-
|
34
|
-
# Set Target Project ID
|
35
|
-
Helper.config(params[:project_id])
|
36
|
-
|
37
|
-
# Activate service account
|
38
|
-
Helper.authenticate(params[:gcloud_key_file])
|
39
|
-
|
40
|
-
# RoboScriptOption
|
41
|
-
robo_script_option = params[:robo_script_path].nil? ? "" : "--robo-script #{params[:robo_script_path]} "
|
42
|
-
|
43
|
-
# Run Firebase Test Lab
|
44
|
-
Helper.run_tests(params[:gcloud_components_channel], "--type #{params[:type]} "\
|
45
|
-
"--app #{params[:app_apk]} "\
|
46
|
-
"#{"--test #{params[:app_test_apk]} " unless params[:app_test_apk].nil?}"\
|
47
|
-
"#{"--use-orchestrator " if params[:type] == "instrumentation" && params[:use_orchestrator]}"\
|
48
|
-
"#{params[:devices].map { |d| "--device model=#{d[:model]},version=#{d[:version]},locale=#{d[:locale]},orientation=#{d[:orientation]} " }.join}"\
|
49
|
-
"--timeout #{params[:timeout]} "\
|
50
|
-
"--results-bucket #{results_bucket} "\
|
51
|
-
"--results-dir #{results_dir} "\
|
52
|
-
"#{params[:extra_options]} "\
|
53
|
-
"#{robo_script_option}"\
|
54
|
-
"--format=json 1>#{Helper.if_need_dir(params[:console_log_file_name])}"
|
55
|
-
)
|
56
|
-
|
57
|
-
# Fetch results
|
58
|
-
download_dir = params[:download_dir]
|
59
|
-
if download_dir
|
60
|
-
UI.message("Fetch results from Firebase Test Lab results bucket")
|
61
|
-
json.each do |status|
|
62
|
-
axis = status["axis_value"]
|
63
|
-
Helper.if_need_dir("#{download_dir}/#{axis}")
|
64
|
-
Helper.copy_from_gcs("#{results_bucket}/#{results_dir}/#{axis}", download_dir)
|
65
|
-
Helper.set_public("#{results_bucket}/#{results_dir}/#{axis}")
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
70
|
-
|
71
|
-
# Swit Result PayLoad
|
72
|
-
swit_device_payload = ""
|
73
|
-
|
74
|
-
# Swit Send PayLoad - 테스트 시간 추가
|
75
|
-
swit_webhook_payload = params[:swit_webhook_payload][0..-5] + ','
|
76
|
-
swit_device_payload += "{\"type\":\"rt_section\",\"indent\":1,\"elements\":[{\"type\":\"rt_text\",\"content\":\"테스트 시간 : \"},{\"type\":\"rt_text\",\"content\":\"#{duration}\",\"styles\":{\"bold\":true}}]},"
|
77
|
-
|
78
|
-
# Firebase Test Lab Result Json
|
79
|
-
resultJson = File.read(params[:console_log_file_name])
|
80
|
-
|
81
|
-
swit_device_payload = resultJson.map.with_index do |item, device_index|
|
82
|
-
axis_value_parts = item["axis_value"].split('-')
|
83
|
-
outcome = item["outcome"]
|
84
|
-
|
85
|
-
model = axis_value_parts[0]
|
86
|
-
version = axis_value_parts[1]
|
87
|
-
locale = axis_value_parts[2]
|
88
|
-
orientation = axis_value_parts[3]
|
89
|
-
|
90
|
-
# 디바이스 정보
|
91
|
-
device_payload =
|
92
|
-
"[{\"type\":\"rt_section\",\"indent\":1,\"elements\":[{\"type\":\"rt_text\",\"content\":\"#{model}\"}]}, " +
|
93
|
-
"{\"type\":\"rt_section\",\"indent\":2,\"elements\":[{\"type\":\"rt_text\", \"content\": \"OS: #{version} / Locale: #{locale} / Orientation: #{orientation}\"}]}, "
|
94
|
-
|
95
|
-
# 성공 여부
|
96
|
-
if outcome == 'Passed'
|
97
|
-
device_payload +=
|
98
|
-
"{\"type\":\"rt_section\",\"elements\":[{\"type\":\"rt_text\",\"content\":\"결과 : \"},{\"type\":\"rt_emoji\",\"name\":\":tada:\"},{\"type\":\"rt_text\",\"content\":\" Passed \"},{\"type\":\"rt_emoji\",\"name\":\":tada:\"}]}"
|
99
|
-
elsif outcome == 'Failed'
|
100
|
-
device_payload +=
|
101
|
-
"{\"type\":\"rt_section\",\"elements\":[{\"type\":\"rt_text\",\"content\":\"결과 : \"},{\"type\":\"rt_emoji\",\"name\":\":interrobang:\"},{\"type\":\"rt_text\",\"content\":\" Failed \"},{\"type\":\"rt_emoji\",\"name\": \":interrobang:\"}]}"
|
102
|
-
else # Skip or other outcomes
|
103
|
-
device_payload +=
|
104
|
-
"{\"type\":\"rt_section\",\"elements\":[{\"type\":{\"name\": \":bulb:\"}},{\"text\":{\"content\": \" Skipped or other outcomes \"}}, {\"emoji\":{\"name\": \":bulb:\"}}]}"
|
105
|
-
end
|
17
|
+
# Result Bucket & Dir
|
18
|
+
results_bucket = params[:firebase_test_lab_results_bucket] || "#{params[:project_id]}_test_results"
|
19
|
+
results_dir = params[:firebase_test_lab_results_dir] || "firebase_test_result_#{DateTime.now.strftime('%Y-%m-%d-%H:%M:%S')}"
|
106
20
|
|
107
|
-
|
108
|
-
|
109
|
-
end.join(',')
|
21
|
+
# Set Target Project ID
|
22
|
+
Helper.config(params[:project_id])
|
110
23
|
|
111
|
-
|
24
|
+
# Activate service account
|
25
|
+
Helper.authenticate(params[:gcloud_key_file])
|
112
26
|
|
113
|
-
#
|
114
|
-
|
27
|
+
# RoboScriptOption
|
28
|
+
robo_script_option = params[:robo_script_path].nil? ? "" : "--robo-script #{params[:robo_script_path]} "
|
29
|
+
|
30
|
+
# Run Firebase Test Lab
|
31
|
+
|
32
|
+
# 딜레이
|
33
|
+
params[:devices].each_with_index do |device, index|
|
34
|
+
# 딜레이 추가
|
35
|
+
sleep(index * 60) # 각 디바이스별로 1분씩 증가하는 딜레이
|
36
|
+
|
37
|
+
# Run Firebase Test Lab for the current device
|
38
|
+
Helper.run_tests(params[:gcloud_components_channel], "--type #{params[:type]} "\
|
39
|
+
"--app #{params[:app_apk]} "\
|
40
|
+
"#{"--test #{params[:app_test_apk]} " unless params[:app_test_apk].nil?}"\
|
41
|
+
"#{"--use-orchestrator " if params[:type] == "instrumentation" && params[:use_orchestrator]}"\
|
42
|
+
"--device model=#{device[:model]},version=#{device[:version]},locale=#{device[:locale]},orientation=#{device[:orientation]} "\
|
43
|
+
"--timeout #{params[:timeout]} "\
|
44
|
+
"--results-bucket #{results_bucket} "\
|
45
|
+
"--results-dir #{results_dir} "\
|
46
|
+
"#{params[:extra_options]} "\
|
47
|
+
"#{robo_script_option}"\
|
48
|
+
"--format=json 1>#{Helper.if_need_dir(params[:console_log_file_name])}"
|
49
|
+
end
|
115
50
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
51
|
+
|
52
|
+
#Helper.run_tests(params[:gcloud_components_channel], "--type #{params[:type]} "\
|
53
|
+
"--app #{params[:app_apk]} "\
|
54
|
+
"#{"--test #{params[:app_test_apk]} " unless params[:app_test_apk].nil?}"\
|
55
|
+
"#{"--use-orchestrator " if params[:type] == "instrumentation" && params[:use_orchestrator]}"\
|
56
|
+
"#{params[:devices].map { |d| "--device model=#{d[:model]},version=#{d[:version]},locale=#{d[:locale]},orientation=#{d[:orientation]} " }.join}"\
|
57
|
+
"--timeout #{params[:timeout]} "\
|
58
|
+
"--results-bucket #{results_bucket} "\
|
59
|
+
"--results-dir #{results_dir} "\
|
60
|
+
"#{params[:extra_options]} "\
|
61
|
+
"#{robo_script_option}"\
|
62
|
+
"--format=json 1>#{Helper.if_need_dir(params[:console_log_file_name])}"
|
63
|
+
#)
|
64
|
+
|
65
|
+
# Fetch results
|
66
|
+
download_dir = params[:download_dir]
|
67
|
+
if download_dir
|
68
|
+
UI.message("Fetch results from Firebase Test Lab results bucket")
|
69
|
+
json.each do |status|
|
70
|
+
axis = status["axis_value"]
|
71
|
+
Helper.if_need_dir("#{download_dir}/#{axis}")
|
72
|
+
Helper.copy_from_gcs("#{results_bucket}/#{results_dirresults_dir}/#{axis}", download_dir)
|
73
|
+
Helper.set_public("#{results_bucket}/#{results_dir}/#{axis}")
|
74
|
+
end
|
75
|
+
end
|
120
76
|
|
121
77
|
UI.message("********************************")
|
122
78
|
UI.message("Finish Action")
|
@@ -215,20 +171,6 @@ module Fastlane
|
|
215
171
|
type: String,
|
216
172
|
optional: false),
|
217
173
|
|
218
|
-
# swit_webhook url (false)
|
219
|
-
FastlaneCore::ConfigItem.new(key: :swit_webhook_url,
|
220
|
-
env_name: "SWIT_WEBHOOK_URL",
|
221
|
-
description: "The Swit WebHOOK URL",
|
222
|
-
type: String,
|
223
|
-
optional: true),
|
224
|
-
|
225
|
-
# swit_webhook payload (false)
|
226
|
-
FastlaneCore::ConfigItem.new(key: :swit_webhook_payload,
|
227
|
-
env_name: "SWIT_WEBHOOK_PAYLOAD",
|
228
|
-
description: "The Swit WebHOOK PAYLOAD",
|
229
|
-
type: String,
|
230
|
-
optional: true),
|
231
|
-
|
232
174
|
# test apk (false)
|
233
175
|
FastlaneCore::ConfigItem.new(key: :app_test_apk,
|
234
176
|
env_name: "APP_TEST_APK",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-android_testlab_script_swit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.935
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 나비이쁜이
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|