fastlane-plugin-android_testlab_script_swit 0.1.916 → 0.1.918

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: 16f5b4ce741d819dd105c9a915259481e748a9d1f7d70d33021d58768eafac30
4
- data.tar.gz: c13498ef4f0e1a6ae7b9c061277fcef6e4dbb64aa4551d8e49265bb3a2154cea
3
+ metadata.gz: 331eea0ed093eb1b8975cde6b903a52cc91ba23fd4c3d8303283be032ca4d615
4
+ data.tar.gz: a4c16f84e8d45e98a2efdc0ee540e0b5335f5d323914f1ef67dd49d03b97d7c1
5
5
  SHA512:
6
- metadata.gz: 704fdef9c914610f101d009c2f1eb3188768af7a719bb7736e16db30901da875b90f4492d15e3f5e39c297ec0dbccd81b925d3999653670ec7e6b2d3518a124b
7
- data.tar.gz: 314ee9bd65b0e47a96153aba54839ed55d50337b9987f622e3ccc2e92cfb9ea8722086772c07efb3f29f4a000f8adb0e0653fb1d8c23a4db0140b6d8b56c4fb7
6
+ metadata.gz: '02490e83460058c6c3bb140cdd80bf0f2f9d0aac861ed177e5e15645041bf9baf59bd00aeb77381cc4ecfe21dd345ea4b48ac25b3439f58de758edfa2edd66be'
7
+ data.tar.gz: 01ff2a28cafa1df4179da0c1c502c83f20cfcac5bbc423d971fc5ccaa7c2f836bd6835dd2a5dd4b7d65b999b0eb041c448f9a7091494855414c1eaa379d2409f
@@ -13,6 +13,16 @@ module Fastlane
13
13
  UI.message("********************************")
14
14
  UI.message("Start Action")
15
15
  UI.message("********************************")
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
16
26
 
17
27
  # Result Bucket & Dir
18
28
  results_bucket = params[:firebase_test_lab_results_bucket] || "#{params[:project_id]}_test_results"
@@ -27,12 +37,6 @@ module Fastlane
27
37
  # RoboScriptOption
28
38
  robo_script_option = params[:robo_script_path].nil? ? "" : "--robo-script #{params[:robo_script_path]} "
29
39
 
30
- # Swit Result PayLoad
31
- swit_device_payload = ""
32
-
33
- # Swit Send PayLoad
34
- swit_webhook_payload = params[:swit_webhook_payload][0..-5] + ','
35
-
36
40
  # Run Firebase Test Lab
37
41
  Helper.run_tests(params[:gcloud_components_channel], "--type #{params[:type]} "\
38
42
  "--app #{params[:app_apk]} "\
@@ -46,65 +50,38 @@ module Fastlane
46
50
  "#{robo_script_option}"\
47
51
  "--format=json 1>#{Helper.if_need_dir(params[:console_log_file_name])}"
48
52
  )
49
-
53
+
54
+ # Swit Result PayLoad
55
+ swit_device_payload = ""
56
+
57
+ # Swit Send PayLoad - 테스트 시간 추가
58
+ swit_webhook_payload = params[:swit_webhook_payload][0..-5] + ','
59
+ swit_webhook_payload += "{\"type\":\"rt_section\",\"indent\":1,\"elements\":[{\"type\":\"rt_text\",\"content\":\"테스트 시간 : #{test_time}\"}]},"
60
+
50
61
  # Firebase Test Lab Result Json
51
62
  resultJson = JSON.parse(File.read(params[:console_log_file_name]))
52
63
 
53
- resultJson.each_with_index do |item, device_index|
54
- # 정보 추출하기
55
- axis_value = item["axis_value"]
56
- outcome = item["outcome"]
57
- test_details = item["test_details"]
58
-
59
- # 'axis_value' 분리하기
60
- parts = axis_value.split('-')
64
+ swit_device_payload = resultJson.map.with_index do |item, device_index|
65
+ axis_value_parts = item["axis_value"].split('-')
66
+ outcome = item["outcome"]
61
67
 
62
- swit_device_payload += "{\"type\":\"rt_section\",\"indent\":1,\"elements\":[{\"type\":\"rt_text\",\"content\":\"Device#{device_index + 1}\"}]},"
68
+ model = axis_value_parts[0]
69
+ version = axis_value_parts[1]
70
+ locale = axis_value_parts[2]
71
+ orientation = axis_value_parts[3]
63
72
 
64
- parts.each_with_index do |part, part_index|
65
- swit_device_payload += "{\"type\": \"rt_section\",\"indent\":2,\"elements\":[{\"type\":\"rt_text\",\"content\":\"Part : #{part}\"}]}"
66
-
67
- if part_index == (parts.length -1)
68
- safe_outcome = outcome.to_json
69
- swit_device_payload += ",{\"type\":\"rt_section\",\"indent\":2,\"elements\":[{\"type\":\"rt_text\",\"content\": #{safe_outcome}}]}"
70
- else
71
- swit_device_payload += ","
72
- end
73
- end
74
-
75
- swit_device_payload += "," unless device_index == (resultJson.length -1)
76
- end
77
-
78
- # remove the last comma if it exists
79
- swit_device_payload.chomp!(',')
73
+ parts_payload = axis_value_parts.map do |part|
74
+ "{\"type\":\"rt_section\",\"indent\":2,\"elements\":[{\"type\":\"rt_text\",\"content\":\"Part : #{part}\"}]}"
75
+ end.join(',')
80
76
 
77
+ 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}}]}"
78
+ end.join(',')
81
79
 
80
+ swit_device_payload.chomp!(',')
81
+
82
82
 
83
- # 각 JSON 객체에 대해 반복
84
- # resultJson.each do |item|
85
- # # 정보 추출하기
86
- # axis_value = item["axis_value"]
87
- # outcome = item["outcome"]
88
- # test_details = item["test_details"]
89
- #
90
- # # 'axis_value' 분리하기
91
- # parts = axis_value.split('-')
92
- #
93
- # parts.each_with_index do |part, index|
94
- # swit_device_payload += "{\"type\":\"rt_section\",\"indent\":1,\"elements\":[{\"type\":\"rt_text\",\"content\":\"Device#{index + 1}\"}]},
95
- # {\"type\": \"rt_section\",\"indent\":2,\"elements\":[{\"type\":\"rt_text\",\"content\":\"Part : #{parts[index]}\"}]},
96
- # {\"type\":\"rt_section\",\"indent\":2,\"elements\":[{\"type\":\"rt_text\",\"content":"Result : #{outcome}\"}]}"
97
- #
98
- # swit_device_payload += "," unless index == parts.length - 1
99
- # end
100
- # end
101
-
102
-
103
83
 
104
-
105
84
 
106
- # 중간 체크
107
- UI.message(swit_device_payload)
108
85
 
109
86
  # Fetch results
110
87
  download_dir = params[:download_dir]
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module AndroidTestlabScriptSwit
3
- VERSION = "0.1.916"
3
+ VERSION = "0.1.918"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
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.916
4
+ version: 0.1.918
5
5
  platform: ruby
6
6
  authors:
7
7
  - 나비이쁜이