Skip to content

Commit 9290d72

Browse files
committed
test: update for ios 26
1 parent 7e7166f commit 9290d72

5 files changed

Lines changed: 39 additions & 19 deletions

File tree

test/functional/common_w3c_actions.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
# limitations under the License.
1414

1515
# Scroll action for Android and iOS following W3C spec
16-
def w3c_scroll(driver)
16+
def w3c_scroll(driver, duration: 0.1)
1717
window = driver.window_rect
1818

1919
action_builder = driver.action
2020
input = action_builder.pointer_inputs[0]
2121
action_builder
2222
.move_to_location(window.width / 2, window.height * 8 / 10)
2323
.pointer_down(:left)
24-
.pause(device: input, duration: 0.1)
24+
.pause(device: input, duration: duration)
2525
.move_to_location(window.width / 2, window.height / 10, duration: 0.2)
26-
.pause(device: input, duration: 0.1)
26+
.pause(device: input, duration: duration)
2727
.release
2828
.perform
2929
end
-869 Bytes
Loading

test/functional/ios/driver_test.rb

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
require 'test_helper'
16+
require 'functional/common_w3c_actions'
1617

1718
# $ rake test:func:ios TEST=test/functional/ios/driver_test.rb
1819
# rubocop:disable Style/ClassVars
@@ -117,12 +118,22 @@ def test_default_keyboard_pref
117118
@@driver.find_element(:accessibility_id, 'Keyboard').click
118119

119120
# to wait the animation
120-
@@driver.wait { |d| d.find_element :accessibility_id, 'Auto-Correction' }
121+
auto_correction_name = over_ios26?(@@driver) ? 'KeyboardAutocorrection' : 'Auto-Correction'
122+
@@driver.wait { |d| d.find_element :accessibility_id, auto_correction_name }
121123

122124
auto_correction = @@driver.wait do |d|
123-
d.find_element :predicate, 'name == "Auto-Correction" AND type == "XCUIElementTypeSwitch"'
125+
d.find_element :predicate, "name == \"#{auto_correction_name}\" AND type == \"XCUIElementTypeSwitch\""
124126
end
125-
search_word = over_ios17?(@@driver) ? 'Predictive Text' : 'Predictive'
127+
128+
# need to bding the element into the screen
129+
w3c_scroll @@driver, duration: 1.0
130+
search_word = if over_ios26?(@@driver)
131+
'KeyboardPrediction'
132+
elsif over_ios17?(@@driver)
133+
'Predictive Text'
134+
else
135+
'Predictive'
136+
end
126137
predictive = @@driver.wait do |d|
127138
d.find_element :predicate, "name == \"#{search_word}\" AND type == \"XCUIElementTypeSwitch\""
128139
end

test/functional/ios/ios/mobile_commands_test.rb

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
require 'test_helper'
16+
require 'functional/common_w3c_actions'
1617

1718
# $ rake test:func:ios TEST=test/functional/ios/ios/mobile_commands_test.rb
1819
class AppiumLibCoreTest
@@ -83,26 +84,27 @@ def test_permission
8384
core = ::Appium::Core.for(caps)
8485
@driver = core.start_driver
8586

86-
skip 'Permissions does not work well on iOS 14 yet' if over_ios14?(@driver)
87-
87+
# skip 'Permissions does not work well on iOS 14 yet' if over_ios14?(@driver)
8888
assert @driver.execute_script('mobile: getPermission',
8989
{ service: 'calendar', bundleId: 'com.example.apple-samplecode.UICatalog' }) == 'yes'
9090
assert @driver.execute_script('mobile: getPermission',
9191
{ service: 'photos', bundleId: 'com.example.apple-samplecode.UICatalog' }) == 'no'
9292

9393
@driver.terminate_app('com.apple.Preferences') # To ensure the app shows the top view
9494
@driver.activate_app('com.apple.Preferences')
95-
@driver.find_element(:accessibility_id, 'Privacy').click
95+
@driver.settings.update({ defaultActiveApplication: 'com.apple.Preferences' })
96+
w3c_scroll @driver, duration: 1.0
97+
@driver.find_element(:accessibility_id, 'com.apple.settings.privacyAndSecurity').click
9698

9799
@driver.find_element(:accessibility_id, 'Calendars').click
98-
el = @driver.find_element(:accessibility_id, uicatalog)
99-
assert_equal '1', el.value
100-
100+
if over_ios26? @driver
101+
# without exceptions
102+
d.find_element :predicate, "label == 'UIKitCatalog, Full Access'"
103+
else
104+
el = @driver.find_element(:accessibility_id, uicatalog)
105+
assert_equal '1', el.value
106+
end
101107
@driver.back
102-
103-
@driver.find_element(:accessibility_id, 'Photos').click
104-
el = @driver.find_element(:accessibility_id, 'Never')
105-
assert_equal 'Never', el.value
106108
end
107109

108110
# @since Appium 1.10.0
@@ -118,6 +120,8 @@ def test_siri
118120

119121
@driver.execute_script 'mobile: siriCommand', { text: 'hello, siri' }
120122

123+
# to expand the detection area
124+
@driver.settings.update({ defaultActiveApplication: 'com.apple.springboard' })
121125
if over_ios14?(@driver)
122126
@core.wait { @driver.find_element :name, 'siri-interface-window' }
123127
else
@@ -126,6 +130,7 @@ def test_siri
126130
# name="...having a problem with the connection. Please try again in a little bit." ...>
127131
@core.wait { @driver.find_element :class_chain, '**/*[`name == "com.apple.ace.assistant"`]' }
128132
end
133+
@driver.settings.update({ defaultActiveApplication: 'com.example.apple-samplecode.UICatalog' })
129134
assert_equal :running_in_foreground, @driver.app_state('com.example.apple-samplecode.UICatalog')
130135

131136
@driver.activate_app 'com.example.apple-samplecode.UICatalog'

test/test_helper.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ def over_ios17?(driver)
8282
Gem::Version.create(driver.capabilities['platformVersion']) >= Gem::Version.create('17.0')
8383
end
8484

85+
def over_ios26?(driver)
86+
Gem::Version.create(driver.capabilities['platformVersion']) >= Gem::Version.create('26.0')
87+
end
88+
8589
def ci?
8690
ENV['CI'] == 'true'
8791
end
@@ -127,7 +131,7 @@ def self.mac2
127131

128132
# Require a simulator which OS version is 11.4, for example.
129133
def ios(platform_name = :ios)
130-
platform_version = '17.4'
134+
platform_version = '26.0'
131135
wda_port = wda_local_port
132136

133137
real_device = ENV['REAL'] || false
@@ -211,9 +215,9 @@ def device_name(os_version, platform_name, wda_local_port)
211215
'Apple TV'
212216
else
213217
name = if over_ios13?(os_version)
214-
'iPhone 15 Plus'
218+
'iPhone 16 Plus'
215219
else
216-
'iPhone 15 Pro Max'
220+
'iPhone 16 Pro Max'
217221
end
218222

219223
parallel? ? "#{name} - #{wda_local_port}" : name

0 commit comments

Comments
 (0)