diff --git a/rb/Gemfile b/rb/Gemfile index 5c2c1d11f5954..9c891677f09d0 100644 --- a/rb/Gemfile +++ b/rb/Gemfile @@ -10,3 +10,5 @@ gem 'activesupport', '~> 7.0', require: false, platforms: %i[mri mingw x64_mingw gem 'curb', '~> 1.0.5', require: false, platforms: %i[mri mingw x64_mingw] gem 'debug', '~> 1.7', require: false, platforms: %i[mri mingw x64_mingw] gem 'steep', '~> 1.5.0', require: false, platforms: %i[mri mingw x64_mingw] + +gem 'rbs-trace', '~> 0.5.1', require: false, platforms: %i[mri mingw x64_mingw] diff --git a/rb/Gemfile.lock b/rb/Gemfile.lock index 434d77e19cd8d..8162025d95648 100644 --- a/rb/Gemfile.lock +++ b/rb/Gemfile.lock @@ -99,6 +99,9 @@ GEM ffi (~> 1.0) rbs (3.9.2) logger + rbs-trace (0.5.1) + prism (>= 0.3.0) + rbs (>= 3.5.0) rchardet (1.9.0) rdoc (6.13.1) psych (>= 4.0.0) @@ -198,6 +201,7 @@ DEPENDENCIES git (~> 1.19) rack (~> 2.0) rake (~> 13.0) + rbs-trace (~> 0.5.1) rspec (~> 3.0) rubocop (~> 1.75) rubocop-performance (~> 1.25) diff --git a/rb/lib/selenium/webdriver/firefox/profile.rb b/rb/lib/selenium/webdriver/firefox/profile.rb index f018c5e2c7541..3b3792b1bd0f6 100644 --- a/rb/lib/selenium/webdriver/firefox/profile.rb +++ b/rb/lib/selenium/webdriver/firefox/profile.rb @@ -227,9 +227,7 @@ def write_prefs(prefs, path) end end end - end - - # Profile + end # Profile end # Firefox end # WebDriver end # Selenium diff --git a/rb/rbs_collection.lock.yaml b/rb/rbs_collection.lock.yaml index ce3878d164f4f..5cc203d70cbfc 100644 --- a/rb/rbs_collection.lock.yaml +++ b/rb/rbs_collection.lock.yaml @@ -25,6 +25,22 @@ gems: version: '0' source: type: stdlib +- name: diff-lcs + version: '1.5' + source: + type: git + name: ruby/gem_rbs_collection + revision: eb6867fdb70e82e3aac6b51623ed1b6760c3c072 + remote: https://github.com/ruby/gem_rbs_collection.git + repo_dir: gems +- name: digest + version: '0' + source: + type: stdlib +- name: erb + version: '0' + source: + type: stdlib - name: fileutils version: '0' source: @@ -49,6 +65,10 @@ gems: version: '0' source: type: stdlib +- name: openssl + version: '0' + source: + type: stdlib - name: optparse version: '0' source: @@ -69,6 +89,10 @@ gems: revision: 01361bb0fd6e2f3e2da2b11a733ffc938b9047c4 remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems +- name: prism + version: 1.4.0 + source: + type: rubygems - name: rack version: '2.2' source: @@ -93,6 +117,10 @@ gems: revision: 01361bb0fd6e2f3e2da2b11a733ffc938b9047c4 remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems +- name: rbs-trace + version: 0.5.1 + source: + type: rubygems - name: regexp_parser version: '2.8' source: @@ -121,6 +149,18 @@ gems: revision: 01361bb0fd6e2f3e2da2b11a733ffc938b9047c4 remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems +- name: singleton + version: '0' + source: + type: stdlib +- name: socket + version: '0' + source: + type: stdlib +- name: stringio + version: '0' + source: + type: stdlib - name: tempfile version: '0' source: @@ -129,6 +169,18 @@ gems: version: '0' source: type: stdlib +- name: webmock + version: '3.19' + source: + type: git + name: ruby/gem_rbs_collection + revision: eb6867fdb70e82e3aac6b51623ed1b6760c3c072 + remote: https://github.com/ruby/gem_rbs_collection.git + repo_dir: gems +- name: webrick + version: 1.9.1 + source: + type: rubygems - name: yard version: '0.9' source: diff --git a/rb/sig/lib/selenium/webdriver.rbs b/rb/sig/lib/selenium/webdriver.rbs index 147911acb6a0a..57d35ddcfe426 100644 --- a/rb/sig/lib/selenium/webdriver.rbs +++ b/rb/sig/lib/selenium/webdriver.rbs @@ -1,34 +1,3 @@ -module Selenium - module WebDriver - class Point - attr_reader x: Integer - attr_reader y: Integer - - def initialize: (Integer x, Integer y) -> void - end - - class Dimension - attr_reader width: Integer - attr_reader height: Integer - - def initialize: (Integer width, Integer height) -> void - end - - class Rectangle - attr_reader x: Integer - attr_reader y: Integer - attr_reader width: Integer - attr_reader height: Integer - - def initialize: (Integer x, Integer y, Integer width, Integer height) -> void - end - - @root: String - - def self.root: () -> String - - def self.for: (*untyped args) -> untyped - - def self.logger: (**String | Symbol opts) -> WebDriver::Logger - end +module Selenium::WebDriver + def self.logger: (**untyped) -> Selenium::WebDriver::Logger end diff --git a/rb/sig/lib/selenium/webdriver/chrome.rbs b/rb/sig/lib/selenium/webdriver/chrome.rbs index f1d605c834bb9..3c9876fc333ee 100644 --- a/rb/sig/lib/selenium/webdriver/chrome.rbs +++ b/rb/sig/lib/selenium/webdriver/chrome.rbs @@ -1,13 +1,3 @@ -module Selenium - module WebDriver - module Chrome - self.@path: String - - @path: String - - def self.path=: (String path) -> String - - def self.path: () -> String? - end - end +module Selenium::WebDriver::Chrome + def self.path: () -> nil end diff --git a/rb/sig/lib/selenium/webdriver/chrome/driver.rbs b/rb/sig/lib/selenium/webdriver/chrome/driver.rbs index 92653102f9a90..e337b8b97b657 100644 --- a/rb/sig/lib/selenium/webdriver/chrome/driver.rbs +++ b/rb/sig/lib/selenium/webdriver/chrome/driver.rbs @@ -1,17 +1,5 @@ -module Selenium - module WebDriver - module Chrome - class Driver < Chromium::Driver - include LocalDriver +class Selenium::WebDriver::Chrome::Driver + def initialize: (?options: Selenium::WebDriver::Chrome::Options, ?service: Selenium::WebDriver::Chrome::Service, ?url: nil, **nil) -> void - def initialize: (?options: untyped?, ?service: untyped?, ?url: untyped?, **untyped opts) -> void - - def browser: () -> Symbol - - private - - def devtools_address: () -> String - end - end - end + def browser: () -> Symbol end diff --git a/rb/sig/lib/selenium/webdriver/chrome/features.rbs b/rb/sig/lib/selenium/webdriver/chrome/features.rbs index ab3e9c85707e4..46baf31202653 100644 --- a/rb/sig/lib/selenium/webdriver/chrome/features.rbs +++ b/rb/sig/lib/selenium/webdriver/chrome/features.rbs @@ -1,16 +1,5 @@ -module Selenium - module WebDriver - module Chrome - module Features - include WebDriver::Chromium::Features +module Selenium::WebDriver::Chrome::Features + def commands: (Symbol) -> Array[untyped] - CHROME_COMMANDS: Hash[Symbol, Array[Symbol | String]] - COMMANDS: Hash[Symbol, Array[Symbol | String]] - - def command_list: -> Hash[Symbol, Array[Symbol | String]] - - def commands: (Symbol command) -> Array[Symbol | String] - end - end - end + def command_list: () -> Hash[untyped, untyped] end diff --git a/rb/sig/lib/selenium/webdriver/chrome/options.rbs b/rb/sig/lib/selenium/webdriver/chrome/options.rbs index eae4c2feab36f..08c99aa87fe2c 100644 --- a/rb/sig/lib/selenium/webdriver/chrome/options.rbs +++ b/rb/sig/lib/selenium/webdriver/chrome/options.rbs @@ -1,17 +1,3 @@ -module Selenium - module WebDriver - module Chrome - class Options < Chromium::Options - KEY: String - - BROWSER: String - - private - - def enable_logging: (untyped browser_options) -> untyped - - def binary_path: () -> untyped - end - end - end +class Selenium::WebDriver::Chrome::Options + def binary_path: () -> nil end diff --git a/rb/sig/lib/selenium/webdriver/chrome/service.rbs b/rb/sig/lib/selenium/webdriver/chrome/service.rbs index a8fa6e98d4bc0..c592c4263403a 100644 --- a/rb/sig/lib/selenium/webdriver/chrome/service.rbs +++ b/rb/sig/lib/selenium/webdriver/chrome/service.rbs @@ -1,19 +1,3 @@ -module Selenium - module WebDriver - module Chrome - class Service < WebDriver::Service - DRIVER_PATH_ENV_KEY: String - - @log: untyped - - DEFAULT_PORT: Integer - - EXECUTABLE: String - - SHUTDOWN_SUPPORTED: bool - - def log: () -> untyped - end - end - end +class Selenium::WebDriver::Chrome::Service + def log: () -> nil end diff --git a/rb/sig/lib/selenium/webdriver/chromium/features.rbs b/rb/sig/lib/selenium/webdriver/chromium/features.rbs index a48cca64401fe..6138564cf539d 100644 --- a/rb/sig/lib/selenium/webdriver/chromium/features.rbs +++ b/rb/sig/lib/selenium/webdriver/chromium/features.rbs @@ -1,42 +1,5 @@ -module Selenium - module WebDriver - module Chromium - module Features - include _Bridge +module Selenium::WebDriver::Chromium::Features + def network_conditions=: (Hash[untyped, untyped]) -> nil - CHROMIUM_COMMANDS: Hash[Symbol, Array[Symbol | String]] - - def commands: (Symbol command) -> Array[Symbol | String] - - def launch_app: (String id) -> String - - def cast_sinks: () -> Array[String] - - def cast_sink_to_use=: (String name) -> untyped - - def cast_issue_message: () -> String - - def start_cast_tab_mirroring: (String name) -> untyped - - def start_cast_desktop_mirroring: (String name) -> untyped - - def stop_casting: (String name) -> untyped - - def set_permission: (String name, String value) -> untyped - - def network_conditions: () -> Hash[untyped, untyped] - - def network_conditions=: (Hash[Symbol | String, Integer | bool] conditions) -> untyped - - def delete_network_conditions: () -> untyped - - def send_command: (Hash[String | Symbol, untyped] command_params) -> untyped - - def available_log_types: () -> Array[Symbol] - - def log: (Symbol type) -> Array[Hash[String, untyped]] | - (Symbol type) -> Array[LogEntry] - end - end - end + def network_conditions: () -> Hash[untyped, untyped] end diff --git a/rb/sig/lib/selenium/webdriver/chromium/options.rbs b/rb/sig/lib/selenium/webdriver/chromium/options.rbs index 9d0262127ce75..e58285dc66af5 100644 --- a/rb/sig/lib/selenium/webdriver/chromium/options.rbs +++ b/rb/sig/lib/selenium/webdriver/chromium/options.rbs @@ -1,53 +1,9 @@ -module Selenium - module WebDriver - module Chromium - class Options < WebDriver::Options - include _Options +class Selenium::WebDriver::Chromium::Options + def initialize: (?profile: nil, **Array[untyped]) -> void + | (?profile: nil, **nil) -> void - @profile: untyped + def process_browser_options: (Hash[untyped, untyped]) -> void - @options: untyped - - @logging_prefs: untyped - - @encoded_extensions: untyped - - @extensions: untyped - - attr_accessor profile: untyped - - attr_accessor logging_prefs: untyped - - CAPABILITIES: Hash[Symbol, String] - - attr_reader extensions: untyped - - def initialize: (?profile: untyped?, **untyped opts) -> void - - def add_extension: (untyped path) -> untyped - - def extensions=: (untyped extensions) -> untyped - - def add_encoded_extension: (untyped encoded) -> untyped - - def add_argument: (untyped arg) -> untyped - - def add_preference: (untyped name, untyped value) -> untyped - - def add_emulation: (**untyped opts) -> untyped - - def enable_android: (?package: String, ?serial_number: untyped?, ?use_running_app: untyped?, ?activity: untyped?) -> untyped - - def process_browser_options: (untyped browser_options) -> untyped? - - def binary_path: () -> untyped - - def encode_extension: (untyped path) -> untyped - - def validate_extension: (untyped path) -> untyped - - def camelize?: (untyped key) -> untyped - end - end - end + def camelize?: (Symbol) -> bool + | (String) -> bool end diff --git a/rb/sig/lib/selenium/webdriver/common/action_builder.rbs b/rb/sig/lib/selenium/webdriver/common/action_builder.rbs index 7f1f95fa71db6..081475fb53b57 100644 --- a/rb/sig/lib/selenium/webdriver/common/action_builder.rbs +++ b/rb/sig/lib/selenium/webdriver/common/action_builder.rbs @@ -1,53 +1,5 @@ -module Selenium - module WebDriver - class ActionBuilder - @bridge: Remote::Bridge +class Selenium::WebDriver::ActionBuilder + def initialize: (Selenium::WebDriver::Remote::Bridge, ?devices: Array[untyped], ?async: bool, ?duration: Integer) -> void - @duration: Integer - - @async: bool - - @devices: Array[Interactions::InputDevice] - - include KeyActions - - include PointerActions - - include WheelActions - - attr_reader devices: Array[Interactions::InputDevice] - - def initialize: (Remote::Bridge bridge, ?devices: Array[Interactions::InputDevice], ?async: bool, ?duration: ::Integer) -> void - - def add_pointer_input: (Symbol kind, String name) -> Interactions::InputDevice - - def add_key_input: (String name) -> Interactions::InputDevice - - def add_wheel_input: (String name) -> Interactions::InputDevice - - def device: (?name: String?, ?type: String?) -> Interactions::InputDevice? - - def pointer_inputs: () -> Array[Interactions::InputDevice] - - def key_inputs: () -> Array[Interactions::InputDevice] - - def wheel_inputs: () -> Array[Interactions::InputDevice] - - def pause: (?device: Interactions::InputDevice?, ?duration: Float) -> self - - def pauses: (?device: Interactions::InputDevice?, ?number: Integer?, ?duration: Float) -> self - - def perform: () -> nil - - def clear_all_actions: () -> Array[Selenium::WebDriver::Interactions::InputDevice] - - def release_actions: () -> untyped - - private - - def tick: (*Interactions::InputDevice action_devices) -> Array[Interactions::InputDevice]? - - def add_input: (Interactions::InputDevice | Symbol | interned device) -> Interactions::InputDevice - end - end + def clear_all_actions: () -> Array[untyped] end diff --git a/rb/sig/lib/selenium/webdriver/common/child_process.rbs b/rb/sig/lib/selenium/webdriver/common/child_process.rbs index 69785847b71eb..93dd1e889e760 100644 --- a/rb/sig/lib/selenium/webdriver/common/child_process.rbs +++ b/rb/sig/lib/selenium/webdriver/common/child_process.rbs @@ -1,51 +1,8 @@ -module Selenium - module WebDriver - class ChildProcess - @command: untyped +class Selenium::WebDriver::ChildProcess + def exited?: () -> bool - @detach: untyped + def waitpid2: (Integer, ?Integer) -> nil + | (Integer, ?Integer) -> Array[untyped] - @pid: untyped - - @status: untyped - - @io: untyped - - TimeoutError: untyped - - SIGTERM: String - - SIGKILL: String - - POLL_INTERVAL: Float - - attr_accessor detach: untyped - - attr_writer io: untyped - - def self.build: (*untyped command) -> untyped - - def initialize: (*untyped command) -> void - - def io: () -> untyped - - def start: () -> untyped - - def stop: (?Integer timeout) -> untyped - - def alive?: () -> untyped - - def exited?: () -> (false | untyped) - - def poll_for_exit: (untyped timeout) -> untyped - - def wait: () -> (nil | untyped) - - private - - def terminate: (untyped pid) -> untyped - - def kill: (untyped pid) -> untyped - end - end + def poll_for_exit: (Integer) -> nil end diff --git a/rb/sig/lib/selenium/webdriver/common/driver.rbs b/rb/sig/lib/selenium/webdriver/common/driver.rbs index 8a95acc35109a..77dcc0df7ef1c 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver.rbs @@ -1,81 +1,3 @@ -module Selenium - module WebDriver - class Driver - include SearchContext - - include TakesScreenshot - - @devtools: untyped - @navigate: untyped - - @script: untyped - @service_manager: untyped - - def self.for: (untyped browser, Hash[untyped, untyped] opts) -> untyped - - def initialize: (?bridge: Support::EventFiringBridge? bridge, ?listener: Support::AbstractEventListener? listener, **untyped opts) -> void - - def inspect: () -> String - - def network: -> Network - - def status: () -> Hash[untyped, untyped] - - def navigate: () -> Navigation - - def switch_to: () -> TargetLocator - - def manage: () -> Manager - - def action: (**untyped opts) -> ActionBuilder - - def get: (String url) -> untyped - - def current_url: () -> String - - def title: () -> String - - def page_source: () -> String - - def quit: () -> WebDriver::Remote::Response? - - def close: () -> WebDriver::Remote::Response? - - def window_handles: () -> Array[String] - - def window_handle: () -> String - - def execute_script: (String script, *untyped args) -> untyped - - def execute_async_script: (String script, *untyped args) -> untyped - - def add_virtual_authenticator: (untyped options) -> VirtualAuthenticator - - alias first find_element - - alias all find_elements - - alias script execute_script - - def []: (String | Hash[untyped, untyped] sel) -> Element - - def browser: () -> Symbol - - def capabilities: () -> untyped - - def ref: () -> ::Array[:driver | nil] - - private - - attr_reader bridge: untyped - - def create_bridge: (caps: untyped, url: untyped, ?http_client: untyped) -> untyped - - def service_url: (untyped service) -> untyped - - def screenshot: () -> untyped - - def add_extensions: (String browser) -> void - end - end +class Selenium::WebDriver::Driver + def action: (**untyped) -> Selenium::WebDriver::ActionBuilder end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rbs b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rbs index bd77ff746b2f4..f440dd9bb9408 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rbs @@ -1,13 +1,5 @@ -module Selenium - module WebDriver - module DriverExtensions - module HasNetworkConditions - def network_conditions: () -> untyped +module Selenium::WebDriver::DriverExtensions::HasNetworkConditions + def network_conditions=: (Hash[untyped, untyped]) -> void - def network_conditions=: (untyped conditions) -> untyped - - def delete_network_conditions: () -> untyped - end - end - end + def network_conditions: () -> Hash[untyped, untyped] end diff --git a/rb/sig/lib/selenium/webdriver/common/driver_finder.rbs b/rb/sig/lib/selenium/webdriver/common/driver_finder.rbs index fc17ee073d3ee..5557c7cd750ab 100644 --- a/rb/sig/lib/selenium/webdriver/common/driver_finder.rbs +++ b/rb/sig/lib/selenium/webdriver/common/driver_finder.rbs @@ -1,26 +1,13 @@ -module Selenium - module WebDriver - class DriverFinder - @options: untyped +class Selenium::WebDriver::DriverFinder + def initialize: (Selenium::WebDriver::Chrome::Options, Selenium::WebDriver::Chrome::Service) -> void - @paths: untyped - @service: untyped + def browser_path?: () -> bool - def initialize: (untyped options,untyped service) -> void + def browser_path: () -> String - def self.path: (untyped options, untyped klass) -> untyped + def paths: () -> Hash[untyped, untyped] - def browser_path: -> untyped + def to_args: () -> Array[untyped] - def browser_path?: -> untyped - - def driver_path: -> untyped - - private - - def paths: -> untyped - - def to_args: -> Array[String] - end - end + def driver_path: () -> String end diff --git a/rb/sig/lib/selenium/webdriver/common/element.rbs b/rb/sig/lib/selenium/webdriver/common/element.rbs index 84f27e732d833..b18445478ff2f 100644 --- a/rb/sig/lib/selenium/webdriver/common/element.rbs +++ b/rb/sig/lib/selenium/webdriver/common/element.rbs @@ -1,88 +1,9 @@ -module Selenium - module WebDriver - class Element - ELEMENT_KEY: ::String +class Selenium::WebDriver::Element + def initialize: (Selenium::WebDriver::Remote::Bridge, String) -> void - include SearchContext + def rect: () -> Selenium::WebDriver::Rectangle - include TakesScreenshot + def to_json: (*untyped) -> String - def initialize: (Remote::Bridge | Support::EventFiringBridge bridge, String id) -> void - - def inspect: () -> untyped - - def ==: (untyped other) -> bool - - alias eql? == - - def hash: () -> Integer - - def click: () -> untyped - - def tag_name: () -> untyped - - def attribute: (String | Symbol name) -> String? - - def dom_attribute: (String name) -> String? - - def property: (String name) -> String? - - def aria_role: () -> String - - def accessible_name: () -> String - - def text: () -> String - - def send_keys: (*untyped args) -> untyped - - alias send_key send_keys - - def clear: () -> bool - - def enabled?: () -> bool - - def selected?: () -> bool - - def displayed?: () -> bool - - def submit: () -> untyped - - def css_value: (String prop) -> untyped - - alias style css_value - - def location: () -> WebDriver::Point - - def rect: () -> WebDriver::Rectangle - - def location_once_scrolled_into_view: () -> WebDriver::Point - - def size: () -> WebDriver::Dimension - - def shadow_root: () -> WebDriver::ShadowRoot - - alias first find_element - - alias all find_elements - - # - # element['class'] or element[:class] #=> "someclass" - # - alias [] attribute - - def ref: () -> ::Array[:element | untyped] - - def to_json: () -> untyped - - def as_json: () -> untyped - - private - - attr_reader bridge: Remote::Bridge - - def selectable?: () -> bool - - def screenshot: () -> untyped - end - end + def as_json: (*untyped) -> Hash[untyped, untyped] end diff --git a/rb/sig/lib/selenium/webdriver/common/error.rbs b/rb/sig/lib/selenium/webdriver/common/error.rbs index 224ee6ee29cee..76eca218404a6 100644 --- a/rb/sig/lib/selenium/webdriver/common/error.rbs +++ b/rb/sig/lib/selenium/webdriver/common/error.rbs @@ -1,106 +1,3 @@ -module Selenium - module WebDriver - module Error - def self.for_error: (String? error) -> Class? - - SUPPORT_MSG: String - - ERROR_URL: String - - URLS: Hash[Symbol?, String] - - class WebDriverError < StandardError - def initialize: (?String | Array[String] msg) -> void - - def class_name: -> Symbol? - end - - class NoSuchElementError < WebDriverError - end - - class NoSuchFrameError < WebDriverError - end - - class UnknownCommandError < WebDriverError - end - - class StaleElementReferenceError < WebDriverError - end - - class DetachedShadowRootError < WebDriverError - end - - class InvalidElementStateError < WebDriverError - end - - class UnknownError < WebDriverError - end - - class JavascriptError < WebDriverError - end - - class TimeoutError < WebDriverError - end - - class NoSuchWindowError < WebDriverError - end - - class NoSuchShadowRootError < WebDriverError - end - - class InvalidCookieDomainError < WebDriverError - end - - class UnableToSetCookieError < WebDriverError - end - - class NoSuchAlertError < WebDriverError - end - - class ScriptTimeoutError < WebDriverError - end - - class InvalidSelectorError < WebDriverError - end - - class SessionNotCreatedError < WebDriverError - end - - class MoveTargetOutOfBoundsError < WebDriverError - end - - class ElementNotInteractableError < WebDriverError - end - - class InsecureCertificateError < WebDriverError - end - - class InvalidArgumentError < WebDriverError - end - - class NoSuchCookieError < WebDriverError - end - - class UnableToCaptureScreenError < WebDriverError - end - - class InvalidSessionIdError < WebDriverError - end - - class UnexpectedAlertOpenError < WebDriverError - end - - class UnknownMethodError < WebDriverError - end - - class ElementClickInterceptedError < WebDriverError - end - - class UnsupportedOperationError < WebDriverError - end - - class NoSuchDriverError < WebDriverError - end - end - end +module Selenium::WebDriver::Error + def self.for_error: (nil) -> nil end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/input_device.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/input_device.rbs index 01e8e62c8db42..8ad3ec3ec1bbc 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/input_device.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/input_device.rbs @@ -1,27 +1,9 @@ -module Selenium - module WebDriver - module Interactions - class InputDevice - @name: String +class Selenium::WebDriver::Interactions::InputDevice + def initialize: (?String) -> void - @actions: Array[Interaction] + def add_action: (Selenium::WebDriver::Interactions::Scroll) -> Array[untyped] - attr_reader name: String + def encode: () -> Hash[untyped, untyped] - attr_reader actions: Array[untyped] - - attr_reader type: String - - def initialize: (?String? name) -> void - - def add_action: (Interaction action) -> Array[Interaction] - - def clear_actions: () -> Array[untyped] - - def create_pause: (Float duration) -> Array[Interaction] - - def encode: () -> untyped - end - end - end + def clear_actions: () -> Array[untyped] end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/interaction.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/interaction.rbs index 9ae432c6f7a01..11be071a74863 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/interaction.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/interaction.rbs @@ -1,13 +1,3 @@ -module Selenium - module WebDriver - module Interactions - class Interaction - attr_reader type: untyped - - def initialize: (untyped source) -> void - - def assert_source: (untyped _source) -> untyped - end - end - end +class Selenium::WebDriver::Interactions::Interaction + def initialize: (Selenium::WebDriver::Interactions::WheelInput) -> void end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/interactions.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/interactions.rbs index 6268f4f803fd2..31dfa18daab4a 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/interactions.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/interactions.rbs @@ -1,27 +1,3 @@ -module Selenium - module WebDriver - module Interactions - KEY: Symbol - - POINTER: Symbol - - NONE: Symbol - - WHEEL: Symbol - - def self.key: (?untyped? name) -> untyped - - def self.pointer: (?Symbol kind, ?name: untyped?) -> untyped - - def self.mouse: (?name: untyped?) -> untyped - - def self.pen: (?name: untyped?) -> untyped - - def self.touch: (?name: untyped?) -> untyped - - def self.none: (?untyped? name) -> untyped - - def self.wheel: (?untyped? name) -> untyped - end - end +module Selenium::WebDriver::Interactions + def self.wheel: (?String) -> Selenium::WebDriver::Interactions::WheelInput end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/scroll.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/scroll.rbs index 2bae225339d54..deab49bc0b65d 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/scroll.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/scroll.rbs @@ -1,27 +1,7 @@ -module Selenium - module WebDriver - module Interactions - class Scroll < Interaction - @type: untyped +class Selenium::WebDriver::Interactions::Scroll + def initialize: (source: Selenium::WebDriver::Interactions::WheelInput, ?origin: Symbol, ?duration: Float, **Integer) -> void - @duration: untyped + def assert_source: (Selenium::WebDriver::Interactions::WheelInput) -> nil - @origin: untyped - - @x_offset: untyped - - @y_offset: untyped - - @delta_x: untyped - - @delta_y: untyped - - def initialize: (source: untyped, ?origin: Symbol, ?duration: Float, **untyped opts) -> void - - def assert_source: (untyped source) -> untyped? - - def encode: () -> Hash[String, untyped] - end - end - end + def encode: () -> Hash[untyped, untyped] end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/wheel_actions.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/wheel_actions.rbs index 91128affcc9f3..1982ac1108ae3 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/wheel_actions.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/wheel_actions.rbs @@ -1,26 +1,9 @@ -module Selenium - module WebDriver - module WheelActions - include _ActionBuilder - include _Driver +module Selenium::WebDriver::WheelActions + def scroll_by: (Integer, Integer, ?device: nil) -> Selenium::WebDriver::ActionBuilder - @default_scroll_duration: untyped + def scroll: (**Integer?) -> Selenium::WebDriver::ActionBuilder - attr_writer default_scroll_duration: untyped + def default_scroll_duration: () -> Float - def default_scroll_duration: () -> untyped - - def scroll_to: (untyped element, ?device: untyped?) -> untyped - - def scroll_by: (untyped delta_x, untyped delta_y, ?device: untyped?) -> untyped - - def scroll_from: (untyped scroll_origin, untyped delta_x, untyped delta_y, ?device: untyped?) -> untyped - - private - - def scroll: (**untyped opts) -> self - - def wheel_input: (?untyped? name) -> untyped - end - end + def wheel_input: (?nil) -> Selenium::WebDriver::Interactions::WheelInput end diff --git a/rb/sig/lib/selenium/webdriver/common/interactions/wheel_input.rbs b/rb/sig/lib/selenium/webdriver/common/interactions/wheel_input.rbs index f63726dc643d7..7f9c247ceabef 100644 --- a/rb/sig/lib/selenium/webdriver/common/interactions/wheel_input.rbs +++ b/rb/sig/lib/selenium/webdriver/common/interactions/wheel_input.rbs @@ -1,13 +1,5 @@ -module Selenium - module WebDriver - module Interactions - class WheelInput < InputDevice - @type: untyped +class Selenium::WebDriver::Interactions::WheelInput + def initialize: (?String) -> void - def initialize: (?untyped? name) -> void - - def create_scroll: (**untyped opts) -> untyped - end - end - end + def create_scroll: (**Integer | Float) -> void end diff --git a/rb/sig/lib/selenium/webdriver/common/local_driver.rbs b/rb/sig/lib/selenium/webdriver/common/local_driver.rbs index ef1ac98c8feb9..9a04a38a983da 100644 --- a/rb/sig/lib/selenium/webdriver/common/local_driver.rbs +++ b/rb/sig/lib/selenium/webdriver/common/local_driver.rbs @@ -1,11 +1,5 @@ -module Selenium - module WebDriver - module LocalDriver - include _Driver +module Selenium::WebDriver::LocalDriver + def initialize_local_driver: (Selenium::WebDriver::Chrome::Options, Selenium::WebDriver::Chrome::Service, nil) -> Array[untyped] - def initialize_local_driver: (untyped options, untyped service, untyped url) -> Array[untyped] - - def process_options: (untyped options, untyped service) -> untyped - end - end + def process_options: (Selenium::WebDriver::Chrome::Options, Selenium::WebDriver::Chrome::Service) -> Hash[untyped, untyped] end diff --git a/rb/sig/lib/selenium/webdriver/common/logger.rbs b/rb/sig/lib/selenium/webdriver/common/logger.rbs index 69a167e4b9276..81529b6b36654 100644 --- a/rb/sig/lib/selenium/webdriver/common/logger.rbs +++ b/rb/sig/lib/selenium/webdriver/common/logger.rbs @@ -1,42 +1,5 @@ -module Selenium - module WebDriver - class Logger +class Selenium::WebDriver::Logger + def debug: (String, ?id: Array[untyped]) -> nil - @allowed: Array[Symbol] - @first_warning: bool - - @ignored: Array[Symbol] - @logger: ::Logger - - def initialize: (?::String progname, ?default_level: Symbol? default_level, ?ignored: Array[Symbol]? ignored, ?allowed: Array[Symbol]? allowed) -> void - - def level=: (Symbol level) -> Symbol - - def output=: (String io) -> ::Logger - - def io: () -> IO - - def ignore: (*Symbol | Array[Symbol] ids) -> Array[Symbol] - - def allow: (*Symbol | Array[Symbol] ids) -> Array[Symbol] - - def debug: (String ?message, ?id: Symbol | Array[Symbol] id) ?{ () -> void } -> void - - def info: (String message, ?id: Symbol | Array[Symbol] id) ?{ () -> void } -> void - - def error: (String message, ?id: Symbol | Array[Symbol] id) ?{ () -> void } -> void - - def warn: (String message, ?id: Symbol | Array[Symbol] id) ?{ () -> void } -> void - - def deprecate: (String old, ?String? new, ?id: Symbol | Array[Symbol] id, ?reference: String reference) ?{ () -> void } -> untyped - - def debug?: () -> bool - - private - - def create_logger: (String name, level: Symbol level) -> ::Logger - - def discard_or_log: (Symbol level, String message, (Symbol | Array[::Symbol]) | [(Symbol | Array[Symbol])] id) ?{ () -> void } -> untyped - end - end + def discard_or_log: (Symbol, String, Array[untyped]) -> nil end diff --git a/rb/sig/lib/selenium/webdriver/common/navigation.rbs b/rb/sig/lib/selenium/webdriver/common/navigation.rbs index 4c31e52a3fe7c..f515c6e98b6b5 100644 --- a/rb/sig/lib/selenium/webdriver/common/navigation.rbs +++ b/rb/sig/lib/selenium/webdriver/common/navigation.rbs @@ -1,15 +1,5 @@ -module Selenium - module WebDriver - class Navigation - def initialize: (untyped bridge) -> void +class Selenium::WebDriver::Navigation + def initialize: (Selenium::WebDriver::Remote::Bridge) -> void - def to: (String url) -> untyped - - def back: () -> untyped - - def forward: () -> untyped - - def refresh: () -> untyped - end - end + def to: (String) -> void end diff --git a/rb/sig/lib/selenium/webdriver/common/options.rbs b/rb/sig/lib/selenium/webdriver/common/options.rbs index d2fe0ccd30b20..f70f77a92d198 100644 --- a/rb/sig/lib/selenium/webdriver/common/options.rbs +++ b/rb/sig/lib/selenium/webdriver/common/options.rbs @@ -1,66 +1,40 @@ -module Selenium - module WebDriver - class Options - @options: Hash[untyped, untyped] +class Selenium::WebDriver::Options + def self.chrome: (**Array[untyped]) -> Selenium::WebDriver::Chrome::Options + | (**nil) -> Selenium::WebDriver::Chrome::Options - W3C_OPTIONS: Array[Symbol] + def initialize: (**Array[untyped]) -> void + | (**nil) -> void - GRID_OPTIONS: Array[Symbol] + def as_json: (*untyped) -> Hash[untyped, untyped] - BROWSER: Symbol + def process_w3c_options: (Hash[untyped, untyped]) -> Hash[untyped, untyped] - KEY: untyped + def w3c?: (Symbol) -> bool - CAPABILITIES: Hash[String | Symbol, String | Numeric | bool?] + def generate_as_json: (String, ?camelize_keys: bool) -> String + | (Array[untyped], ?camelize_keys: bool) -> Array[untyped] + | (Hash[untyped, untyped], ?camelize_keys: bool) -> Hash[untyped, untyped] - attr_reader self.driver_path: String + def process_json_hash: (Hash[untyped, untyped], bool) -> Hash[untyped, untyped] - def self.chrome: (**String | Symbol | Integer | bool opts) -> Chrome::Options + def convert_json_key: (Symbol, ?camelize: bool) -> String + | (String, ?camelize: bool) -> String - def self.firefox: (**String | Symbol | Integer | bool opts) -> Firefox::Options - - def self.ie: (**String | Symbol | Integer | bool opts) -> IE::Options - - alias self.internet_explorer self.ie - - def self.edge: (**String | Symbol | Integer | bool opts) -> Edge::Options - - alias self.microsoftedge self.edge - - def self.safari: (**String | Symbol | Integer | bool opts) -> Safari::Options - - def self.set_capabilities: () -> untyped - - attr_accessor options: Hash[String | Symbol, String | Numeric | bool?] - - def initialize: (Hash[String | Symbol, String | Numeric | bool] opts) -> void - - def add_option: (String | Symbol name, String | Numeric | bool? value) -> (String | Numeric | bool)? - - def ==: (untyped other) -> bool - - alias eql? == - - def as_json: (*untyped) -> untyped - - private - - def w3c?: (untyped key) -> untyped + def camel_case: (String) -> String +end - def process_w3c_options: (untyped options) -> untyped +class Selenium::WebDriver::Chrome::Options + def self.set_capabilities: () -> void - def process_browser_options: (untyped _browser_options) -> nil + def browser_name: () -> String - def camelize?: (untyped _key) -> true + def browser_version: () -> nil - def generate_as_json: (Array[untyped] | Hash[untyped, untyped] | String | Symbol value, ?camelize_keys: bool) - -> (Array[untyped] | Hash[untyped, untyped] | String | Symbol) + def binary: () -> nil - def process_json_hash: (Hash[untyped, untyped] value, bool camelize_keys) -> Hash[untyped, untyped] + def proxy: () -> nil - def convert_json_key: (String | Symbol key, camelize: bool) -> String + def binary=: (String) -> String - def camel_case: (String str) -> String - end - end + def browser_version=: (nil) -> nil end diff --git a/rb/sig/lib/selenium/webdriver/common/platform.rbs b/rb/sig/lib/selenium/webdriver/common/platform.rbs index 294c6a5110aec..5d49d3a16b2ff 100644 --- a/rb/sig/lib/selenium/webdriver/common/platform.rbs +++ b/rb/sig/lib/selenium/webdriver/common/platform.rbs @@ -1,62 +1,5 @@ -module Selenium - module WebDriver - # @api private - module Platform - @home: untyped +module Selenium::WebDriver::Platform + def self.ci: () -> nil - @engine: untyped - - @os: untyped - - def self?.home: () -> untyped - - def self?.engine: () -> untyped - - def self?.os: () -> untyped - - def self?.ci: () -> Symbol? - - def self?.jruby?: () -> untyped - - def self?.truffleruby?: () -> untyped - - def self?.ruby_version: () -> untyped - - def self?.windows?: () -> untyped - - def self?.mac?: () -> untyped - - def self?.linux?: () -> untyped - - def self?.wsl?: () -> untyped - - def self?.cygwin?: () -> untyped - - def self?.null_device: () -> untyped - - def self?.wrap_in_quotes_if_necessary: (untyped str) -> (String | untyped) - - def self?.cygwin_path: (untyped path, **untyped opts) -> untyped - - def self?.unix_path: (untyped path) -> untyped - - def self?.windows_path: (untyped path) -> untyped - - def self?.make_writable: (untyped file) -> untyped - - def self?.assert_file: (untyped path) -> untyped? - - def self?.assert_executable: (untyped path) -> untyped? - - def self?.exit_hook: () { () -> untyped } -> untyped - - def self?.localhost: () -> untyped - - def self?.ip: () -> untyped - - def self?.interfaces: () -> untyped - - def unix?: -> untyped - end - end + def self.os: () -> Symbol end diff --git a/rb/sig/lib/selenium/webdriver/common/port_prober.rbs b/rb/sig/lib/selenium/webdriver/common/port_prober.rbs index 1d45cd15321d7..72325d8b1fc06 100644 --- a/rb/sig/lib/selenium/webdriver/common/port_prober.rbs +++ b/rb/sig/lib/selenium/webdriver/common/port_prober.rbs @@ -1,11 +1,5 @@ -module Selenium - module WebDriver - class PortProber - def self.above: (untyped port) -> untyped +class Selenium::WebDriver::PortProber + def self.above: (Integer) -> Integer - IGNORED_ERRORS: untyped - - def self.free?: (untyped port) -> untyped - end - end + def self.free?: (Integer) -> bool end diff --git a/rb/sig/lib/selenium/webdriver/common/search_context.rbs b/rb/sig/lib/selenium/webdriver/common/search_context.rbs index c240e68d5ce5b..7b05122a09f53 100644 --- a/rb/sig/lib/selenium/webdriver/common/search_context.rbs +++ b/rb/sig/lib/selenium/webdriver/common/search_context.rbs @@ -1,21 +1,7 @@ -module Selenium - module WebDriver - module SearchContext - include _Driver +module Selenium::WebDriver::SearchContext + def find_element: (*Hash[untyped, untyped]) -> Selenium::WebDriver::Element - FINDERS: untyped + def extract_args: (Array[untyped]) -> Array[untyped] - attr_accessor self.extra_finders: untyped - - def self.finders: -> untyped - - def find_element: (*untyped args) -> untyped - - def find_elements: (*untyped args) -> untyped - - private - - def extract_args: (untyped args) -> untyped - end - end + def self.finders: () -> Hash[untyped, untyped] end diff --git a/rb/sig/lib/selenium/webdriver/common/selenium_manager.rbs b/rb/sig/lib/selenium/webdriver/common/selenium_manager.rbs index c73ec88f61487..d4b09720f95df 100644 --- a/rb/sig/lib/selenium/webdriver/common/selenium_manager.rbs +++ b/rb/sig/lib/selenium/webdriver/common/selenium_manager.rbs @@ -1,30 +1,13 @@ -module Selenium - module WebDriver - class SeleniumManager - include _Platform - include Open3 +class Selenium::WebDriver::SeleniumManager + def self.binary_paths: (*String) -> Hash[untyped, untyped] - self.@bin_path: String + def self.binary: () -> String - self.@binary: String + def self.run: (*String) -> Hash[untyped, untyped] - attr_writer self.bin_path: String + def self.execute_command: (*String) -> Array[untyped] - def self.bin_path: () -> String + def self.parse_result_and_log: (String) -> Hash[untyped, untyped] - def self.binary_paths: (*String arguments) -> Hash[untyped, Array[String]] - - private - - def self.generate_command: (untyped binary, untyped options) -> untyped - - def self.binary: () -> String - - def self.validate_location: (untyped location) -> untyped - - def self.run: (String | Array[String] command) -> Hash[String, Array[String]] - - def self.platform_location: -> String - end - end + def self.validate_command_result: (Array[untyped], Process::Status, Hash[untyped, untyped], String) -> void end diff --git a/rb/sig/lib/selenium/webdriver/common/service.rbs b/rb/sig/lib/selenium/webdriver/common/service.rbs index da5a793919e55..8035a051e31ce 100644 --- a/rb/sig/lib/selenium/webdriver/common/service.rbs +++ b/rb/sig/lib/selenium/webdriver/common/service.rbs @@ -1,65 +1,11 @@ -module Selenium - module WebDriver - class Service - SHUTDOWN_SUPPORTED: untyped +class Selenium::WebDriver::Service + def self.chrome: (**nil) -> Selenium::WebDriver::Chrome::Service - DEFAULT_PORT: untyped + def initialize: (?path: nil, ?port: nil, ?log: nil, ?args: nil) -> void - DRIVER_PATH_ENV_KEY: String + def env_path: () -> nil - self.@driver_path: untyped + def launch: () -> Selenium::WebDriver::ServiceManager - @executable_path: untyped - - @host: untyped - - @port: untyped - - @log: untyped - - @args: untyped - - attr_reader self.driver_path: untyped - - def self.chrome: (**untyped opts) -> untyped - - def self.firefox: (**untyped opts) -> untyped - - def self.ie: (**untyped opts) -> untyped - - alias self.internet_explorer self.ie - - def self.edge: (**untyped opts) -> untyped - - alias self.microsoftedge self.edge - - alias self.msedge self.edge - - def self.safari: (**untyped opts) -> untyped - - def self.driver_path=: (untyped path) -> untyped - - attr_accessor host: untyped - - attr_accessor executable_path: untyped - - attr_accessor port: untyped - - attr_accessor log: untyped - - attr_accessor args: untyped - - def env_path: -> String? - - alias extra_args args - - def initialize: (?path: untyped?, ?port: untyped?, ?log: untyped?, ?args: untyped?) -> void - - def find_driver_path: -> untyped - - def launch: () -> untyped - - def shutdown_supported: () -> untyped - end - end + def shutdown_supported: () -> bool end diff --git a/rb/sig/lib/selenium/webdriver/common/service_manager.rbs b/rb/sig/lib/selenium/webdriver/common/service_manager.rbs index d677aa1e58fdc..e0474f27e3ef9 100644 --- a/rb/sig/lib/selenium/webdriver/common/service_manager.rbs +++ b/rb/sig/lib/selenium/webdriver/common/service_manager.rbs @@ -1,61 +1,11 @@ -module Selenium - module WebDriver - class ServiceManager - @executable_path: untyped +class Selenium::WebDriver::ServiceManager + def stop: () -> void - @host: untyped + def process_exited?: () -> bool - @port: untyped + def stop_server: () -> void - @io: untyped + def connect_to_server: () -> Net::HTTPOK - @extra_args: untyped - - @shutdown_supported: untyped - - @uri: untyped - - @process: untyped - - @socket_lock: untyped - - START_TIMEOUT: Integer - - SOCKET_LOCK_TIMEOUT: Integer - - STOP_TIMEOUT: Integer - - def initialize: (untyped config) -> void - - def start: () -> untyped - - def stop: () -> untyped - - def uri: () -> untyped - - private - - def build_process: (*untyped command) -> untyped - - def connect_to_server: () { (untyped) -> untyped } -> untyped - - def find_free_port: () -> untyped - - def start_process: () -> untyped - - def stop_process: () -> (nil | untyped) - - def stop_server: () -> untyped - - def process_running?: () -> untyped - - def process_exited?: () -> untyped - - def connect_until_stable: () -> untyped? - - def cannot_connect_error_text: () -> String - - def socket_lock: () -> untyped - end - end + def stop_process: () -> nil end diff --git a/rb/sig/lib/selenium/webdriver/common/socket_lock.rbs b/rb/sig/lib/selenium/webdriver/common/socket_lock.rbs index 4a806f52f805e..73f5bc3718a3b 100644 --- a/rb/sig/lib/selenium/webdriver/common/socket_lock.rbs +++ b/rb/sig/lib/selenium/webdriver/common/socket_lock.rbs @@ -1,27 +1,15 @@ -module Selenium - module WebDriver - class SocketLock - @port: untyped +class Selenium::WebDriver::SocketLock + def initialize: (Integer, Integer) -> void - @server: untyped + def locked: () -> nil - @timeout: untyped + def lock: () -> void - def initialize: (untyped port, untyped timeout) -> void + def current_time: () -> Float - def locked: () { () -> untyped } -> untyped + def can_lock?: () -> bool - private + def did_lock?: () -> bool - def lock: () -> untyped? - - def current_time: () -> untyped - - def release: () -> untyped - - def can_lock?: () -> untyped - - def did_lock?: () -> untyped - end - end + def release: () -> nil end diff --git a/rb/sig/lib/selenium/webdriver/common/socket_poller.rbs b/rb/sig/lib/selenium/webdriver/common/socket_poller.rbs index 631b443064a31..5cf8885cf5554 100644 --- a/rb/sig/lib/selenium/webdriver/common/socket_poller.rbs +++ b/rb/sig/lib/selenium/webdriver/common/socket_poller.rbs @@ -1,37 +1,15 @@ -module Selenium - module WebDriver - class SocketPoller - @host: untyped +class Selenium::WebDriver::SocketPoller + def initialize: (String, Integer, ?Integer, ?Float) -> void - @port: untyped + def connected?: () -> bool - @timeout: untyped + def with_timeout: () -> bool - @interval: untyped + def current_time: () -> Float - def initialize: (untyped host, untyped port, ?::Integer timeout, ?::Float interval) -> void + def listening?: () -> bool - def connected?: () -> untyped + def socket_writable?: (Socket) -> Socket - def closed?: () -> untyped - - private - - CONNECT_TIMEOUT: Integer - - NOT_CONNECTED_ERRORS: Array[singleton(::Errno::ECONNREFUSED) | singleton(::Errno::ENOTCONN) | singleton(::Errno::EPERM)] - - CONNECTED_ERRORS: Array[singleton(::Errno::EISCONN) | singleton(::Errno::EINVAL) | singleton(::Errno::EALREADY)] - - def listening?: () -> untyped - - def socket_writable?: (untyped sock) -> untyped - - def conn_completed?: (untyped sock) -> untyped - - def with_timeout: () { () -> untyped } -> bool - - def current_time: () -> untyped - end - end + def conn_completed?: (Socket) -> bool end diff --git a/rb/sig/lib/selenium/webdriver/common/wait.rbs b/rb/sig/lib/selenium/webdriver/common/wait.rbs index 1e1c888a9edf2..d913d54dda531 100644 --- a/rb/sig/lib/selenium/webdriver/common/wait.rbs +++ b/rb/sig/lib/selenium/webdriver/common/wait.rbs @@ -1,25 +1,7 @@ -module Selenium - module WebDriver - class Wait - @timeout: Numeric +class Selenium::WebDriver::Wait + def initialize: (?Hash[untyped, untyped]) -> void - @interval: Numeric + def until: () -> Selenium::WebDriver::FedCM::Dialog - @message: String - - @ignored: Array[Exception] - - DEFAULT_TIMEOUT: Integer - - DEFAULT_INTERVAL: Float - - def initialize: (Hash[untyped, untyped] opts) -> void - - def until: () { () -> untyped } -> untyped - - private - - def current_time: () -> untyped - end - end + def current_time: () -> Float end diff --git a/rb/sig/lib/selenium/webdriver/firefox/features.rbs b/rb/sig/lib/selenium/webdriver/firefox/features.rbs index c8d12b93d50c1..c7d5b0c3df929 100644 --- a/rb/sig/lib/selenium/webdriver/firefox/features.rbs +++ b/rb/sig/lib/selenium/webdriver/firefox/features.rbs @@ -1,25 +1,5 @@ -module Selenium - module WebDriver - module Firefox - module Features - include _Bridge - COMMANDS: Hash[Symbol, Array[Symbol | String]] - FIREFOX_COMMANDS: Hash[Symbol, Array[Symbol | String]] +module Selenium::WebDriver::Firefox::Features + def commands: (Symbol) -> Array[untyped] - def command_list: -> untyped - - def commands: (untyped command) -> untyped - - def install_addon: (untyped path, untyped temporary) -> untyped - - def uninstall_addon: (untyped id) -> untyped - - def full_screenshot: () -> untyped - - def context=: (untyped context) -> untyped - - def context: () -> untyped - end - end - end + def command_list: () -> Hash[untyped, untyped] end diff --git a/rb/sig/lib/selenium/webdriver/remote/bridge.rbs b/rb/sig/lib/selenium/webdriver/remote/bridge.rbs index 8da1a8dac805d..e908c8ae1f27b 100644 --- a/rb/sig/lib/selenium/webdriver/remote/bridge.rbs +++ b/rb/sig/lib/selenium/webdriver/remote/bridge.rbs @@ -1,277 +1,3 @@ -module Selenium - module WebDriver - module Remote - class Bridge - include _CommandList - include _Features - - @bidi: WebDriver::BiDi - @http: untyped - - @file_detector: untyped - - @session_id: untyped - - @capabilities: untyped - - @browser: untyped - - @manage: untyped - - @escaper: untyped - - include Atoms - - PORT: Integer - - attr_accessor http: untyped - - attr_accessor file_detector: untyped - - attr_reader capabilities: untyped - - def initialize: (url: String | URI, ?http_client: untyped?) -> void - - def bidi: -> WebDriver::Error::WebDriverError - - def cancel_fedcm_dialog: -> nil - - def click_fedcm_dialog_button: -> nil - - def create_session: (untyped capabilities) -> untyped - - extend WebDriver::Chrome::Features - - extend WebDriver::Firefox::Features - - extend WebDriver::Edge::Features - - extend WebDriver::Safari::Features - - def fedcm_account_list: -> Array[Hash[untyped, untyped]] - - def fedcm_dialog_type: -> String - - def fedcm_subtitle: -> String? - - def fedcm_title: -> String - - def reset_fedcm_cooldown: -> nil - - def select_fedcm_account: (Integer index) -> nil - - def session_id: () -> untyped - - def browser: () -> untyped - - def fedcm_delay: -> bool - - def status: () -> untyped - - def get: (untyped url) -> untyped - - def timeouts: () -> untyped - - def timeouts=: (untyped timeouts) -> untyped - - def accept_alert: () -> untyped - - def dismiss_alert: () -> untyped - - def alert=: (untyped keys) -> untyped - - def alert_text: () -> untyped - - def go_back: () -> untyped - - def go_forward: () -> untyped - - def url: () -> untyped - - def title: () -> untyped - - def page_source: () -> untyped - - def new_window: (untyped type) -> untyped - - def switch_to_window: (untyped name) -> untyped - - def switch_to_frame: (untyped id) -> untyped - - def switch_to_parent_frame: () -> untyped - - def switch_to_default_content: () -> untyped - - QUIT_ERRORS: ::Array[untyped] - - def quit: () -> untyped - - def close: () -> untyped - - def refresh: () -> untyped - - def window_handles: () -> untyped - - def window_handle: () -> untyped - - def resize_window: (untyped width, untyped height, ?::Symbol handle) -> untyped - - def window_size: (?::Symbol handle) -> untyped - - def minimize_window: () -> untyped - - def maximize_window: (?::Symbol handle) -> untyped - - def full_screen_window: () -> untyped - - def reposition_window: (untyped x, untyped y) -> untyped - - def window_position: () -> untyped - - def set_window_rect: (?x: untyped?, ?y: untyped?, ?width: untyped?, ?height: untyped?) -> untyped - - def window_rect: () -> untyped - - def screenshot: () -> untyped - - def element_screenshot: (untyped element) -> untyped - - def local_storage_item: (untyped key, ?untyped? value) -> untyped - - def remove_local_storage_item: (untyped key) -> untyped - - def local_storage_keys: () -> untyped - - def clear_local_storage: () -> untyped - - def local_storage_size: () -> untyped - - def session_storage_item: (untyped key, ?untyped? value) -> untyped - - def remove_session_storage_item: (untyped key) -> untyped - - def session_storage_keys: () -> untyped - - def clear_session_storage: () -> untyped - - def session_storage_size: () -> untyped - - def execute_script: (untyped script, *untyped args) -> untyped - - def execute_async_script: (untyped script, *untyped args) -> untyped - - def manage: () -> untyped - - def add_cookie: (untyped cookie) -> untyped - - def delete_cookie: (untyped name) -> untyped - - def cookie: (untyped name) -> untyped - - def cookies: () -> untyped - - def delete_all_cookies: () -> untyped - - def action: (?async: bool, ?devices: untyped, ?duration: ::Integer) -> untyped - - alias actions action - - def send_actions: (untyped data) -> untyped - - def release_actions: () -> untyped - - def print_page: (?::Hash[untyped, untyped] options) -> untyped - - def click_element: (untyped element) -> untyped - - def send_keys_to_element: (untyped element, untyped keys) -> untyped - - def upload: (untyped local_file) -> untyped - - def clear_element: (untyped element) -> untyped - - def submit_element: (untyped element) -> untyped - - def element_tag_name: (untyped element) -> untyped - - def element_attribute: (untyped element, untyped name) -> untyped - - def element_dom_attribute: (untyped element, untyped name) -> untyped - - def element_property: (untyped element, untyped name) -> untyped - - def element_aria_role: (untyped element) -> untyped - - def element_aria_label: (untyped element) -> untyped - - def element_value: (untyped element) -> untyped - - def element_text: (untyped element) -> untyped - - def element_location: (untyped element) -> untyped - - def element_rect: (untyped element) -> untyped - - def element_location_once_scrolled_into_view: (untyped element) -> untyped - - def element_size: (untyped element) -> untyped - - def element_enabled?: (untyped element) -> untyped - - def element_selected?: (untyped element) -> untyped - - def element_displayed?: (untyped element) -> untyped - - def element_value_of_css_property: (untyped element, untyped prop) -> untyped - - def active_element: () -> untyped - - alias switch_to_active_element active_element - - def find_element_by: (untyped how, untyped what, ?untyped parent_ref) -> untyped - - def find_elements_by: (untyped how, untyped what, ?untyped parent_ref) -> untyped - - def shadow_root: (untyped element) -> untyped - - def add_virtual_authenticator: (untyped options) -> untyped - - def remove_virtual_authenticator: (untyped id) -> untyped - - def add_credential: (untyped credential, untyped id) -> untyped - - def credentials: (untyped authenticator_id) -> untyped - - def remove_credential: (untyped credential_id, untyped authenticator_id) -> untyped - - def remove_all_credentials: (untyped authenticator_id) -> untyped - - def user_verified: (untyped verified, untyped authenticator_id) -> untyped - - private - - def execute: (untyped command, ?::Hash[untyped, untyped] opts, ?untyped? command_hash) -> String - - def escaper: () -> untyped - - def commands: (untyped command) -> untyped - - def unwrap_script_result: (untyped arg) -> untyped - - def element_id_from: (untyped id) -> untyped - - def shadow_root_id_from: (untyped id) -> untyped - - def prepare_capabilities_payload: (untyped capabilities) -> { capabilities: untyped } - - def convert_locator: (untyped how, untyped what) -> ::Array[untyped] - - ESCAPE_CSS_REGEXP: ::Regexp - - UNICODE_CODE_POINT: 30 - - def escape_css: (untyped string) -> untyped - end - end - end +class Selenium::WebDriver::Remote::Bridge + def action: (?async: bool, ?devices: Array[untyped], ?duration: Integer) -> Selenium::WebDriver::ActionBuilder end diff --git a/rb/sig/lib/selenium/webdriver/remote/bridge/locator_converter.rbs b/rb/sig/lib/selenium/webdriver/remote/bridge/locator_converter.rbs index 3e2b15b82b84a..b2c5e66383072 100644 --- a/rb/sig/lib/selenium/webdriver/remote/bridge/locator_converter.rbs +++ b/rb/sig/lib/selenium/webdriver/remote/bridge/locator_converter.rbs @@ -1,19 +1,3 @@ -module Selenium - module WebDriver - module Remote - class Bridge - class LocatorConverter - ESCAPE_CSS_REGEXP: Regexp - - UNICODE_CODE_POINT: Integer - - def convert: (String | Symbol how, String what) -> Array[String] - - private - - def escape_css: (String string) -> String - end - end - end - end +class Selenium::WebDriver::Remote::Bridge::LocatorConverter + def convert: (String, String) -> Array[untyped] end diff --git a/rb/sig/lib/selenium/webdriver/remote/capabilities.rbs b/rb/sig/lib/selenium/webdriver/remote/capabilities.rbs index d562c1ee76dc1..064252edfb95e 100644 --- a/rb/sig/lib/selenium/webdriver/remote/capabilities.rbs +++ b/rb/sig/lib/selenium/webdriver/remote/capabilities.rbs @@ -1,71 +1,26 @@ -module Selenium - module WebDriver - module Remote - class Capabilities - @capabilities: untyped +class Selenium::WebDriver::Remote::Capabilities + def self.json_create: (Hash[untyped, untyped]) -> Selenium::WebDriver::Remote::Capabilities - KNOWN: Array[Symbol] + def initialize: (?Hash[untyped, untyped]) -> void - def self.always_match: (untyped capabilities) -> untyped + def self.process_timeouts: (Selenium::WebDriver::Remote::Capabilities, Hash[untyped, untyped]) -> void - def self.first_match: (*untyped capabilities) -> untyped + def implicit_timeout=: (Integer) -> void - def self.json_create: (untyped data) -> untyped + def timeouts: () -> Hash[untyped, untyped] - def self.camel_case: (untyped str_or_sym) -> untyped + def page_load_timeout=: (Integer) -> void - private + def script_timeout=: (Integer) -> Integer - def self.process_timeouts: (untyped caps, untyped timeouts) -> untyped? + def self.camel_case: (Symbol) -> String - public + def []=: (Symbol, String) -> String + | (Symbol, bool) -> bool - def initialize: (?::Hash[untyped, untyped] opts) -> void + def merge!: (Hash[untyped, untyped]) -> void - def []=: (untyped key, untyped value) -> untyped + def []: (Symbol) -> String - def []: (untyped key) -> untyped - - def merge!: (untyped other) -> untyped - - def proxy: () -> untyped - - def proxy=: (untyped proxy) -> untyped - - def timeouts: () -> untyped - - def timeouts=: (untyped timeouts) -> untyped - - def implicit_timeout: () -> untyped - - def implicit_timeout=: (untyped timeout) -> untyped - - def page_load_timeout: () -> untyped - - def page_load_timeout=: (untyped timeout) -> untyped - - def script_timeout: () -> untyped - - def script_timeout=: (untyped timeout) -> untyped - - def as_json: (*untyped) -> untyped - - def to_json: (*untyped) -> untyped - - def ==: (untyped other) -> (bool | untyped) - - alias eql? == - - attr_reader capabilities: untyped - - private - - def process_capabilities: (untyped key, untyped value, untyped hash) -> untyped - - def convert_key: (untyped key) -> untyped - - def convert_value: (untyped key, untyped value) -> untyped - end - end - end + def browser_name: () -> String end diff --git a/rb/sig/lib/selenium/webdriver/remote/http/common.rbs b/rb/sig/lib/selenium/webdriver/remote/http/common.rbs index dfafbbf8456bf..b4408d9f4f6e3 100644 --- a/rb/sig/lib/selenium/webdriver/remote/http/common.rbs +++ b/rb/sig/lib/selenium/webdriver/remote/http/common.rbs @@ -1,41 +1,10 @@ -module Selenium - module WebDriver - module Remote - module Http - class Common - MAX_REDIRECTS: Integer +class Selenium::WebDriver::Remote::Http::Common + def call: (Symbol, String, Hash[untyped, untyped]) -> Selenium::WebDriver::Remote::Response + | (Symbol, String, nil) -> Selenium::WebDriver::Remote::Response - CONTENT_TYPE: String + def server_url: () -> URI::HTTP - DEFAULT_HEADERS: Hash[String, untyped] + def common_headers: () -> Hash[untyped, untyped] - @common_headers: Hash[String, untyped] - - attr_accessor self.extra_headers: Hash[String, untyped] - - attr_writer self.user_agent: String - - def self.user_agent: -> String - - attr_writer server_url: String - - def quit_errors: () -> Array[untyped] - - def close: () -> nil - - def call: (untyped verb, untyped url, untyped command_hash) -> untyped - - private - - def common_headers: -> Hash[String, untyped] - - def server_url: () -> String - - def request: (*untyped) -> untyped - - def create_response: (Integer code, Hash[String, untyped] body, String content_type) -> Remote::Response - end - end - end - end + def create_response: (String, String, String) -> Selenium::WebDriver::Remote::Response end diff --git a/rb/sig/lib/selenium/webdriver/remote/http/default.rbs b/rb/sig/lib/selenium/webdriver/remote/http/default.rbs index 7fb7a41c9ac7a..f31549bebec0a 100644 --- a/rb/sig/lib/selenium/webdriver/remote/http/default.rbs +++ b/rb/sig/lib/selenium/webdriver/remote/http/default.rbs @@ -1,48 +1,12 @@ -module Selenium - module WebDriver - module Remote - module Http - # @api private - class Default < Common - @open_timeout: untyped +class Selenium::WebDriver::Remote::Http::Default + def request: (Symbol, URI::HTTP, Hash[untyped, untyped], String, ?Integer) -> Selenium::WebDriver::Remote::Response + | (Symbol, URI::HTTP, Hash[untyped, untyped], nil, ?Integer) -> Selenium::WebDriver::Remote::Response - @read_timeout: untyped + def new_request_for: (Symbol, URI::HTTP, Hash[untyped, untyped], String) -> Net::HTTP::Post + | (Symbol, URI::HTTP, Hash[untyped, untyped], nil) -> Net::HTTP::Get - @http: untyped + def response_for: (Net::HTTP::Post) -> Net::HTTPOK + | (Net::HTTP::Get) -> Net::HTTPOK - @proxy: untyped - - attr_writer proxy: untyped - - attr_accessor open_timeout: untyped - - attr_accessor read_timeout: untyped - - def initialize: (?open_timeout: untyped?, ?read_timeout: untyped?) -> void - - def close: () -> untyped - - private - - def http: () -> untyped - - def start: (untyped http) -> untyped - - MAX_RETRIES: Integer - - def request: (untyped verb, untyped url, untyped headers, untyped payload, ?::Integer redirects) -> untyped - - def new_request_for: (untyped verb, untyped url, untyped headers, untyped payload) -> untyped - - def response_for: (untyped request) -> untyped - - def new_http_client: () -> untyped - - def proxy: () -> untyped - - def use_proxy?: () -> untyped - end - end - end - end + def http: () -> Net::HTTP end diff --git a/rb/sig/lib/selenium/webdriver/remote/response.rbs b/rb/sig/lib/selenium/webdriver/remote/response.rbs index 3afa65955917b..133847ea0fdd7 100644 --- a/rb/sig/lib/selenium/webdriver/remote/response.rbs +++ b/rb/sig/lib/selenium/webdriver/remote/response.rbs @@ -1,31 +1,14 @@ -module Selenium - module WebDriver - module Remote - class Response - @code: Integer +class Selenium::WebDriver::Remote::Response + def initialize: (Integer, ?Hash[untyped, untyped]) -> void - @payload: Hash[untyped, untyped] + def assert_ok: () -> nil - attr_reader code: Integer + def error: () -> nil - attr_reader payload: Hash[untyped, untyped] + def process_error: () -> nil + | () -> Array[untyped] - def initialize: (Integer code, ?Hash[untyped, untyped]? payload) -> void - - def error: () -> Error::WebDriverError? - - def []: (untyped key) -> untyped - - private - - def assert_ok: () -> Error::WebDriverError - - def add_cause: (Error::WebDriverError ex, String error, Array[String] backtrace) -> Error::WebDriverError - - def backtrace_from_remote: -> Array[String] - - def process_error: () -> Array[Hash[untyped, untyped]] - end - end - end + def []: (String) -> nil + | (String) -> Hash[untyped, untyped] + | (String) -> bool end diff --git a/rb/sig/lib/selenium/webdriver/support/guards.rbs b/rb/sig/lib/selenium/webdriver/support/guards.rbs index 2f7c90896426d..b276a14643b5f 100644 --- a/rb/sig/lib/selenium/webdriver/support/guards.rbs +++ b/rb/sig/lib/selenium/webdriver/support/guards.rbs @@ -1,41 +1,15 @@ -module Selenium - module WebDriver - module Support - class Guards - @example: untyped +class Selenium::WebDriver::Support::Guards + def initialize: (RSpec::Core::Example, ?bug_tracker: String, ?conditions: nil) -> void - @bug_tracker: untyped + def collect_example_guards: () -> Array[untyped] - @guard_conditions: untyped + def add_condition: (Symbol, ?Symbol) -> void + | (Symbol, ?nil) -> void + | (Symbol, ?bool) -> void - @guards: untyped + def disposition: () -> Array[untyped] - @messages: untyped + def skipping_guard: () -> Selenium::WebDriver::Support::Guards::Guard - GUARD_TYPES: Array[Symbol] - - attr_reader messages: untyped - - attr_accessor bug_tracker: untyped - - def initialize: (untyped example, ?bug_tracker: String, ?conditions: untyped?) -> void - - def add_condition: (untyped name, ?untyped? condition) { () -> untyped } -> untyped - - def add_message: (untyped name, untyped message) -> untyped - - def disposition: () -> Array[untyped]? - - def satisfied?: (untyped guard) -> untyped - - private - - def collect_example_guards: () -> untyped - - def skipping_guard: () -> untyped - - def pending_guard: () -> untyped - end - end - end + def satisfied?: (Selenium::WebDriver::Support::Guards::Guard) -> bool end diff --git a/rb/sig/lib/selenium/webdriver/support/guards/guard.rbs b/rb/sig/lib/selenium/webdriver/support/guards/guard.rbs index 70c13b3cb0312..3bb537fe3f4d4 100644 --- a/rb/sig/lib/selenium/webdriver/support/guards/guard.rbs +++ b/rb/sig/lib/selenium/webdriver/support/guards/guard.rbs @@ -1,40 +1,9 @@ -module Selenium - module WebDriver - module Support - class Guards - class Guard - @guarded: untyped +class Selenium::WebDriver::Support::Guards::Guard + def initialize: (Hash[untyped, untyped], Symbol, ?Selenium::WebDriver::Support::Guards) -> void - @tracker: untyped + def exclusive?: () -> bool - @messages: untyped + def exclude?: () -> bool - @type: untyped - - @reason: untyped - - attr_reader guarded: untyped - - attr_reader tracker: String - attr_reader type: untyped - - attr_reader messages: untyped - - attr_reader reason: untyped - - def initialize: (untyped guarded, untyped type, ?untyped? guards) -> void - - def message: () -> untyped - - def except?: () -> untyped - - def only?: () -> untyped - - def exclude?: () -> untyped - - def exclusive?: () -> untyped - end - end - end - end + def message: () -> String end diff --git a/rb/sig/lib/selenium/webdriver/support/guards/guard_condition.rbs b/rb/sig/lib/selenium/webdriver/support/guards/guard_condition.rbs index f7f0d50690a24..2f6ac4c28da01 100644 --- a/rb/sig/lib/selenium/webdriver/support/guards/guard_condition.rbs +++ b/rb/sig/lib/selenium/webdriver/support/guards/guard_condition.rbs @@ -1,21 +1,6 @@ -module Selenium - module WebDriver - module Support - class Guards - class GuardCondition - @name: untyped +class Selenium::WebDriver::Support::Guards::GuardCondition + def initialize: (Symbol, ?Symbol) -> void + | (Symbol, ?bool) -> void - @execution: untyped - - attr_accessor name: untyped - - attr_accessor execution: untyped - - def initialize: (untyped name, ?untyped? condition) ?{ () -> untyped } -> void - - def satisfied?: (untyped guard) -> untyped - end - end - end - end + def satisfied?: (Selenium::WebDriver::Support::Guards::Guard) -> bool end diff --git a/rb/spec/integration/selenium/webdriver/action_builder_spec.rb b/rb/spec/integration/selenium/webdriver/action_builder_spec.rb index 99ce2fa689e9e..247ae487f477b 100644 --- a/rb/spec/integration/selenium/webdriver/action_builder_spec.rb +++ b/rb/spec/integration/selenium/webdriver/action_builder_spec.rb @@ -321,7 +321,7 @@ module WebDriver describe '#scroll_by' do it 'scrolls by given amount', - exclude: {driver: :firefox, reason: 'inconsistent behavior between versions'} do + exclude: {browser: %i[chrome firefox], reason: 'inconsistent behavior between versions'} do driver.navigate.to url_for('scrolling_tests/frame_with_nested_scrolling_frame_out_of_view.html') footer = driver.find_element(tag_name: 'footer') delta_y = footer.rect.y.round diff --git a/rb/spec/integration/selenium/webdriver/spec_helper.rb b/rb/spec/integration/selenium/webdriver/spec_helper.rb index 751c6f185634e..6e60de2addfef 100644 --- a/rb/spec/integration/selenium/webdriver/spec_helper.rb +++ b/rb/spec/integration/selenium/webdriver/spec_helper.rb @@ -34,13 +34,26 @@ def example_finished(notification) exception = notification.example.exception assertion_failed = exception && (exception.is_a?(RSpec::Expectations::ExpectationNotMetError) || - exception.is_a?(RSpec::Core::Pending::PendingExampleFixedError)) + exception.is_a?(RSpec::Core::Pending::PendingExampleFixedError)) pending_exception = exception.nil? && notification.example.pending && !notification.example.skip GlobalTestEnv.reset_driver! if (exception && !assertion_failed) || pending_exception end end +module TraceHelper + def self.trace + @trace ||= unless WebDriver::Platform.ci + require 'rbs-trace' + RBS::Trace.new + end + end + + def self.enabled? + !trace.nil? + end +end + RSpec.configure do |c| c.define_derived_metadata do |meta| meta[:aggregate_failures] = true @@ -53,9 +66,14 @@ def example_finished(notification) c.before(:suite) do GlobalTestEnv.remote_server.start if GlobalTestEnv.driver == :remote && ENV['WD_REMOTE_URL'].nil? GlobalTestEnv.print_env + TraceHelper.trace.enable if TraceHelper.enabled? end c.after(:suite) do + if TraceHelper.enabled? + TraceHelper.trace.disable + TraceHelper.trace.save_files(out_dir: 'sig/') + end GlobalTestEnv.quit_driver end