Skip to content

Commit 1cbafc1

Browse files
authored
test: tweak tests (#508)
1 parent 163b360 commit 1cbafc1

File tree

4 files changed

+3
-61
lines changed

4 files changed

+3
-61
lines changed

lib/appium_lib_core/common/base/driver.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ def available_contexts
472472
# @driver.set_context "NATIVE_APP"
473473
# @driver.context = "NATIVE_APP"
474474
#
475-
def context=(context = null)
475+
def context=(context = nil)
476476
@bridge.set_context(context)
477477
end
478478
alias set_context context=

lib/appium_lib_core/common/device/context.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def available_contexts
4242
execute(:available_contexts, {}) || []
4343
end
4444

45-
def set_context(context = null)
45+
def set_context(context = nil)
4646
execute :set_context, {}, name: context
4747
end
4848
end # module ImeActions

test/functional/android/android/device_test.rb

-57
Original file line numberDiff line numberDiff line change
@@ -48,27 +48,6 @@ def test_shake
4848
assert @driver.shake
4949
end
5050

51-
def test_close_and_launch_app
52-
if @@core.automation_name == :espresso
53-
assert_raises ::Selenium::WebDriver::Error::UnsupportedOperationError do
54-
@driver.close_app
55-
end
56-
else
57-
@driver.close_app
58-
assert(@driver.wait_until { |d| d.app_state('io.appium.android.apis') != :running_in_foreground })
59-
end
60-
61-
if @@core.automation_name == :espresso
62-
assert_raises ::Selenium::WebDriver::Error::UnsupportedOperationError do
63-
@driver.launch_app
64-
end
65-
else
66-
@driver.launch_app
67-
e = @driver.wait_until { |d| d.find_element :accessibility_id, 'App' }
68-
assert_equal 'App', e.text
69-
end
70-
end
71-
7251
def test_lock_unlock
7352
@driver.lock
7453
assert @driver.device_locked?
@@ -202,42 +181,6 @@ def test_touch_actions
202181
@driver.back
203182
end
204183

205-
# @deprecated Appium::Core::TouchAction
206-
def test_swipe
207-
@driver.wait_until { |d| d.find_element :accessibility_id, 'App' }.click
208-
209-
el = @driver.wait_until { |d| d.find_element :accessibility_id, 'Fragment' }
210-
rect = el.rect
211-
212-
Appium::Core::TouchAction.new(@driver)
213-
.swipe(start_x: 75, start_y: 500, end_x: 75, end_y: 500, duration: 500)
214-
.perform
215-
@driver.back # The above command become "tap" action since it doesn't move.
216-
el = @driver.wait_until { |d| d.find_element :accessibility_id, 'Fragment' }
217-
assert rect.x == el.rect.x
218-
assert rect.y == el.rect.y
219-
220-
touch_action = Appium::Core::TouchAction.new(@driver)
221-
.swipe(start_x: 75, start_y: 500, end_x: 75, end_y: 300, duration: 500)
222-
223-
assert_equal :press, touch_action.actions[0][:action]
224-
assert_equal({ x: 75, y: 500 }, touch_action.actions[0][:options])
225-
226-
assert_equal :wait, touch_action.actions[1][:action]
227-
assert_equal({ ms: 500 }, touch_action.actions[1][:options])
228-
229-
assert_equal :moveTo, touch_action.actions[2][:action]
230-
assert_equal({ x: 75, y: 300 }, touch_action.actions[2][:options])
231-
232-
assert_equal :release, touch_action.actions[3][:action]
233-
234-
touch_action.perform
235-
assert_equal [], touch_action.actions
236-
237-
assert rect.x == el.rect.x
238-
assert rect.y > el.rect.y
239-
end
240-
241184
def test_hidekeyboard
242185
@driver.wait_until { |d| d.find_element :accessibility_id, 'App' }.click
243186
@driver.wait_until { |d| d.find_element :accessibility_id, 'Activity' }.click

test/functional/ios/driver_test.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ def test_click_back
109109
def test_default_keyboard_pref
110110
skip_as_appium_version '1.15.0'
111111

112-
bundle_id = @@driver.session_capabilities['CFBundleIdentifier']
113112
begin
114113
@@driver.terminate_app('com.apple.Preferences') # To ensure the app shows the top view
115114
@@driver.activate_app('com.apple.Preferences')
@@ -128,7 +127,7 @@ def test_default_keyboard_pref
128127
assert_equal '0', auto_correction.value
129128
assert_equal '0', predictive.value
130129
ensure
131-
@@driver.activate_app(bundle_id)
130+
@@driver.activate_app('com.example.apple-samplecode.UICatalog')
132131
end
133132
end
134133

0 commit comments

Comments
 (0)