Skip to content

Commit 817a98a

Browse files
authored
Merge branch 'master' into dependabot/bundler/steep-tw-1.10.0
2 parents ca5e92f + 0e44a0f commit 817a98a

30 files changed

Lines changed: 486 additions & 103 deletions

.github/workflows/functional-test.yml

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,47 @@ jobs:
2020
test_targets:
2121
- target: test/functional/ios/driver_test.rb,test/functional/ios/patch_test.rb
2222
name: test1
23+
platform: ios
24+
wdaName: WebDriverAgentRunner-Runner.app
2325
- target: test/functional/ios/webdriver/create_session_test.rb,test/functional/ios/webdriver/w3c_actions_test.rb
2426
name: test2
27+
platform: ios
28+
wdaName: WebDriverAgentRunner-Runner.app
2529
- target: test/functional/ios/webdriver/device_test.rb
2630
name: test3
31+
platform: ios
32+
wdaName: WebDriverAgentRunner-Runner.app
2733
- target: test/functional/ios/ios/device_test.rb
2834
name: test4
35+
platform: ios
36+
wdaName: WebDriverAgentRunner-Runner.app
2937
- target: test/functional/ios/ios/device_wda_attachment_test.rb,test/functional/ios/ios/search_context_test.rb
3038
name: test5
39+
platform: ios
40+
wdaName: WebDriverAgentRunner-Runner.app
3141
- target: test/functional/ios/ios/image_comparison_test.rb
3242
name: test6
43+
platform: ios
44+
wdaName: WebDriverAgentRunner-Runner.app
3345
- target: test/functional/ios/tv_driver_test.rb
3446
name: test7
47+
platform: tvOS
48+
wdaName: WebDriverAgentRunner_tvOS-Runner.app
3549

36-
runs-on: macos-14
50+
runs-on: macos-15
3751

3852
# Please make sure the available Xcode versions and iOS versions
3953
# on the runner images. https://github.com/actions/runner-images
4054
env:
41-
XCODE_VERSION: 15.3
42-
IOS_VERSION: 17.4
43-
IOS_DEVICE_NAME: iPhone 15 Plus
55+
XCODE_VERSION: 16.4
56+
IOS_VERSION: 18.5
57+
IOS_DEVICE_NAME: iPhone 16 Plus
4458

4559
steps:
4660
- uses: actions/checkout@v3
4761

4862
- name: Install Node.js
49-
uses: actions/setup-node@v3
63+
uses: actions/setup-node@v5
5064
with:
5165
node-version: 'lts/*'
5266

@@ -65,11 +79,16 @@ jobs:
6579
# Start Appium
6680
- run: npm install -g appium
6781
- run: |
68-
appium driver install xcuitest
6982
appium plugin install images
7083
appium plugin install execute-driver
84+
# Workaround to keep symlink to global appium
85+
appium driver install xcuitest
7186
nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors 2>&1 > appium.log &
7287
88+
- run: |
89+
appium driver run xcuitest download-wda-sim --platform=${{matrix.test_targets.platform}} --outdir=${{github.workspace}}/wda
90+
name: Downloading prebuilt WDA
91+
7392
- name: Set up Ruby
7493
uses: ruby/setup-ruby@v1
7594
with:
@@ -83,6 +102,7 @@ jobs:
83102
env:
84103
IGNORE_VERSION_SKIP: true
85104
CI: true
105+
LOCAL_PREBUILT_WDA: ${{ github.workspace }}/wda/${{matrix.test_targets.wdaName}}
86106

87107
- name: Save server output
88108
if: ${{ always() }}
@@ -94,7 +114,14 @@ jobs:
94114
test/report/
95115
96116
ios_test_with_other_deps:
97-
runs-on: macos-14
117+
runs-on: macos-15
118+
119+
# Please make sure the available Xcode versions and iOS versions
120+
# on the runner images. https://github.com/actions/runner-images
121+
env:
122+
XCODE_VERSION: 16.4
123+
IOS_VERSION: 18.5
124+
IOS_DEVICE_NAME: iPhone 16 Plus
98125

99126
steps:
100127
- uses: actions/checkout@v3
@@ -123,15 +150,21 @@ jobs:
123150
brew install applesimutils
124151
125152
# Start Appium
153+
- run: npm root -g
126154
- name: Install appium and mjpeg-consumer
127155
run: |
128156
npm install -g appium
129157
npm install -g mjpeg-consumer
130158
- run: |
131-
appium driver install xcuitest
132-
appium plugin install images@2.1.8
159+
appium plugin install images
133160
appium plugin install execute-driver
134-
nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors > appium.log &
161+
# Workaround to keep symlink to global appium
162+
appium driver install xcuitest
163+
nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors 2>&1 > appium.log &
164+
165+
- run: |
166+
npx appium driver run xcuitest download-wda-sim --platform=ios --outdir=${{github.workspace}}/wda
167+
name: Downloading prebuilt WDA
135168
136169
- name: Set up Ruby
137170
uses: ruby/setup-ruby@v1
@@ -145,6 +178,7 @@ jobs:
145178
env:
146179
IGNORE_VERSION_SKIP: true
147180
CI: true
181+
LOCAL_PREBUILT_WDA: ${{ github.workspace }}/wda/WebDriverAgentRunner-Runner.app
148182

149183
- name: Save server output
150184
if: ${{ always() }}
@@ -192,9 +226,15 @@ jobs:
192226
- target: test/functional/android/android/mjpeg_server_test.rb,test/functional/android/android/image_comparison_test.rb
193227
automation_name: espresso
194228
name: test10
229+
- target: test/functional/android/webdriver/bidi_test.rb
230+
automation_name: uiautomator2
231+
name: test11
232+
- target: test/functional/android/webdriver/bidi_test.rb
233+
automation_name: espresso
234+
name: test12
195235

196236
env:
197-
API_LEVEL: 34
237+
API_LEVEL: 36
198238
ARCH: x86_64
199239

200240
steps:
@@ -216,7 +256,7 @@ jobs:
216256
appium driver install ${{matrix.test_targets.automation_name}}
217257
appium plugin install images
218258
appium plugin install execute-driver
219-
nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors > appium.log &
259+
nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors 2>&1 > appium.log &
220260
221261
- name: Enable KVM group perms
222262
run: |

.github/workflows/unittest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
run: |
5656
gem install ffi
5757
bundle install
58-
gem uninstall --force eventmachine && gem install eventmachine --platform ruby
58+
gem uninstall --force eventmachine && gem install eventmachine --platform ruby -- --with-ldflags="-Wl,-undefined,dynamic_lookup"
5959
- name: Run tests
6060
run: |
6161
bundle exec rake test:unit

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
All notable changes to this project will be documented in this file.
33
Read `release_notes.md` for commit level details.
44

5+
## [11.1.0,11.1.1] - 2025-08-08
6+
- Add WebDriver BiDi support. Please set `webSocketUrl` in the capabilities to enable it.
7+
- `test/functional/android/webdriver/bidi_test.rb` can be an example usage.
8+
- Older versions of the Selenium Ruby bindings may raise exceptions due to missing module dependencies.
9+
10+
## [11.0.2] - 2025-04-27
11+
- Add more sig definitions [#571](https://github.com/appium/ruby_lib_core/pull/571)
12+
513
## [11.0.1] - 2025-03-27
614
- Remove `::Selenium::WebDriver::DriverExtensions::HasWebStorage` import to follow selenium webdriver 4.30.0
715

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ gem 'minitest', '~> 5.0'
88
gem 'minitest-reporters', '~> 1.1'
99
gem 'parallel_tests'
1010
gem 'rake', '~> 13.0'
11-
gem 'rubocop', '1.75.2'
11+
gem 'rubocop', '1.81.7'
1212
gem 'simplecov'
1313
gem 'steep', '~> 1.10.0'
14-
gem 'webmock', '~> 3.25.0'
14+
gem 'webmock', '~> 3.26.0'
1515
gem 'yard', '~> 0.9.11'

README.md

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ $ IGNORE_VERSION_SKIP=true CI=true bundle exec rake test:func:android
114114
opts = {
115115
capabilities: { # Append capabilities
116116
platformName: 'ios',
117-
platformVersion: '11.0',
118-
deviceName: 'iPhone Simulator',
117+
platformVersion: '26.0',
118+
deviceName: 'iPhone 17',
119119
# app: '/path/to/MyiOS.app', # Without 'app' capability, an appium session starts with the home screen
120120
automationName: 'XCUITest'
121121
},
@@ -138,7 +138,7 @@ $ IGNORE_VERSION_SKIP=true CI=true bundle exec rake test:func:android
138138
$ ruby test.rb
139139
```
140140

141-
[Appium::Core.for](https://www.rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Driver#for-class_method) documentation has more example to build a new driver instance.
141+
[Appium::Core.for](https://rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Driver#for-class_method) documentation has more example to build a new driver instance.
142142

143143
More examples are in [test/functional](test/functional)
144144

@@ -153,9 +153,29 @@ attached_driver.page_source
153153

154154
### Capabilities
155155

156-
Read [Appium/Core/Driver](https://www.rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Driver) to catch up with available capabilities.
157-
Capabilities affect only ruby_lib is [Appium/Core/Options](https://www.rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Options).
156+
Read [Appium/Core/Driver](https://rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Driver) to catch up with available capabilities.
157+
Capabilities affect only ruby_lib is [Appium/Core/Options](https://rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Options).
158158

159+
### Improvement ideas
160+
161+
- for iOS
162+
163+
```
164+
$ appium driver run xcuitest download-wda-sim --outdir=/path/to/download/prebuilt/wda/
165+
```
166+
167+
Then, adding capabilities below:
168+
169+
```json
170+
{
171+
"appium:usePreinstalledWDA": true,
172+
"appium:prebuiltWDAPath": "/path/to/download/prebuilt/wda/WebDriverAgentRunner-Runner.app"
173+
}
174+
```
175+
176+
It will improve initial new session request performance for iOS simulator.
177+
178+
`"appium:settings[respectSystemAlerts]" => true` for capability will also help to work with [permissions](https://appium.github.io/appium-xcuitest-driver/latest/guides/troubleshooting/#interact-with-dialogs-managed-by-comapplespringboard).
159179

160180
### Gives custom listener
161181

@@ -171,7 +191,7 @@ capabilities: {
171191
deviceName: 'iPhone Simulator',
172192
automationName: 'XCUITest',
173193
app: '/path/to/MyiOS.app'
174-
},
194+
}
175195
appium_lib: {
176196
listener: CustomListener.new
177197
}

appium_lib_core.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
2121
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
2222
spec.require_paths = ['lib']
2323

24-
spec.add_dependency 'faye-websocket', '~> 0.11.0'
24+
spec.add_dependency 'faye-websocket', '>= 0.11', '< 0.13'
2525
spec.add_dependency 'selenium-webdriver', '~> 4.21'
2626

2727
spec.metadata['rubygems_mfa_required'] = 'true'

lib/appium_lib_core/common/base.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@
3030
require_relative 'device/orientation'
3131

3232
# The following files have selenium-webdriver related stuff.
33-
require_relative 'base/driver'
3433
require_relative 'base/bridge'
34+
require_relative 'base/bidi_bridge'
35+
require_relative 'base/driver'
3536
require_relative 'base/capabilities'
3637
require_relative 'base/http_default'
3738
require_relative 'base/search_context'
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# frozen_string_literal: true
2+
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
require_relative 'bridge'
16+
17+
module Appium
18+
module Core
19+
class Base
20+
class BiDiBridge < ::Appium::Core::Base::Bridge
21+
attr_reader :bidi
22+
23+
# Override
24+
# Creates session handling.
25+
#
26+
# @param [::Appium::Core::Base::Capabilities, Hash] capabilities A capability
27+
# @return [::Appium::Core::Base::Capabilities]
28+
#
29+
# @example
30+
#
31+
# opts = {
32+
# caps: {
33+
# platformName: :android,
34+
# automationName: 'uiautomator2',
35+
# platformVersion: '15',
36+
# deviceName: 'Android',
37+
# webSocketUrl: true,
38+
# },
39+
# appium_lib: {
40+
# wait: 30
41+
# }
42+
# }
43+
# core = ::Appium::Core.for(caps)
44+
# driver = core.start_driver
45+
#
46+
def create_session(capabilities)
47+
super
48+
49+
return @capabilities if @capabilities.nil?
50+
51+
begin
52+
socket_url = @capabilities[:web_socket_url]
53+
@bidi = ::Selenium::WebDriver::BiDi.new(url: socket_url) if socket_url
54+
rescue StandardError => e
55+
::Appium::Logger.warn "WebSocket connection to #{socket_url} for BiDi failed. Error #{e}"
56+
raise
57+
end
58+
59+
@capabilities
60+
end
61+
62+
def get(url)
63+
browsing_context.navigate(url)
64+
end
65+
66+
def go_back
67+
browsing_context.traverse_history(-1)
68+
end
69+
70+
def go_forward
71+
browsing_context.traverse_history(1)
72+
end
73+
74+
def refresh
75+
browsing_context.reload
76+
end
77+
78+
def quit
79+
super
80+
ensure
81+
bidi.close
82+
end
83+
84+
def close
85+
execute(:close_window).tap { |handles| bidi.close if handles.empty? }
86+
end
87+
88+
private
89+
90+
def browsing_context
91+
@browsing_context ||= ::Selenium::WebDriver::BiDi::BrowsingContext.new(self)
92+
end
93+
end # class BiDiBridge
94+
end # class Base
95+
end # module Core
96+
end # module Appium

0 commit comments

Comments
 (0)