appium_lib_core 1.0.0 → 1.1.0

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: e078b7ab6ce69ac4202cb8bfbf1669a621a1f7c3
4
- data.tar.gz: 9f9ad00010a0ae6204d5aa92c5838ff5abc2b9a3
3
+ metadata.gz: fb8a3502ee734114622e3474545af77b125ec43d
4
+ data.tar.gz: fe71c68a3d9006e06381d5d04219bbbaa777d35b
5
5
  SHA512:
6
- metadata.gz: e128a4e5e56dd1456eee1d3fbc74b2a966254a7cc9bf420b64a70a71122a22913dfb87b843dd6f5c3b88a701ebec8d07e357cd20c5403b026c3dab1e163cbcc9
7
- data.tar.gz: da0230b20ef8544d892f87f1caf2f1c2dd5c959bacf2ee5b99f2a673c7269d1d957608e5912204d476491271c8a480137594793775b9438c5c47d611167f02dd
6
+ metadata.gz: 29224ca9a8bde5e159eb7e9bb0d37c73a73ed595aeb21849a4da3b47bf2f09c50bd2f0906d419b824e32f57c15a43e9bb6ea4a1b0d17799b307987a00f0b816d
7
+ data.tar.gz: 58fc2392b7963aff9b934d746196438889af995f2a902327ded1b79c9e4abf23088fea5ddca7eeb0628ab1a538b6b9b4931686defabe172f6ecf64fc97187e1c
@@ -0,0 +1,23 @@
1
+ # Contributing
2
+
3
+ For features or bug fixes, please submit a pull request. Ideally there would be a test as well. The remainder of this doc details how to run the tests.
4
+
5
+ ## Tests
6
+ ### Unit Tests
7
+ - `rake test:unit` run on Travis automatically
8
+
9
+ ### Functional Tests
10
+ - iOS
11
+ - `rake test:func:ios`
12
+ - Android
13
+ - `rake test:func:android`
14
+
15
+ ## Publishing on rubygems
16
+
17
+ 0. Ensure you have `~/.gem/credentials` If not run [the following command](http://guides.rubygems.org/make-your-own-gem/) (replace username with your rubygems user)
18
+ > $ curl -u username https://rubygems.org/api/v1/api_key.yaml >
19
+ ~/.gem/credentials; chmod 0600 ~/.gem/credentials
20
+
21
+ 1. Bump the version number `thor bump`
22
+ 2. Generate release note, build and publish gem with `thor release`
23
+ 3. Update `changelog.md`
@@ -0,0 +1,20 @@
1
+ ## This is a
2
+ * [ ] Bug report
3
+ * [ ] Question
4
+ * [ ] Feature Request
5
+
6
+ ## Summary
7
+
8
+ ## Environment
9
+ * `ruby_lib_core` version:
10
+ * Mobile platform/version/device under test:
11
+
12
+ ## Actual behaviour and steps to reproduce
13
+
14
+ ## Expected behaviour
15
+
16
+ ## Link to Appium/Ruby logs
17
+
18
+ Create a [GIST](https://gist.github.com) which is a paste of your _full_ Appium logs, and link them here.
19
+
20
+ ## Any additional comments
@@ -3,8 +3,11 @@ All notable changes to this project will be documented in this file.
3
3
 
4
4
  ## [Unreleased]
5
5
  ### Enhancements
6
+ - Add guidelines in `.github`
7
+ - session/:session_id/appium/device/keyevent [#21](https://github.com/appium/ruby_lib_core/issues/21)
6
8
 
7
9
  ### Bug fixes
10
+ - fix creating sessions [#31](https://github.com/appium/ruby_lib_core/pull/31) for W3C creating sessions
8
11
 
9
12
  ### Deprecations
10
13
 
data/Rakefile CHANGED
@@ -63,11 +63,19 @@ end
63
63
 
64
64
  desc("print commands which haven't implemented yet.")
65
65
  namespace :commands do
66
+ require './script/commands'
67
+
66
68
  task :mjsonwp do |_t, _args|
67
- require './script/commands'
68
69
  c = Script::CommandsChecker.new
69
70
  c.get_mjsonwp_routes
70
71
  c.get_all_command_path './mjsonwp_routes.js'
71
72
  c.all_diff_commands_mjsonwp.each { |key, value| puts("command: #{key}, method: #{value}") }
72
73
  end
74
+
75
+ task :w3c do |_t, _args|
76
+ c = Script::CommandsChecker.new
77
+ c.get_mjsonwp_routes
78
+ c.get_all_command_path './mjsonwp_routes.js'
79
+ c.all_diff_commands_w3c.each { |key, value| puts("command: #{key}, method: #{value}") }
80
+ end
73
81
  end
@@ -4,6 +4,8 @@ module Appium
4
4
  module Touch
5
5
  def self.extend_touch_actions
6
6
  ::Appium::Core::TouchAction.class_eval do
7
+ # Visible for testing
8
+ # @private
7
9
  def swipe_coordinates(start_x: 0, start_y: 0, offset_x: 0, offset_y: 0)
8
10
  Appium::Logger.info "extended Appium::Core::Android::Touch, start_x: #{start_x},"\
9
11
  " start_y: #{start_y}, offset_x: #{offset_x}, offset_y: #{offset_y}"
@@ -24,6 +24,19 @@ module Appium
24
24
  raise CoreError, 'cannot understand dialect'
25
25
  end
26
26
  end
27
+
28
+ private
29
+
30
+ # Use capabilities directory because Appium's capability is based on W3C one.
31
+ # Called in bridge.create_session(desired_capabilities)
32
+ def merged_capabilities(desired_capabilities)
33
+ {
34
+ desiredCapabilities: desired_capabilities,
35
+ capabilities: {
36
+ firstMatch: [desired_capabilities]
37
+ }
38
+ }
39
+ end
27
40
  end # class Bridge
28
41
 
29
42
  class CoreBridgeMJSONWP < ::Selenium::WebDriver::Remote::OSS::Bridge
@@ -43,6 +43,8 @@ module Appium
43
43
  hide_keyboard: [:post, 'session/:session_id/appium/device/hide_keyboard'.freeze],
44
44
  press_keycode: [:post, 'session/:session_id/appium/device/press_keycode'.freeze],
45
45
  long_press_keycode: [:post, 'session/:session_id/appium/device/long_press_keycode'.freeze],
46
+ # keyevent is only for Selendroid
47
+ keyevent: [:post, 'session/:session_id/appium/device/keyevent'.freeze],
46
48
  set_immediate_value: [:post, 'session/:session_id/appium/element/:id/value'.freeze],
47
49
  replace_value: [:post, 'session/:session_id/appium/element/:id/replace_value'.freeze],
48
50
  push_file: [:post, 'session/:session_id/appium/device/push_file'.freeze],
@@ -61,6 +61,14 @@ module Appium
61
61
  # @driver.launch_app
62
62
  #
63
63
 
64
+ # @!method close_app
65
+ # Close an app on device
66
+ #
67
+ # @example
68
+ #
69
+ # @driver.close_app
70
+ #
71
+
64
72
  # @!method reset
65
73
  # Reset the device, relaunching the application.
66
74
  #
@@ -85,6 +93,14 @@ module Appium
85
93
  # @driver.toggle_flight_mode
86
94
  #
87
95
 
96
+ # @!method unlock
97
+ # Unlock the device
98
+ #
99
+ # @example
100
+ #
101
+ # @driver.unlock
102
+ #
103
+
88
104
  # @!method device_locked?
89
105
  # Check current device status is weather locked or not
90
106
  #
@@ -97,10 +113,52 @@ module Appium
97
113
  # Get the device network connection current status
98
114
  # See set_network_connection method for return value
99
115
 
116
+ # @!method open_notifications
117
+ # Open Android notifications
118
+ #
119
+ # @example
120
+ #
121
+ # @driver.open_notifications
122
+ #
123
+
124
+ # @!method device_time
125
+ # Get the time on the device
126
+ # @return [String]
127
+ #
128
+ # @example
129
+ #
130
+ # @driver.device_time
131
+ #
132
+
100
133
  ####
101
134
  ## With arguments
102
135
  ####
103
136
 
137
+ # @!method install_app(path)
138
+ # Install the given app onto the device
139
+ #
140
+ # @example
141
+ #
142
+ # @driver.install_app("/path/to/test.apk")
143
+ #
144
+
145
+ # @!method remove_app(app_id)
146
+ # Install the given app onto the device
147
+ #
148
+ # @example
149
+ #
150
+ # @driver.remove_app("io.appium.bundle")
151
+ #
152
+
153
+ # @!method app_installed?(app_id)
154
+ # Check whether the specified app is installed on the device
155
+ # @return [bool]
156
+ #
157
+ # @example
158
+ #
159
+ # @driver.app_installed?("io.appium.bundle")
160
+ #
161
+
104
162
  # @!method app_strings(language = nil)
105
163
  # Return the hash of all localization strings.
106
164
  # @return [Hash]
@@ -138,6 +196,17 @@ module Appium
138
196
  # @driver.hide_keyboard(nil, :tapOutside) # Close a keyboard with tapping out side of keyboard
139
197
  #
140
198
 
199
+ # @!method keyevent(key, metastate = nil)
200
+ # Send keyevent on the device.(Only for Selendroid)
201
+ # http://developer.android.com/reference/android/view/KeyEvent.html
202
+ # @param [integer] key The key to press.
203
+ # @param [String] metastate The state the metakeys should be in when pressing the key.
204
+ #
205
+ # @example
206
+ #
207
+ # @driver.keyevent 82
208
+ #
209
+
141
210
  # @!method press_keycode(key, metastate = nil)
142
211
  # Press keycode on the device.
143
212
  # http://developer.android.com/reference/android/view/KeyEvent.html
@@ -167,7 +236,7 @@ module Appium
167
236
  #
168
237
  # @example
169
238
  #
170
- # @driver.push_file "/file/to/path", data
239
+ # @driver.push_file "/file/to/path", "data"
171
240
  #
172
241
 
173
242
  # @!method pull_file(path)
@@ -318,13 +387,6 @@ module Appium
318
387
  add_endpoint_method method
319
388
  end
320
389
 
321
- # call http://www.rubydoc.info/gems/selenium-webdriver/Selenium/WebDriver/DriverExtensions/HasRemoteStatus#remote_status-instance_method
322
- add_endpoint_method(:remote_status) do
323
- def remote_status
324
- execute(:status, {}) || []
325
- end
326
- end
327
-
328
390
  # Don't define selenium-side methods. We pick up from them.
329
391
  # ::Appium::Core::Base::Commands::MJSONWP.each_key do |method|
330
392
  # add_endpoint_method method
@@ -345,8 +407,9 @@ module Appium
345
407
  end
346
408
 
347
409
  add_endpoint_method(:lock) do
348
- def lock(duration)
349
- execute :lock, {}, seconds: duration
410
+ def lock(duration = nil)
411
+ opts = duration ? { seconds: duration } : {}
412
+ execute :lock, {}, opts
350
413
  end
351
414
  end
352
415
 
@@ -391,22 +454,6 @@ module Appium
391
454
  end
392
455
  end
393
456
 
394
- add_endpoint_method(:press_keycode) do
395
- def press_keycode(key, metastate = nil)
396
- args = { keycode: key }
397
- args[:metastate] = metastate if metastate
398
- execute :press_keycode, {}, args
399
- end
400
- end
401
-
402
- add_endpoint_method(:long_press_keycode) do
403
- def long_press_keycode(key, metastate = nil)
404
- args = { keycode: key }
405
- args[:metastate] = metastate if metastate
406
- execute :long_press_keycode, {}, args
407
- end
408
- end
409
-
410
457
  add_endpoint_method(:set_immediate_value) do
411
458
  def set_immediate_value(element, *value)
412
459
  keys = ::Selenium::WebDriver::Keys.encode(value)
@@ -454,6 +501,7 @@ module Appium
454
501
  end
455
502
  end
456
503
 
504
+ add_keyevent
457
505
  add_touch_actions
458
506
  add_ime_actions
459
507
  add_handling_context
@@ -498,6 +546,33 @@ module Appium
498
546
  end
499
547
  end
500
548
 
549
+ def add_keyevent
550
+ # Only for Selendroid
551
+ add_endpoint_method(:keyevent) do
552
+ def keyevent(key, metastate = nil)
553
+ args = { keycode: key }
554
+ args[:metastate] = metastate if metastate
555
+ execute :keyevent, {}, args
556
+ end
557
+ end
558
+
559
+ add_endpoint_method(:press_keycode) do
560
+ def press_keycode(key, metastate = nil)
561
+ args = { keycode: key }
562
+ args[:metastate] = metastate if metastate
563
+ execute :press_keycode, {}, args
564
+ end
565
+ end
566
+
567
+ add_endpoint_method(:long_press_keycode) do
568
+ def long_press_keycode(key, metastate = nil)
569
+ args = { keycode: key }
570
+ args[:metastate] = metastate if metastate
571
+ execute :long_press_keycode, {}, args
572
+ end
573
+ end
574
+ end
575
+
501
576
  def add_touch_actions
502
577
  add_endpoint_method(:touch_actions) do
503
578
  def touch_actions(actions)
@@ -4,6 +4,8 @@ module Appium
4
4
  module Touch
5
5
  def self.extend_touch_actions
6
6
  ::Appium::Core::TouchAction.class_eval do
7
+ # Visible for testing
8
+ # @private
7
9
  def swipe_coordinates(start_x: 0, start_y: 0, offset_x: 0, offset_y: 0)
8
10
  Appium::Logger.info "extended Appium::Core::Ios::Touch, start_x: #{start_x},"\
9
11
  " start_y: #{start_y}, offset_x: #{offset_x}, offset_y: #{offset_y}"
@@ -1,6 +1,6 @@
1
1
  module Appium
2
2
  module Core
3
- VERSION = '1.0.0'.freeze unless defined? ::Appium::Core::VERSION
4
- DATE = '2017-11-12'.freeze unless defined? ::Appium::Core::DATE
3
+ VERSION = '1.1.0'.freeze unless defined? ::Appium::Core::VERSION
4
+ DATE = '2017-12-16'.freeze unless defined? ::Appium::Core::DATE
5
5
  end
6
6
  end
@@ -1,3 +1,17 @@
1
+ #### v1.1.0 2017-12-16
2
+
3
+ - [29b36af](https://github.com/appium/ruby_lib_core/commit/29b36af7af280308f7cfc2ee7ffa1738085e0306) Release 1.1.0
4
+ - [f7eefc3](https://github.com/appium/ruby_lib_core/commit/f7eefc376f0d00fb9bc3e8324c652544cb363a9b) fix creating sessions (#31)
5
+ - [08c826f](https://github.com/appium/ruby_lib_core/commit/08c826f78ce861e8bd35b7bced54c9bd91d2fabc) for test code: add taking screens if tests failed (#30)
6
+ - [f14c924](https://github.com/appium/ruby_lib_core/commit/f14c92435388e16598921685963cc7879eb7ba3a) insert @private
7
+ - [5eb125a](https://github.com/appium/ruby_lib_core/commit/5eb125a06e3bc5dfd59a749183d6ff46fd9c5a28) make setting tests robust
8
+ - [8bc97ce](https://github.com/appium/ruby_lib_core/commit/8bc97ce1258da79975fc347dc02dfdb14d06a8df) update comments for some commands (#29)
9
+ - [7de2e89](https://github.com/appium/ruby_lib_core/commit/7de2e89349c5dce775e91c15e0c8a5486b8cbc5e) Remove duplicated remote status (#28)
10
+ - [fcb64b7](https://github.com/appium/ruby_lib_core/commit/fcb64b7992c17d21b82b34cfd714d5dc150ae9a5) add keyevent (#27)
11
+ - [a54b315](https://github.com/appium/ruby_lib_core/commit/a54b315155ee68b79d6051046b7f7899d7d0dda9) add some guidelines
12
+ - [65d00cb](https://github.com/appium/ruby_lib_core/commit/65d00cb14bfbf6a3bdc3eded05d69037a3c06645) add a rake task for w3c
13
+
14
+
1
15
  #### v1.0.0 2017-11-12
2
16
 
3
17
  - [de176fe](https://github.com/appium/ruby_lib_core/commit/de176fe2fbcfaa341392e7f37ee537158ed2e23e) Release 1.0.0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appium_lib_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuaki MATSUO
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-12 00:00:00.000000000 Z
11
+ date: 2017-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -183,6 +183,8 @@ executables: []
183
183
  extensions: []
184
184
  extra_rdoc_files: []
185
185
  files:
186
+ - ".github/contributing.md"
187
+ - ".github/issue_template.md"
186
188
  - ".gitignore"
187
189
  - ".rubocop.yml"
188
190
  - ".travis.yml"