apophis 0.1.0 → 0.2.0
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 +4 -4
- data/lib/apophis/appium_runner.rb +7 -4
- data/lib/apophis/runner.rb +28 -18
- data/lib/apophis/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5328908f29d5a0aee3ae2c839f319d8b624c31d4
|
4
|
+
data.tar.gz: 02b4adda6130ae5e245851b94d4857094f32ff00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be62a539b8bf2d0ce6f9022ba51324c0d5ca8e2dad47877172a0709e31774c9eb39735e84a14e7ed700df06c8a333fe1f00a8aec9da004761760b9fde85b4e0e
|
7
|
+
data.tar.gz: 180616985cebf8e883cbace2b936ea8848efb0b8f1e5930bbea7d3ff6aa3f36805b76b623d3e542a9b6e387cca51aabc3423ea959f66e74947ec35a2eba9e0e5
|
@@ -15,6 +15,7 @@ class AppiumRunner
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def available?(port)
|
18
|
+
return false unless port
|
18
19
|
!!find(port)
|
19
20
|
end
|
20
21
|
|
@@ -35,9 +36,11 @@ class AppiumRunner
|
|
35
36
|
appiums.find{|app| app[:url] =~ /:#{port}/}
|
36
37
|
end
|
37
38
|
|
38
|
-
def launch_and_wait(port=
|
39
|
-
port = find_available_port(
|
40
|
-
|
39
|
+
def launch_and_wait(port=nil, timeout=20)
|
40
|
+
port = port || find_available_port(4500)
|
41
|
+
|
42
|
+
#we'll use the env variable later to locate this process (`ps -p <PID> -wwwE`)
|
43
|
+
Process.spawn("APOPHIS_TAG=#{port} appium -p #{port} -bp #{port+1} > /dev/null 2>&1")
|
41
44
|
DottyTimeout.timeout(timeout){ available?(port) }
|
42
45
|
|
43
46
|
{ port: port }
|
@@ -49,7 +52,7 @@ class AppiumRunner
|
|
49
52
|
res = JSON.parse(open("#{ candidate }/status").read)
|
50
53
|
!!res["value"]
|
51
54
|
end
|
52
|
-
rescue
|
55
|
+
rescue Exception => _
|
53
56
|
false
|
54
57
|
end
|
55
58
|
end
|
data/lib/apophis/runner.rb
CHANGED
@@ -16,33 +16,33 @@ module Apophis
|
|
16
16
|
gm = GenymotionRunner.new
|
17
17
|
gm.doctor!
|
18
18
|
|
19
|
-
|
19
|
+
caps[:runner] ||= {}
|
20
|
+
runner = caps[:runner]
|
21
|
+
|
22
|
+
if runner && runner[:genymotion] && gm.devices.empty?
|
20
23
|
@log.info '---> no android device found, launching genymotion...'
|
21
|
-
gm.launch(
|
24
|
+
gm.launch(runner[:genymotion])
|
22
25
|
@log.info '---> devices available:'
|
23
26
|
@log.info gm.devices.join("\n")
|
24
27
|
end
|
25
28
|
|
29
|
+
port = runner ? runner[:port] : nil
|
26
30
|
ar = AppiumRunner.new
|
27
31
|
ar.doctor!
|
28
32
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
@log.info '---> being a douch and killing all running appiums.'
|
33
|
-
@log.info '---> improve me later to map caps->device->device uuid->appium->appium session.'
|
34
|
-
appiums.each do |app|
|
35
|
-
@log.info "---> killing appium #{ app }"
|
36
|
-
ar.kill_and_wait(app[:port])
|
37
|
-
end
|
33
|
+
if ar.available?(port)
|
34
|
+
@log.info "--> killing appium on port #{port}"
|
35
|
+
ar.kill_and_wait(port)
|
38
36
|
end
|
39
37
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
38
|
+
@log.info '---> launching a new appium...'
|
39
|
+
launchinfo = ar.launch_and_wait
|
40
|
+
# this is the magic: map the fresh appium port to this current test
|
41
|
+
caps[:appium_lib][:port] = launchinfo[:port]
|
42
|
+
caps[:runner][:port] = launchinfo[:port]
|
43
|
+
|
44
|
+
@log.info "---> done. wiring caps to appium #{launchinfo}"
|
45
|
+
@log.info caps
|
46
46
|
|
47
47
|
|
48
48
|
@log.info "---> starting driver..."
|
@@ -57,8 +57,18 @@ module Apophis
|
|
57
57
|
# #promote_appium_methods rely on. We'll have no
|
58
58
|
# choice but chip-in on this nonsense when we
|
59
59
|
# want to do cleanups etc.
|
60
|
-
def cleanup
|
60
|
+
def cleanup(caps=nil)
|
61
61
|
@log.info '---> cleaning up...'
|
62
|
+
if caps
|
63
|
+
port = caps[:runner][:port]
|
64
|
+
ar = AppiumRunner.new
|
65
|
+
|
66
|
+
if ar.available?(port)
|
67
|
+
@log.info "--> killing appium on port #{port}"
|
68
|
+
ar.kill_and_wait(port)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
62
72
|
$driver.driver_quit if $driver
|
63
73
|
@log.info '---> done.'
|
64
74
|
end
|
data/lib/apophis/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apophis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dotan Nahum
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appium_lib
|