Skip to content

Commit 9b9f186

Browse files
authored
chore: remove ios uiautomation (#436)
* feat: drop iOS/uiautomation as no longer work with recent iOS versions * update changelog * remove uiautomation stuff
1 parent 5bfb3b8 commit 9b9f186

File tree

11 files changed

+10
-176
lines changed

11 files changed

+10
-176
lines changed

CHANGELOG.md

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

1111
### Deprecations
12+
- Remove iOS/UiAutomation classes
13+
- The version may work for iOS 8. XCUITest driver will be the default behavior for iOS.
1214

1315
## [5.8.0] - 2022-12-11
1416

lib/appium_lib_core/common/base/search_context.rb

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ module SearchContext
2828
data_matcher: '-android datamatcher', # Available in Espresso
2929
view_matcher: '-android viewmatcher', # Available in Espresso
3030
# iOS
31-
uiautomation: '-ios uiautomation',
3231
predicate: '-ios predicate string',
3332
class_chain: '-ios class chain',
3433
# Windows with windows prefix

lib/appium_lib_core/driver.rb

+1-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ module Android
2323
end
2424

2525
module Ios
26-
autoload :Uiautomation, 'appium_lib_core/ios'
2726
autoload :Xcuitest, 'appium_lib_core/ios_xcuitest'
2827
end
2928

@@ -605,10 +604,8 @@ def extend_for(device:, automation_name:) # rubocop:disable Metrics/CyclomaticCo
605604
case sym_automation_name
606605
when :safari
607606
::Appium::Logger.debug('SafariDriver for iOS')
608-
when :xcuitest
607+
else # XCUITest
609608
::Appium::Core::Ios::Xcuitest::Bridge.for self
610-
else # default and UIAutomation
611-
::Appium::Core::Ios::Uiautomation::Bridge.for self
612609
end
613610
when :mac
614611
case sym_automation_name

lib/appium_lib_core/ios.rb

-20
This file was deleted.

lib/appium_lib_core/ios/uiautomation/bridge.rb

-30
This file was deleted.

lib/appium_lib_core/ios/uiautomation/device.rb

-44
This file was deleted.

lib/appium_lib_core/ios/uiautomation/patch.rb

-34
This file was deleted.

test/functional/ios/ios/device_test.rb

+3-9
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,9 @@ def test_settings
204204

205205
# @deprecated Appium::Core::TouchAction
206206
def test_touch_actions
207-
if @@core.automation_name == :xcuitest
208-
element = @@core.wait { @@driver.find_element :accessibility_id, ACTIVITY_INDICATORS }
209-
210-
@@driver.execute_script('mobile: tap', x: 0, y: 0, element: element.id)
211-
else
212-
Appium::Core::TouchAction.new(@@driver)
213-
.press(element: @@driver.find_element(:accessibility_id, ACTIVITY_INDICATORS))
214-
.perform
215-
end
207+
element = @@core.wait { @@driver.find_element :accessibility_id, ACTIVITY_INDICATORS }
208+
209+
@@driver.execute_script('mobile: tap', x: 0, y: 0, element: element.id)
216210

217211
@@driver.back
218212
end

test/functional/ios/ios/search_context_test.rb

-11
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,12 @@ def teardown
2828
save_reports(@@driver)
2929
end
3030

31-
def test_uiautomation
32-
if @@core.automation_name == :xcuitest
33-
assert true
34-
else
35-
e = @@driver.find_element :predicate, 'wdName == "Buttons"'
36-
assert !e.name.nil?
37-
end
38-
end
39-
4031
def test_predicate
4132
e = @@driver.find_element :predicate, 'wdName == "Buttons"'
4233
assert_equal 'Buttons', e.name
4334
end
4435

4536
def test_class_chain
46-
skip 'Only for XCUITest' unless @@core.automation_name == :xcuitest
47-
4837
e = @@driver.find_element :class_chain, "**/XCUIElementTypeWindow[$name == 'Buttons'$]"
4938
assert_equal 'XCUIElementTypeWindow', e.tag_name
5039
end

test/unit/driver_test.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ def _android_mock_create_session_w3c_with_custom_http_client(core)
460460

461461
# https://www.w3.org/TR/webdriver1/
462462
def test_search_context_in_element_class
463-
assert_equal 23, ::Appium::Core::Element::FINDERS.length
463+
assert_equal 22, ::Appium::Core::Element::FINDERS.length
464464
assert_equal({ class: 'class name',
465465
class_name: 'class name',
466466
css: 'css selector', # Defined in W3C spec
@@ -479,7 +479,6 @@ def test_search_context_in_element_class
479479
viewtag: '-android viewtag',
480480
data_matcher: '-android datamatcher',
481481
view_matcher: '-android viewmatcher',
482-
uiautomation: '-ios uiautomation',
483482
predicate: '-ios predicate string',
484483
class_chain: '-ios class chain',
485484
windows_uiautomation: '-windows uiautomation',

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

+3-21
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ def test_toggle_touch_id_enrollment
4747
end
4848

4949
def test_start_recording_screen
50-
skip 'Only XCUITest supports' unless @core.automation_name == :xcuitest
51-
5250
stub_request(:post, "#{SESSION}/appium/start_recording_screen")
5351
.with(body: { options: { videoType: 'mjpeg', timeLimit: '180' } }.to_json)
5452
.to_return(headers: HEADER, status: 200, body: { value: ['a'] }.to_json)
@@ -59,8 +57,6 @@ def test_start_recording_screen
5957
end
6058

6159
def test_start_recording_screen_custom
62-
skip 'Only XCUITest supports' unless @core.automation_name == :xcuitest
63-
6460
stub_request(:post, "#{SESSION}/appium/start_recording_screen")
6561
.with(body: { options: {
6662
videoType: 'libx264', timeLimit: '60',
@@ -76,8 +72,6 @@ def test_start_recording_screen_custom
7672
end
7773

7874
def test_stop_recording_screen_default
79-
skip 'Only XCUITest supports' unless @core.automation_name == :xcuitest
80-
8175
stub_request(:post, "#{SESSION}/appium/stop_recording_screen")
8276
.with(body: {}.to_json)
8377
.to_return(headers: HEADER, status: 200, body: { value: ['a'] }.to_json)
@@ -88,8 +82,6 @@ def test_stop_recording_screen_default
8882
end
8983

9084
def test_stop_recording_screen_custom
91-
skip 'Only XCUITest supports' unless @core.automation_name == :xcuitest
92-
9385
stub_request(:post, "#{SESSION}/appium/stop_recording_screen")
9486
.with(body: { options:
9587
{ remotePath: 'https://example.com', user: 'user name', pass: 'pass', method: 'PUT' } }.to_json)
@@ -101,8 +93,6 @@ def test_stop_recording_screen_custom
10193
end
10294

10395
def test_start_recording_screen_additional_options
104-
skip 'Only XCUITest supports' unless @core.automation_name == :xcuitest
105-
10696
stub_request(:post, "#{SESSION}/appium/start_recording_screen")
10797
.with(body: { options: {
10898
remotePath: 'https://example.com', method: 'PUT',
@@ -121,8 +111,6 @@ def test_start_recording_screen_additional_options
121111
end
122112

123113
def test_get_battery_info
124-
skip 'Only XCUITest supports' unless @core.automation_name == :xcuitest
125-
126114
stub_request(:post, "#{SESSION}/execute/sync")
127115
.with(body: { script: 'mobile: batteryInfo', args: [{}] }.to_json)
128116
.to_return(headers: HEADER, status: 200, body: { value: { state: 1, level: 0.5 } }.to_json)
@@ -145,15 +133,9 @@ def test_method_missing
145133
end
146134

147135
def test_background_app
148-
if @core.automation_name == :xcuitest
149-
stub_request(:post, "#{SESSION}/appium/app/background")
150-
.with(body: { seconds: { timeout: 0 } }.to_json)
151-
.to_return(headers: HEADER, status: 200, body: { value: '' }.to_json)
152-
else
153-
stub_request(:post, "#{SESSION}/appium/app/background")
154-
.with(body: { seconds: 0 }.to_json)
155-
.to_return(headers: HEADER, status: 200, body: { value: '' }.to_json)
156-
end
136+
stub_request(:post, "#{SESSION}/appium/app/background")
137+
.with(body: { seconds: { timeout: 0 } }.to_json)
138+
.to_return(headers: HEADER, status: 200, body: { value: '' }.to_json)
157139

158140
@driver.background_app 0
159141

0 commit comments

Comments
 (0)