wda_lib 0.0.11 → 0.0.12
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/README.md +2 -0
- data/lib/wda_lib/debug.rb +6 -8
- data/lib/wda_lib/screenshot.rb +1 -2
- data/lib/wda_lib/session.rb +6 -3
- data/lib/wda_lib/version.rb +1 -1
- data/wda_lib.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07987c97d03d838bf2580f5648e565524c82bfc4
|
4
|
+
data.tar.gz: b32511cec615e2e441d0a2a6a30efbf5bbb16132
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a81c08df02ebf498febfd30f9e12b9d1af95e1fd3cd02582e2dc4ceba4559679cc7f6ac60d44eb5d09cc03b7d3e493aee3fe0956df7b6ab1f588b1641f3b13c1
|
7
|
+
data.tar.gz: ec5b3ef0156df7025d6846b97bf1b0d64ae6bd3ad33c89429ed6af446b1422c7c51e269681d8d419983f20c58b99acc304167a0cbca1a1670588e2f9c40e1fc7
|
data/README.md
CHANGED
data/lib/wda_lib/debug.rb
CHANGED
@@ -34,22 +34,20 @@ class WDA
|
|
34
34
|
app = nil
|
35
35
|
homescreen
|
36
36
|
while !app_found && max < 10 do
|
37
|
-
swipe(@win_x*4/5, 10, @win_y/2, @win_y/2)
|
38
37
|
max += 1
|
39
|
-
|
38
|
+
icons(app_name).each do |e|
|
40
39
|
app = e
|
41
40
|
if e.displayed?
|
42
|
-
app_found = true
|
41
|
+
app_found = true
|
43
42
|
break
|
44
43
|
end
|
45
44
|
end
|
45
|
+
break if app_found = true
|
46
|
+
swipe(@win_x*4/5, 10, @win_y/2, @win_y/2)
|
46
47
|
end
|
47
48
|
|
48
|
-
|
49
|
-
|
50
|
-
else
|
51
|
-
app
|
52
|
-
end
|
49
|
+
app.nil?? (fail "Can't find app :#{app_name}") : app
|
50
|
+
|
53
51
|
end
|
54
52
|
|
55
53
|
end
|
data/lib/wda_lib/screenshot.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'base64'
|
2
2
|
|
3
|
-
|
4
3
|
class WDA
|
5
4
|
module Screenshot
|
6
5
|
# Take a screenshot and save to the given path. Format: png.
|
@@ -11,7 +10,7 @@ class WDA
|
|
11
10
|
# @return screenshot result [Hash]
|
12
11
|
def screenshot(path, scale = 100)
|
13
12
|
path.include?('.png')? path : path += '.png'
|
14
|
-
|
13
|
+
response = get(@base_url + '/screenshot?scale=' + scale)
|
15
14
|
begin
|
16
15
|
File.open(path, 'wb') {|f| f.write Base64.decode64(response['value']) }
|
17
16
|
rescue IOError => e
|
data/lib/wda_lib/session.rb
CHANGED
@@ -4,7 +4,7 @@ class WDA
|
|
4
4
|
# Get current status
|
5
5
|
# @return [Obj]
|
6
6
|
def status
|
7
|
-
|
7
|
+
@status = get(@base_url + '/status')
|
8
8
|
@platform_name = @status['value']['os']['name']
|
9
9
|
@platform_version = @status['value']['os']['version']
|
10
10
|
update_status(@status)
|
@@ -37,14 +37,15 @@ class WDA
|
|
37
37
|
# This is not realy needed since we can find and click app icon to start app
|
38
38
|
# @return [self]
|
39
39
|
def launch_app(app_name_or_id)
|
40
|
+
p "Launching app #{app_name_or_id}"
|
40
41
|
fail 'Either app name or bundle id should be given for launch app' if app_name_or_id.nil?
|
41
42
|
if app_name_or_id.include?('.') # Given value is app's bundle id
|
42
43
|
@bundle_id = app_name_or_id
|
43
44
|
@session_id = nil # Prepare to create new session
|
44
45
|
@session_valid = false # Prepare to create new session
|
45
|
-
|
46
|
-
|
46
|
+
post(@base_url + '/session', { desiredCapabilities: { bundleId: app_name_or_id }})
|
47
47
|
## Temporarily disabled
|
48
|
+
# capabilities
|
48
49
|
# @driver = Selenium::WebDriver::Driver.for(:remote, :url => @base_url, :desired_capabilities => @caps[:desiredCapabilities])
|
49
50
|
status
|
50
51
|
else
|
@@ -58,7 +59,9 @@ class WDA
|
|
58
59
|
# @return [self]
|
59
60
|
def restart(app_name_or_id = nil)
|
60
61
|
quit
|
62
|
+
sleep 0.5
|
61
63
|
launch_app(app_name_or_id ||= @bundle_id )
|
64
|
+
sleep 0.5
|
62
65
|
end
|
63
66
|
|
64
67
|
# Exit current app by delete session with given session_id
|
data/lib/wda_lib/version.rb
CHANGED
data/wda_lib.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
s.homepage =
|
19
|
-
'
|
19
|
+
'https://github.com/znly/wda'
|
20
20
|
s.license = 'MIT'
|
21
21
|
|
22
22
|
s.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wda_lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MIN Yi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -108,7 +108,7 @@ files:
|
|
108
108
|
- lib/wda_lib/type.rb
|
109
109
|
- lib/wda_lib/version.rb
|
110
110
|
- wda_lib.gemspec
|
111
|
-
homepage:
|
111
|
+
homepage: https://github.com/znly/wda
|
112
112
|
licenses:
|
113
113
|
- MIT
|
114
114
|
metadata: {}
|