Skip to content

Commit a6d6be1

Browse files
authored
feat: remove deprecated methods (#529)
* feat: remove deprecated immediate_value * feat: remove deprecated replace_value * remove bad reference * add changelog * feat: remove end_coverage * update changelog
1 parent c7248db commit a6d6be1

File tree

16 files changed

+8
-225
lines changed

16 files changed

+8
-225
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ Read `release_notes.md` for commit level details.
99
### Bug fixes
1010

1111
### Deprecations
12+
- Removed deprecated methods
13+
- `launch_app`, `close_app` and `reset`
14+
- Please use `activate_app`, `terminate_app`, or launch/activate/terminate commands by `mobile:` command
15+
- `TouchActions`, `MultiActions`
16+
- Please refer to W3C WebDriver actions
17+
- https://www.rubydoc.info/gems/appium_lib_core/Appium/Core/Base/Bridge#action-instance_method
18+
- `immediate_value` and `replace_value`
19+
- `end_coverage`
1220

1321
## [7.5.0] - 2024-02-21
1422
- Remove upper limitation in `selenium-webdriver`

lib/appium_lib_core/android/device.rb

-15
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,6 @@ module Device
188188
# @driver.hide_keyboard(nil, :tapOutside) # Close a keyboard with tapping out side of keyboard
189189
#
190190

191-
# @deprecated The method no longer exists. This method will be removed.
192-
# @!method end_coverage(path, intent)
193-
# Android only; Ends the test coverage and writes the results to the given path on device.
194-
# @param [String] path Path on the device to write too.
195-
# @param [String] intent Intent to broadcast when ending coverage.
196-
#
197-
198191
# @deprecated Use 'mobile: startActivity' extension instead.
199192
# @!method start_activity(opts)
200193
# Android only. Start a new activity within the current app or launch a new app and start the target activity.
@@ -481,14 +474,6 @@ def background_app(duration = 0)
481474
end
482475
end
483476

484-
# TODO: TEST ME
485-
::Appium::Core::Device.add_endpoint_method(:end_coverage) do
486-
def end_coverage(path, intent)
487-
::Appium::Logger.warn '[DEPRECATION] The method no longer exists. This method will be removed.'
488-
execute :end_coverage, {}, path: path, intent: intent
489-
end
490-
end
491-
492477
::Appium::Core::Device.add_endpoint_method(:execute_cdp) do
493478
# SeleniumWebdriver could already define this method
494479
return if method_defined? :execute_cdp

lib/appium_lib_core/common/base.rb

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
require_relative 'device/ime_actions'
1818
require_relative 'device/setting'
1919
require_relative 'device/context'
20-
require_relative 'device/value'
2120
require_relative 'device/file_management'
2221
require_relative 'device/keyevent'
2322
require_relative 'device/image_comparison'

lib/appium_lib_core/common/base/bridge.rb

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ class Bridge < ::Selenium::WebDriver::Remote::Bridge
2121
include Device::ImeActions
2222
include Device::Setting
2323
include Device::Context
24-
include Device::Value
2524
include Device::FileManagement
2625
include Device::KeyEvent
2726
include Device::ImageComparison

lib/appium_lib_core/common/command.rb

-5
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,6 @@ module Commands
189189
set_context: [:post, 'session/:session_id/context'],
190190
current_context: [:get, 'session/:session_id/context'],
191191

192-
# TODO: remove
193-
set_immediate_value: [:post, 'session/:session_id/appium/element/:id/value'],
194-
replace_value: [:post, 'session/:session_id/appium/element/:id/replace_value'],
195-
196192
background_app: [:post, 'session/:session_id/appium/app/background'],
197193
app_strings: [:post, 'session/:session_id/appium/app/strings'],
198194

@@ -238,7 +234,6 @@ module Commands
238234
toggle_wifi: [:post, 'session/:session_id/appium/device/toggle_wifi'],
239235
toggle_data: [:post, 'session/:session_id/appium/device/toggle_data'],
240236
toggle_location_services: [:post, 'session/:session_id/appium/device/toggle_location_services'],
241-
end_coverage: [:post, 'session/:session_id/appium/app/end_test_coverage'],
242237
get_performance_data_types: [:post, 'session/:session_id/appium/performanceData/types'],
243238
get_performance_data: [:post, 'session/:session_id/appium/getPerformanceData'],
244239
get_network_connection: [:get, 'session/:session_id/network_connection'], # defined also in OSS

lib/appium_lib_core/common/device/value.rb

-50
This file was deleted.

lib/appium_lib_core/device.rb

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def extended(_mod)
3030
:ime_activate, :ime_available_engines, :ime_active_engine, :ime_activated, :ime_deactivate,
3131
:get_settings, :update_settings,
3232
:within_context, :switch_to_default_context, :current_context, :available_contexts, :set_context,
33-
:set_immediate_value, :replace_value,
3433
:push_file, :pull_file, :pull_folder,
3534
:keyevent, :press_keycode, :long_press_keycode,
3635
:match_images_features, :find_image_occurrence, :get_images_similarity, :compare_images,

lib/appium_lib_core/element.rb

-29
Original file line numberDiff line numberDiff line change
@@ -64,35 +64,6 @@ def respond_to_missing?(*)
6464
# Alias for type
6565
alias type send_keys
6666

67-
# @deprecated Use element send_keys instead.
68-
# Set the value to element directly
69-
#
70-
# @example
71-
#
72-
# element.immediate_value 'hello'
73-
#
74-
def immediate_value(*value)
75-
::Appium::Logger.warn(
76-
'[DEPRECATION] element.immediate_value is deprecated. Please use element.send_keys instead.'
77-
)
78-
@bridge.set_immediate_value @id, *value
79-
end
80-
81-
# @deprecated Use element send_keys or 'mobile: replaceElementValue' for UIAutomator2 instead.
82-
# Replace the value to element directly
83-
#
84-
# @example
85-
#
86-
# element.replace_value 'hello'
87-
#
88-
def replace_value(*value)
89-
::Appium::Logger.warn(
90-
'[DEPRECATION] element.replace_value is deprecated. Please use element.send_keys instead, ' \
91-
'or "mobile: replaceElementValue" for UIAutomator2.'
92-
)
93-
@bridge.replace_value @id, *value
94-
end
95-
9667
# For use with location_rel.
9768
#
9869
# @return [::Selenium::WebDriver::Point] the relative x, y in a struct. ex: { x: 0.50, y: 0.20 }

test/functional/android/webdriver/device_test.rb

-16
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,6 @@ def test_remote_status
3939
assert !status['build']['version'].nil?
4040
end
4141

42-
def test_set_immediate_value_and_replace_value
43-
@@core.wait { @driver.find_element :accessibility_id, 'App' }.click
44-
@@core.wait { @driver.find_element :accessibility_id, 'Activity' }.click
45-
@@core.wait { @driver.find_element :accessibility_id, 'Custom Title' }.click
46-
47-
e = @@core.wait { @driver.find_element :id, 'io.appium.android.apis:id/left_text_edit' }
48-
e.immediate_value 'hello'
49-
50-
text = @@core.wait { @driver.find_element :id, 'io.appium.android.apis:id/left_text_edit' }
51-
assert_equal 'Left is besthello', text.text
52-
53-
text.replace_value %w(テスト hello)
54-
replaced_text = @@core.wait { @driver.find_element :id, 'io.appium.android.apis:id/left_text_edit' }
55-
assert_equal '44OG44K544OIaGVsbG/ugIA=', Base64.strict_encode64(replaced_text.text)
56-
end
57-
5842
def test_page_source
5943
require 'rexml/document'
6044

test/functional/ios/patch_test.rb

-14
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,6 @@ def test_location_rel
6767
assert_equal '411.0 / 896.0', location.y
6868
end
6969
end
70-
71-
def test_immediate_value
72-
w3c_scroll @@driver
73-
74-
@@core.wait { @@driver.find_element :accessibility_id, 'Text Fields' }.click
75-
76-
text = @@core.wait { @@driver.find_element :class, 'XCUIElementTypeTextField' }
77-
text.immediate_value 'hello'
78-
79-
text = @@core.wait { @@driver.find_element :predicate, 'value == "hello"' }
80-
assert_equal 'hello', text.value
81-
82-
@@driver.back
83-
end
8470
end
8571
end
8672
# rubocop:enable Style/ClassVars

test/functional/ios/webdriver/device_test.rb

-18
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,6 @@ def test_remote_status
5151
assert !status['build']['version'].nil?
5252
end
5353

54-
# TODO: replave_value
55-
56-
def test_set_immediate_value
57-
w3c_scroll @@driver
58-
59-
@@core.wait { @@driver.find_element :accessibility_id, 'Text Fields' }.click
60-
61-
e = @@core.wait { @@driver.find_element :predicate, 'value == "Placeholder text"' }
62-
e.click
63-
e.immediate_value 'hello'
64-
65-
# Using predicate case
66-
e = @@core.wait { @@driver.find_element :predicate, by_predicate('hello') }
67-
assert_equal 'hello', e.value
68-
69-
@@driver.back
70-
end
71-
7254
def by_predicate(value)
7355
%(name ==[c] "#{value}" || label ==[c] "#{value}" || value ==[c] "#{value}")
7456
end

test/unit/android/device/w3c/app_management_test.rb

-9
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,6 @@ def test_background_app
4747
assert_requested(:post, "#{SESSION}/appium/app/background", times: 1)
4848
end
4949

50-
def test_end_coverage
51-
stub_request(:post, "#{SESSION}/appium/app/end_test_coverage")
52-
.to_return(headers: HEADER, status: 200, body: { value: '' }.to_json)
53-
54-
@driver.end_coverage 'path/to', 'intent'
55-
56-
assert_requested(:post, "#{SESSION}/appium/app/end_test_coverage", times: 1)
57-
end
58-
5950
def test_terminate_app
6051
stub_request(:post, "#{SESSION}/appium/device/terminate_app")
6152
.to_return(headers: HEADER, status: 200, body: { value: true }.to_json)

test/unit/android/device/w3c/definition_test.rb

-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ def test_with_arg_definitions
7979
:get_settings,
8080
:update_settings,
8181
:start_activity,
82-
:end_coverage,
8382
:set_network_connection,
8483
:get_performance_data,
8584
:get_clipboard,

test/unit/android/device/w3c/keyboard_test.rb

-42
Original file line numberDiff line numberDiff line change
@@ -122,48 +122,6 @@ def test_long_press_keycode_with_flags_with_wrong_metastate
122122
@driver.long_press_keycode 86, metastate: 0x02
123123
end
124124
end
125-
126-
## Immediate value
127-
def test_immediate_value
128-
stub_request(:post, "#{SESSION}/appium/element/id/value")
129-
.with(body: { text: 'abc' }.to_json)
130-
.to_return(headers: HEADER, status: 200, body: { value: '' }.to_json)
131-
132-
::Appium::Core::Element.new(@driver.send(:bridge), 'id').immediate_value %w(a b c)
133-
134-
assert_requested(:post, "#{SESSION}/appium/element/id/value", times: 1)
135-
end
136-
137-
def test_replace_value
138-
stub_request(:post, "#{SESSION}/appium/element/id/replace_value")
139-
.with(body: { text: 'abc' }.to_json)
140-
.to_return(headers: HEADER, status: 200, body: { value: '' }.to_json)
141-
142-
::Appium::Core::Element.new(@driver.send(:bridge), 'id').replace_value %w(a b c)
143-
144-
assert_requested(:post, "#{SESSION}/appium/element/id/replace_value", times: 1)
145-
end
146-
147-
## Immediate value
148-
def test_immediate_value_text
149-
stub_request(:post, "#{SESSION}/appium/element/id/value")
150-
.with(body: { text: 'abcテスト' }.to_json)
151-
.to_return(headers: HEADER, status: 200, body: { value: '' }.to_json)
152-
153-
::Appium::Core::Element.new(@driver.send(:bridge), 'id').immediate_value 'abcテスト'
154-
155-
assert_requested(:post, "#{SESSION}/appium/element/id/value", times: 1)
156-
end
157-
158-
def test_replace_value_text
159-
stub_request(:post, "#{SESSION}/appium/element/id/replace_value")
160-
.with(body: { text: 'abcテスト' }.to_json)
161-
.to_return(headers: HEADER, status: 200, body: { value: '' }.to_json)
162-
163-
::Appium::Core::Element.new(@driver.send(:bridge), 'id').replace_value 'abcテスト'
164-
165-
assert_requested(:post, "#{SESSION}/appium/element/id/replace_value", times: 1)
166-
end
167125
end # class CommandsTest
168126
end # module W3C
169127
end # module Device

test/unit/common/element_test.rb

-22
Original file line numberDiff line numberDiff line change
@@ -54,28 +54,6 @@ def test_location_rel
5454
assert_equal '110.0 / 667.0', location.y
5555
end
5656

57-
def test_immediate_value
58-
stub_request(:post, "#{SESSION}/appium/element/id/value")
59-
.with(body: { text: 'hello' }.to_json)
60-
.to_return(headers: HEADER, status: 200, body: { value: '' }.to_json)
61-
62-
e = ::Appium::Core::Element.new(@driver.send(:bridge), 'id')
63-
e.immediate_value 'hello'
64-
65-
assert_requested(:post, "#{SESSION}/appium/element/id/value", times: 1)
66-
end
67-
68-
def test_replace
69-
stub_request(:post, "#{SESSION}/appium/element/id/replace_value")
70-
.with(body: { text: 'hello' }.to_json)
71-
.to_return(headers: HEADER, status: 200, body: { value: '' }.to_json)
72-
73-
e = ::Appium::Core::Element.new(@driver.send(:bridge), 'id')
74-
e.replace_value 'hello'
75-
76-
assert_requested(:post, "#{SESSION}/appium/element/id/replace_value", times: 1)
77-
end
78-
7957
def test_element_screenshot_as
8058
stub_request(:get, "#{SESSION}/element/id/screenshot")
8159
.to_return(headers: HEADER, status: 200,

test/unit/ios/device/w3c/definition_test.rb

-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ def test_with_arg_definitions
6868
:keyevent,
6969
:press_keycode,
7070
:long_press_keycode,
71-
:set_immediate_value,
7271
:push_file,
7372
:pull_file,
7473
:pull_folder,

0 commit comments

Comments
 (0)