fastlane-plugin-android_testlab_script_swit 0.1.917 → 0.1.919
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3abf4f751114b6fa21b861e2d83a011b51de444a3c61f86dd0b764a8d4236d2a
|
4
|
+
data.tar.gz: 4f5735bce308da7f556689e6fe52fed729f56502edd48f089fb5a151c6af4afa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc540da45ace53d8e58eef8856458f34eb0dd69542c06bbbdec125c1e92952523367a22ef6c337e5e71464d92bc9a11c7736b40e0792d91ce6cb0a773e81e82b
|
7
|
+
data.tar.gz: 59deca4098f4cd101adcfd771be2502860a39b853fb15ab7ed0ca188853b391f731a95fa82daa16b9ff5539dff3ff9891b2f662dac9ab7f5e83fd2915ed55637
|
data/lib/fastlane/plugin/android_testlab_script_swit/actions/android_testlab_script_swit_action.rb
CHANGED
@@ -13,97 +13,88 @@ module Fastlane
|
|
13
13
|
UI.message("********************************")
|
14
14
|
UI.message("Start Action")
|
15
15
|
UI.message("********************************")
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
16
|
+
|
17
|
+
def measure_time
|
18
|
+
start_time = Time.now
|
19
|
+
yield
|
20
|
+
end_time = Time.now
|
21
|
+
duration_sec_total = (end_time - start_time).round(1)
|
22
|
+
duration_min = (duration_sec_total / 60).round(1)
|
23
|
+
duration_sec = duration_sec_total % 60
|
24
|
+
return "#{duration_min}분 소요시간 자동화"
|
25
|
+
end
|
26
|
+
|
27
|
+
duration = measure_time do
|
28
|
+
|
29
|
+
# Result Bucket & Dir
|
30
|
+
results_bucket = params[:firebase_test_lab_results_bucket] || "#{params[:project_id]}_test_results"
|
31
|
+
results_dir = params[:firebase_test_lab_results_dir] || "firebase_test_result_#{DateTime.now.strftime('%Y-%m-%d-%H:%M:%S')}"
|
32
|
+
|
33
|
+
# Set Target Project ID
|
34
|
+
Helper.config(params[:project_id])
|
35
|
+
|
36
|
+
# Activate service account
|
37
|
+
Helper.authenticate(params[:gcloud_key_file])
|
38
|
+
|
39
|
+
# RoboScriptOption
|
40
|
+
robo_script_option = params[:robo_script_path].nil? ? "" : "--robo-script #{params[:robo_script_path]} "
|
41
|
+
|
42
|
+
# Run Firebase Test Lab
|
43
|
+
Helper.run_tests(params[:gcloud_components_channel], "--type #{params[:type]} "\
|
44
|
+
"--app #{params[:app_apk]} "\
|
45
|
+
"#{"--test #{params[:app_test_apk]} " unless params[:app_test_apk].nil?}"\
|
46
|
+
"#{"--use-orchestrator " if params[:type] == "instrumentation" && params[:use_orchestrator]}"\
|
47
|
+
"#{params[:devices].map { |d| "--device model=#{d[:model]},version=#{d[:version]},locale=#{d[:locale]},orientation=#{d[:orientation]} " }.join}"\
|
48
|
+
"--timeout #{params[:timeout]} "\
|
49
|
+
"--results-bucket #{results_bucket} "\
|
50
|
+
"--results-dir #{results_dir} "\
|
51
|
+
"#{params[:extra_options]} "\
|
52
|
+
"#{robo_script_option}"\
|
53
|
+
"--format=json 1>#{Helper.if_need_dir(params[:console_log_file_name])}"
|
54
|
+
)
|
55
|
+
|
56
|
+
# Fetch results
|
57
|
+
download_dir = params[:download_dir]
|
58
|
+
if download_dir
|
59
|
+
UI.message("Fetch results from Firebase Test Lab results bucket")
|
60
|
+
json.each do |status|
|
61
|
+
axis = status["axis_value"]
|
62
|
+
Helper.if_need_dir("#{download_dir}/#{axis}")
|
63
|
+
Helper.copy_from_gcs("#{results_bucket}/#{results_dir}/#{axis}", download_dir)
|
64
|
+
Helper.set_public("#{results_bucket}/#{results_dir}/#{axis}")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
29
69
|
|
30
70
|
# Swit Result PayLoad
|
31
71
|
swit_device_payload = ""
|
32
72
|
|
33
|
-
# Swit Send PayLoad
|
73
|
+
# Swit Send PayLoad - 테스트 시간 추가
|
34
74
|
swit_webhook_payload = params[:swit_webhook_payload][0..-5] + ','
|
75
|
+
swit_webhook_payload += "{\"type\":\"rt_section\",\"indent\":1,\"elements\":[{\"type\":\"rt_text\",\"content\":\"테스트 시간 : #{duration}\"}]},"
|
35
76
|
|
36
|
-
# Run Firebase Test Lab
|
37
|
-
Helper.run_tests(params[:gcloud_components_channel], "--type #{params[:type]} "\
|
38
|
-
"--app #{params[:app_apk]} "\
|
39
|
-
"#{"--test #{params[:app_test_apk]} " unless params[:app_test_apk].nil?}"\
|
40
|
-
"#{"--use-orchestrator " if params[:type] == "instrumentation" && params[:use_orchestrator]}"\
|
41
|
-
"#{params[:devices].map { |d| "--device model=#{d[:model]},version=#{d[:version]},locale=#{d[:locale]},orientation=#{d[:orientation]} " }.join}"\
|
42
|
-
"--timeout #{params[:timeout]} "\
|
43
|
-
"--results-bucket #{results_bucket} "\
|
44
|
-
"--results-dir #{results_dir} "\
|
45
|
-
"#{params[:extra_options]} "\
|
46
|
-
"#{robo_script_option}"\
|
47
|
-
"--format=json 1>#{Helper.if_need_dir(params[:console_log_file_name])}"
|
48
|
-
)
|
49
|
-
|
50
77
|
# Firebase Test Lab Result Json
|
51
78
|
resultJson = JSON.parse(File.read(params[:console_log_file_name]))
|
52
79
|
|
53
80
|
swit_device_payload = resultJson.map.with_index do |item, device_index|
|
54
81
|
axis_value_parts = item["axis_value"].split('-')
|
55
82
|
outcome = item["outcome"]
|
56
|
-
|
83
|
+
|
84
|
+
model = axis_value_parts[0]
|
85
|
+
version = axis_value_parts[1]
|
86
|
+
locale = axis_value_parts[2]
|
87
|
+
orientation = axis_value_parts[3]
|
88
|
+
|
57
89
|
parts_payload = axis_value_parts.map do |part|
|
58
90
|
"{\"type\":\"rt_section\",\"indent\":2,\"elements\":[{\"type\":\"rt_text\",\"content\":\"Part : #{part}\"}]}"
|
59
91
|
end.join(',')
|
60
92
|
|
61
|
-
device_payload = "{\"type\":\"rt_section\",\"indent\":1,\"elements\":[{\"type\":\"rt_text\",\"content\":\"Device#{device_index + 1}\"}]}
|
62
|
-
|
93
|
+
device_payload = "{\"type\":\"rt_section\",\"indent\":1,\"elements\":[{\"type\":\"rt_text\",\"content\":\"Device#{device_index + 1}\"}]},{\"type\":\"rt_section\",\"indent\":2,\"elements\":[{\"type\":\"rt_text\",\"content\":\"model: #{model}\"},{\"type\":\"rt_text\",\"content\":\"version: #{version}\"},{\"type\":\"rt_text\",\"content\":\"locale: #{locale}\"},{\"type\":\"rt_text\",\"content\":\"orientation: #{orientation}\"},{\"type\":\"rt_text\",\"content\": \"Outcome: #{outcome.to_json}}]}"
|
94
|
+
end.join(',')
|
63
95
|
|
64
96
|
swit_device_payload.chomp!(',')
|
65
97
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
# 각 JSON 객체에 대해 반복
|
70
|
-
# resultJson.each do |item|
|
71
|
-
# # 정보 추출하기
|
72
|
-
# axis_value = item["axis_value"]
|
73
|
-
# outcome = item["outcome"]
|
74
|
-
# test_details = item["test_details"]
|
75
|
-
#
|
76
|
-
# # 'axis_value' 분리하기
|
77
|
-
# parts = axis_value.split('-')
|
78
|
-
#
|
79
|
-
# parts.each_with_index do |part, index|
|
80
|
-
# swit_device_payload += "{\"type\":\"rt_section\",\"indent\":1,\"elements\":[{\"type\":\"rt_text\",\"content\":\"Device#{index + 1}\"}]},
|
81
|
-
# {\"type\": \"rt_section\",\"indent\":2,\"elements\":[{\"type\":\"rt_text\",\"content\":\"Part : #{parts[index]}\"}]},
|
82
|
-
# {\"type\":\"rt_section\",\"indent\":2,\"elements\":[{\"type\":\"rt_text\",\"content":"Result : #{outcome}\"}]}"
|
83
|
-
#
|
84
|
-
# swit_device_payload += "," unless index == parts.length - 1
|
85
|
-
# end
|
86
|
-
# end
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
# 중간 체크
|
93
|
-
UI.message(swit_device_payload)
|
94
|
-
|
95
|
-
# Fetch results
|
96
|
-
download_dir = params[:download_dir]
|
97
|
-
if download_dir
|
98
|
-
UI.message("Fetch results from Firebase Test Lab results bucket")
|
99
|
-
json.each do |status|
|
100
|
-
axis = status["axis_value"]
|
101
|
-
Helper.if_need_dir("#{download_dir}/#{axis}")
|
102
|
-
Helper.copy_from_gcs("#{results_bucket}/#{results_dir}/#{axis}", download_dir)
|
103
|
-
Helper.set_public("#{results_bucket}/#{results_dir}/#{axis}")
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
98
|
# Swit PayLoad 병합
|
108
99
|
swit_webhook_payload += swit_device_payload + ']}]}'
|
109
100
|
|