Skip to content

Commit 59a27af

Browse files
authored
feat: drop deprecated start_logs_broadcast/stop_logs_broadcast methods (#1105)
* feat: drop boardcast for logs * remove unnecessary deps * use newer env for test * update tests * use lower version of timeout
1 parent 4bd31dc commit 59a27af

14 files changed

Lines changed: 23 additions & 201 deletions

File tree

.github/workflows/functional-test.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ concurrency:
1414

1515
jobs:
1616
ios_test:
17-
runs-on: macos-14
17+
runs-on: macos-15
18+
timeout-minutes: 90
1819
env:
19-
XCODE_VERSION: 15.3
20-
IOS_VERSION: 17.4
21-
IOS_DEVICE_NAME: iPhone 15 Plus
20+
XCODE_VERSION: 16.4
21+
IOS_VERSION: 18.5
22+
IOS_DEVICE_NAME: iPhone 16 Plus
2223

2324
steps:
2425
- uses: actions/checkout@v6
@@ -65,6 +66,7 @@ jobs:
6566
bundle install
6667
rake ios
6768
name: Run tests
69+
timeout-minutes: 60
6870
working-directory: ios_tests
6971
7072
- name: Save server output

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ source 'https://rubygems.org'
1616
gemspec
1717

1818
gem 'appium_thor', '~> 2.0'
19-
gem 'fakefs', '~> 3.0.0'
2019
gem 'hashdiff', '~> 1.2.0'
2120
gem 'minitest', '~> 5.0'
2221
gem 'minitest-reporters', '~> 1.1'

android_tests/lib/android/specs/common/command/command.rb

Lines changed: 0 additions & 33 deletions
This file was deleted.

android_tests/lib/android/specs/driver.rb

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
require 'tmpdir'
16+
1517
# rake "android[driver]"
1618
class AndroidTest
1719
class Driver < Minitest::Test
@@ -105,20 +107,11 @@ def test_07_absolute_app_path
105107
validate_path 'sauce-storage:some_storage_suffix'
106108
validate_path 'http://www.saucelabs.com'
107109

108-
# fake real paths for osx/windows.
109-
FakeFS.activate!
110-
111-
osx_existing_path = '/Users/user/myapp.app'
112-
FileUtils.mkdir_p osx_existing_path
113-
validate_path osx_existing_path
114-
115-
# TODO: FakeFS fails on Windows paths due to the drive letters.
116-
# Look into how opscode/chef tests this.
117-
# windows_existing_path = "C:\\Program Files\\myapp.apk"
118-
# FileUtils.mkdir_p windows_existing_path
119-
# validate_path windows_existing_path
120-
121-
FakeFS.deactivate!
110+
Dir.mktmpdir do |tmp_dir|
111+
existing_path = File.join(tmp_dir, 'myapp.app')
112+
FileUtils.mkdir_p existing_path
113+
validate_path existing_path
114+
end
122115

123116
# bundle id test
124117
validate_path 'my.bundle.id'

android_tests/lib/run.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
require 'minitest/autorun'
1717
require 'minitest/reporters'
1818
require 'minitest'
19-
require 'fakefs/safe'
2019
require 'hashdiff'
2120
require_relative '../../lib/appium_lib'
2221

@@ -40,7 +39,12 @@ def start_driver(caps)
4039
driver = Appium::Driver.new(caps, true)
4140
# Tests expect methods defined on the minispec object
4241
Appium.promote_appium_methods Minitest::Test, driver
43-
driver.start_driver
42+
43+
# Use bounded HTTP timeouts in tests to avoid CI hangs on stuck requests.
44+
open_timeout = Integer(ENV.fetch('APPIUM_TEST_OPEN_TIMEOUT', '120'))
45+
read_timeout = Integer(ENV.fetch('APPIUM_TEST_READ_TIMEOUT', '300'))
46+
47+
driver.start_driver(open_timeout: open_timeout, read_timeout: read_timeout)
4448
end
4549

4650
dir = File.expand_path(File.join(Dir.pwd, 'lib'))

appium_lib.gemspec

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ Gem::Specification.new do |s|
1313
s.homepage = 'https://github.com/appium/ruby_lib' # published as appium_lib
1414
s.require_paths = ['lib']
1515

16-
# TODO: We must remove start_logs_broadcast/stop_logs_broadcast to bump the appium_lib_core version to v12+.
17-
s.add_dependency 'appium_lib_core', '>= 9.2.1', '< 12.0'
16+
s.add_dependency 'appium_lib_core', '>= 9.2.1', '< 13.0'
1817
s.add_dependency 'nokogiri', '~> 1.8', '>= 1.8.1'
1918
s.add_dependency 'tomlrb', '>= 1.1', '< 3.0'
2019

ios_tests/appium.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[caps]
22
platformName = "ios"
3-
platformVersion = "17.4"
4-
deviceName ="iPhone 15 Plus"
3+
platformVersion = "18.5"
4+
deviceName ="iPhone 16 Plus"
55
automationName = 'XCUITest'
66
app = "../test_apps/UICatalog.app.zip"
77
someCapability = "some_capability"

ios_tests/lib/ios/specs/common/command/command.rb

Lines changed: 0 additions & 38 deletions
This file was deleted.

ios_tests/lib/ios/specs/common/helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def test_17_find_ele_by_predicate_include
202202
end
203203

204204
def test_18_find_eles_by_predicate_include
205-
assert_equal find_eles_by_predicate_include(value: 'e').length, 49
205+
assert_equal find_eles_by_predicate_include(value: 'e').length, 51
206206
end
207207

208208
def test_19_first_ele

lib/appium_lib/android/common/command/command.rb

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -30,37 +30,6 @@ def shell(command, arguments)
3030
# --relaxed-security
3131
@driver.execute_script 'mobile: shell', args
3232
end
33-
34-
# @deprecated Please use BiDi implementation via `$driver.driver.bidi` directly instead.
35-
#
36-
# Starts Android logcat broadcast websocket
37-
#
38-
# @param [String] logcat_file A file path to write messages from a logcat WebSocket client
39-
#
40-
# @example
41-
#
42-
# start_logs_broadcast 'outputfile.log' #=> #<Appium::Android::Command::WsLogcat:...>
43-
#
44-
def start_logs_broadcast(logcat_file = 'logcat.log')
45-
@driver.execute_script 'mobile: startLogsBroadcast'
46-
47-
socket_url = "ws://#{URI.parse(server_url).host}:#{@core.port}/ws/session/#{@driver.session_id}/appium/device/logcat"
48-
@logcat_client = ::Appium::Common::Command::WsLogcat.new(url: socket_url, output_file: logcat_file)
49-
end
50-
51-
# @deprecated Please use BiDi implementation directly instead.
52-
#
53-
# Stop Android logcat broadcast websocket
54-
#
55-
# @example
56-
#
57-
# stop_logs_broadcast #=> nil
58-
#
59-
def stop_logs_broadcast
60-
@logcat_client.close
61-
62-
@driver.execute_script 'mobile: stopLogsBroadcast'
63-
end
6433
end
6534
end
6635
end

0 commit comments

Comments
 (0)