Skip to content

Commit

Permalink
fix the usage
Browse files Browse the repository at this point in the history
  • Loading branch information
KazuCocoa committed Aug 3, 2024
1 parent d533201 commit ff6efba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
3 changes: 2 additions & 1 deletion ios_tests/lib/ios/specs/device/image_comparison.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def test_image_comparison
# Equal to `$driver.driver.find_image_occurrence`
# Equal to `driver.find_image_occurrence`
find_result = find_image_occurrence full_image: image1, partial_image: image2
assert_equal({ 'rect' => { 'x' => 0, 'y' => 0, 'width' => 750, 'height' => 1334 } }, find_result)
rect = find_result['rect']
assert_equal({ 'x' => 0, 'y' => 0, 'width' => 750, 'height' => 1334 }, rect)
end
end
end
Expand Down
18 changes: 11 additions & 7 deletions lib/appium_lib/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -536,12 +536,11 @@ def window_rect
# @option http_client_ops [Hash] :open_timeout Custom open timeout for http client.
# @option http_client_ops [Hash] :read_timeout Custom read timeout for http client.
# @return [Selenium::WebDriver] the new global driver
def start_driver(http_client_ops =
{
http_client: ::Appium::Http::Default.new(
open_timeout: 999_999, read_timeout: 999_999
), open_timeout: 999_999, read_timeout: 999_999
})
def start_driver(http_client_ops = { http_client: nil, open_timeout: 999_999, read_timeout: 999_999 })
if http_client_ops[:http_client].nil?
http_client = ::Appium::Http::Default.new(open_timeout: http_client_ops[:open_timeout],
read_timeout: http_client_ops[:read_timeout])
end

# TODO: do not kill the previous session in the future version.
if $driver.nil?
Expand All @@ -554,7 +553,12 @@ def start_driver(http_client_ops =
# starting driver.
automation_name = @core.automation_name

@driver = @core.start_driver(server_url: server_url, http_client_ops: http_client_ops)
@driver = @core.start_driver(server_url: server_url,
http_client_ops: {
http_client: http_client,
open_timeout: 999_999,
read_timeout: 999_999
})
@http_client = @core.http_client

# if automation_name was nil before start_driver, then re-extend driver specific methods
Expand Down

0 comments on commit ff6efba

Please sign in to comment.