fastlane-plugin-automated_test_emulator_run 0.5.13 → 0.5.14

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: 3070c7dec3e0bcf261efbf9e2608910a0fe068f4
4
- data.tar.gz: 9c4fdb8f55df7c2e980d4e785159269d9b33246d
3
+ metadata.gz: 7f7f282005f7dacb4ff5848b472f1c29b4c52651
4
+ data.tar.gz: a24a45b8648cdbd5741e56c08cf368cacb033599
5
5
  SHA512:
6
- metadata.gz: 4cb6bf31416caba2297db471f4a2881244af67d767833963fada9ec28cf88cbde741cc2cc3bfc48bd68375f71f9fcfa9083f5edb4cb19fc7fdb344d45068cd80
7
- data.tar.gz: 1e35fbc09bd0ba8bc96541f30a8af42da7f7deaa47d1d2a3b483a2775e243c36cb9a1e13ba114acdec6737c22fd56c48638318c3763dc6a833ef2e660652eaf6
6
+ metadata.gz: f51d5ad57f8db799c386043bd8e7f2181d671fe08ca6bd3c9ea182e011eb513037c5ab57887db6714c8927e34ebfe8fd50e264a282775f70c7d7adefb3bea02f
7
+ data.tar.gz: 205d8b684f01244a2c30e777748ebe6225c6ea93cd9482a375c46a42f2b0ac2f3b202343c1972dd09711bd9f834b2ec39299c97be723c3ec40da3f577184bada
@@ -50,23 +50,13 @@ module Fastlane
50
50
  shell_command = "#{params[:shell_command]}" unless params[:shell_command].nil?
51
51
  gradle_task = "#{params[:gradle_task]}" unless params[:gradle_task].nil?
52
52
 
53
- # Get Available Devices
54
- UI.message("Getting avaliable devices".yellow)
55
- devices = Action.sh(get_devices_command)
56
-
57
- # Delete avd if one already exists for clean state.
58
- unless devices.match(/#{params[:avd_name]}/).nil?
59
- UI.message("Deleting existing AVD to create fresh one".yellow)
60
- Action.sh(sdkRoot + "/tools/android delete avd -n #{params[:avd_name]}")
61
- end
62
-
63
- # Creating AVD
53
+ # Recreating AVD
64
54
  UI.message("Creating AVD...".yellow)
65
- Action.sh(create_avd_command)
55
+ createEmulator(get_devices_command, create_avd_command, params)
66
56
 
67
57
  # Starting AVD
68
58
  UI.message("Starting AVD....".yellow)
69
- launchEmulator(start_avd_command, sdkRoot, port, params)
59
+ launchEmulator(start_avd_command, get_devices_command, create_avd_command, sdkRoot, port, params)
70
60
 
71
61
  UI.message("Starting tests".green)
72
62
  begin
@@ -98,13 +88,25 @@ module Fastlane
98
88
  return port
99
89
  end
100
90
 
101
- def self.launchEmulator(start_avd_command, sdkRoot, port, params)
91
+ def self.createEmulator(get_devices_command, create_avd_command, params)
92
+ UI.message("Getting avaliable devices".yellow)
93
+ devices = Action.sh(get_devices_command)
94
+
95
+ unless devices.match(/#{params[:avd_name]}/).nil?
96
+ UI.message("Deleting existing AVD to create fresh one".yellow)
97
+ Action.sh(sdkRoot + "/tools/android delete avd -n #{params[:avd_name]}")
98
+ end
99
+
100
+ Action.sh(create_avd_command)
101
+ end
102
+
103
+ def self.launchEmulator(start_avd_command, get_devices_command, create_avd_command, sdkRoot, port, params)
102
104
  restart_adb(sdkRoot)
103
105
  Action.sh(start_avd_command)
104
- waitFor_emulatorBoot(start_avd_command, sdkRoot, port, params)
106
+ waitFor_emulatorBoot(start_avd_command, get_devices_command, create_avd_command, sdkRoot, port, params)
105
107
  end
106
108
 
107
- def self.waitFor_emulatorBoot(start_avd_command, sdkRoot, port, params)
109
+ def self.waitFor_emulatorBoot(start_avd_command, get_devices_command, create_avd_command, sdkRoot, port, params)
108
110
  UI.message("Waiting for emulator to finish booting.....".yellow)
109
111
  startParams = "#{params[:avd_start_options]}"
110
112
 
@@ -113,7 +115,7 @@ module Fastlane
113
115
  Action.sh(sdkRoot + "/platform-tools/adb devices")
114
116
  return true
115
117
  else
116
- timeoutInSeconds= 180.0
118
+ timeoutInSeconds= 150.0
117
119
  startTime = Time.now
118
120
  loop do
119
121
  dev_bootcomplete, _stdeerr, _status = Open3.capture3(sdkRoot + ["/platform-tools/adb -s emulator-", port].join("") + " shell getprop dev.bootcomplete")
@@ -122,14 +124,18 @@ module Fastlane
122
124
  currentTime = Time.now
123
125
 
124
126
  if (currentTime - startTime) >= timeoutInSeconds
125
- UI.message("Emulator loading took more than 3 minutes. Restarting emulator launch until.".yellow)
127
+ UI.message("Emulator loading took more than 2 minutes 30 seconds. Restarting emulator launch until.".yellow)
126
128
  adb_devices_result = Action.sh(sdkRoot + "/platform-tools/adb devices")
127
129
  if adb_devices_result.include? "offline"
128
130
  kill_emulator(sdkRoot, port, params)
129
-
131
+
130
132
  delayInSeconds = 20.0
131
133
  sleep(delayInSeconds)
132
134
 
135
+ delete_emulator(sdkRoot, port, params)
136
+
137
+ createEmulator(get_devices_command, create_avd_command, params)
138
+
133
139
  launchEmulator(start_avd_command, sdkRoot, port, params)
134
140
  break
135
141
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module AutomatedTestEmulatorRun
3
- VERSION = "0.5.13"
3
+ VERSION = "0.5.14"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-automated_test_emulator_run
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.13
4
+ version: 0.5.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kamil Krzyk