Skip to content

Commit db643da

Browse files
committed
Implement RBS trace
1 parent c9cb77c commit db643da

39 files changed

+201
-1
lines changed

rb/Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ gem 'activesupport', '~> 7.0', require: false, platforms: %i[mri mingw x64_mingw
1010
gem 'curb', '~> 1.0.5', require: false, platforms: %i[mri mingw x64_mingw]
1111
gem 'debug', '~> 1.7', require: false, platforms: %i[mri mingw x64_mingw]
1212
gem 'steep', '~> 1.5.0', require: false, platforms: %i[mri mingw x64_mingw]
13+
14+
gem "rbs-trace", "~> 0.5.1"

rb/Gemfile.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ GEM
100100
ffi (~> 1.0)
101101
rbs (3.9.2)
102102
logger
103+
rbs-trace (0.5.1)
104+
prism (>= 0.3.0)
105+
rbs (>= 3.5.0)
103106
rchardet (1.9.0)
104107
rdoc (6.13.1)
105108
psych (>= 4.0.0)
@@ -199,6 +202,7 @@ DEPENDENCIES
199202
git (~> 1.19)
200203
rack (~> 2.0)
201204
rake (~> 13.0)
205+
rbs-trace (~> 0.5.1)
202206
rspec (~> 3.0)
203207
rubocop (~> 1.75)
204208
rubocop-performance (~> 1.25)

rb/lib/selenium/webdriver.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ def self.for(*args)
9595
# @return [Logger]
9696
#
9797

98+
# @rbs (**nil) -> Selenium::WebDriver::Logger
9899
def self.logger(**opts)
99100
level = $DEBUG || ENV.key?('DEBUG') ? :debug : :info
100101
@logger ||= WebDriver::Logger.new('Selenium', default_level: level, **opts)

rb/lib/selenium/webdriver/chrome.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def self.path=(path)
3131
@path = path
3232
end
3333

34+
# @rbs () -> nil
3435
def self.path
3536
@path ||= nil
3637
end

rb/lib/selenium/webdriver/chrome/driver.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ module Chrome
3030
class Driver < Chromium::Driver
3131
include LocalDriver
3232

33+
# @rbs (?options: Selenium::WebDriver::Chrome::Options, ?service: Selenium::WebDriver::Chrome::Service, ?url: nil, **nil) -> void
3334
def initialize(options: nil, service: nil, url: nil, **opts)
3435
caps, url = initialize_local_driver(options, service, url)
3536
super(caps: caps, url: url, **opts)
3637
end
3738

39+
# @rbs () -> Symbol
3840
def browser
3941
:chrome
4042
end

rb/lib/selenium/webdriver/chrome/features.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ module Features
3535
send_command: [:post, 'session/:session_id/goog/cdp/execute']
3636
}.freeze
3737

38+
# @rbs () -> Hash[untyped, untyped]
3839
def command_list
3940
CHROME_COMMANDS.merge(CHROMIUM_COMMANDS).merge(self.class::COMMANDS)
4041
end
4142

43+
# @rbs (Symbol) -> Array[untyped]
4244
def commands(command)
4345
command_list[command]
4446
end

rb/lib/selenium/webdriver/chrome/options.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def enable_logging(browser_options)
3232
browser_options['goog:loggingPrefs'] = @logging_prefs
3333
end
3434

35+
# @rbs () -> nil
3536
def binary_path
3637
Chrome.path
3738
end

rb/lib/selenium/webdriver/chrome/service.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class Service < WebDriver::Service
2626
SHUTDOWN_SUPPORTED = true
2727
DRIVER_PATH_ENV_KEY = 'SE_CHROMEDRIVER'
2828

29+
# @rbs () -> nil
2930
def log
3031
return @log unless @log.is_a? String
3132

rb/lib/selenium/webdriver/chromium/features.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def delete_network_conditions
7575
execute :delete_network_conditions
7676
end
7777

78+
# @rbs (Hash[untyped, untyped]) -> Hash[untyped, untyped]
7879
def send_command(command_params)
7980
execute :send_command, {}, command_params
8081
end

rb/lib/selenium/webdriver/chromium/options.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class Options < WebDriver::Options
6767
# @option opts [Array<String>] window_types A list of window types to appear in the list of window handles
6868
#
6969

70+
# @rbs (?profile: nil, **Array[untyped] | Hash[untyped, untyped] | nil) -> void
7071
def initialize(profile: nil, **opts)
7172
super(**opts)
7273

@@ -203,6 +204,7 @@ def enable_android(package: 'com.android.chrome', serial_number: nil, use_runnin
203204

204205
protected
205206

207+
# @rbs (Hash[untyped, untyped]) -> void
206208
def process_browser_options(browser_options)
207209
enable_logging(browser_options) unless @logging_prefs.empty?
208210

@@ -234,6 +236,7 @@ def validate_extension(path)
234236
@extensions << path
235237
end
236238

239+
# @rbs (Symbol | String) -> bool
237240
def camelize?(key)
238241
!%w[localState prefs].include?(key)
239242
end

0 commit comments

Comments
 (0)