Skip to content

Commit 7519e45

Browse files
authored
add aliases (#145)
1 parent ba9dd3c commit 7519e45

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.
44
## [Unreleased]
55
### Enhancements
66
- Add finger print feature for Android emulators [#13](https://github.com/appium/ruby_lib_core/issues/13)
7+
- Add `keyboard_shown?` and `context=` as aliases of `is_keyboard_shown` and `set_contex`
78

89
### Bug fixes
910

lib/appium_lib_core/common/base/driver.rb

+7-3
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,12 @@ def hide_keyboard(close_key = nil, strategy = nil)
9494
#
9595
# @example
9696
# @driver.is_keyboard_shown # false
97+
# @driver.keyboard_shown? # true
9798
#
98-
def is_keyboard_shown # rubocop:disable Naming/PredicateName
99+
def keyboard_shown?
99100
@bridge.is_keyboard_shown
100101
end
102+
alias is_keyboard_shown keyboard_shown?
101103

102104
# Send keys for a current active element
103105
# @param [String] key Input text
@@ -233,16 +235,18 @@ def available_contexts
233235
# @example
234236
#
235237
# @driver.set_context "NATIVE_APP"
238+
# @driver.context = "NATIVE_APP"
236239
#
237-
def set_context(context = null)
240+
def context=(context = null)
238241
@bridge.set_context(context)
239242
end
243+
alias set_context context=
240244

241245
# Set the value to element directly
242246
#
243247
# @example
244248
#
245-
# set_immediate_value element, 'hello'
249+
# @driver.set_immediate_value element, 'hello'
246250
#
247251
def set_immediate_value(element, *value)
248252
@bridge.set_immediate_value(element, *value)

test/functional/android/android/device_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def test_hidekeyboard
221221

222222
@driver.ime_activate 'com.android.inputmethod.latin/.LatinIME'
223223

224-
assert @driver.is_keyboard_shown
224+
assert @driver.keyboard_shown?
225225

226226
@@core.wait { @driver.hide_keyboard }
227227
sleep 1 # wait animation

test/functional/ios/ios/device_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def test_context_related
119119

120120
assert_equal 'NATIVE_APP', @@driver.current_context
121121

122-
@@driver.set_context contexts.last
122+
@@driver.context = contexts.last
123123
assert_match 'NATIVE_APP', @@driver.current_context
124124

125125
@@driver.switch_to_default_context

0 commit comments

Comments
 (0)