diff --git a/.github/workflows/functional-test.yml b/.github/workflows/functional-test.yml index abd5ff19..d7fcf0c9 100644 --- a/.github/workflows/functional-test.yml +++ b/.github/workflows/functional-test.yml @@ -68,7 +68,7 @@ jobs: appium driver install xcuitest appium plugin install images appium plugin install execute-driver - nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors --base-path=/wd/hub 2>&1 > appium.log & + nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors 2>&1 > appium.log & - name: Set up Ruby uses: ruby/setup-ruby@v1 @@ -131,7 +131,7 @@ jobs: appium driver install xcuitest appium plugin install images@2.1.8 appium plugin install execute-driver - nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors --base-path=/wd/hub > appium.log & + nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors > appium.log & - name: Set up Ruby uses: ruby/setup-ruby@v1 @@ -216,7 +216,7 @@ jobs: appium driver install ${{matrix.test_targets.automation_name}} appium plugin install images appium plugin install execute-driver - nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors --base-path=/wd/hub > appium.log & + nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors > appium.log & - name: Enable KVM group perms run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index d0ce5d82..c6da59a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Read `release_notes.md` for commit level details. ### Bug fixes ### Deprecations +- Use `http://127.0.0.1:4723` as the default url destination instead of `http://127.0.0.1:4723/wd/hub` ## [9.5.2] - 2025-01-30 - Fix yardoc diff --git a/README.md b/README.md index e41b67da..b52ad2bb 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Run functional tests which require the Appium server and real device, Simulator/ $ npm install --location=global appium $ appium driver install xcuitest $ appium driver install uiautomator2 # etc -$ appium --base-path=/wd/hub --relaxed-security # To run all tests in local +$ appium --relaxed-security # To run all tests in local ``` - Conduct tests @@ -146,7 +146,7 @@ As of version 5.8.0, the client can attach to an existing session. The main purp ```ruby # @driver is the driver instance of an existing session -attached_driver = ::Appium::Core::Driver.attach_to @driver.session_id, url: 'http://127.0.0.1:4723/wd/hub', automation_name: 'XCUITest', platform_name: 'ios' +attached_driver = ::Appium::Core::Driver.attach_to @driver.session_id, url: 'http://127.0.0.1:4723', automation_name: 'XCUITest', platform_name: 'ios' assert attached_driver.session_id == @driver.session_id attached_driver.page_source ``` diff --git a/lib/appium_lib_core/common/base/bridge.rb b/lib/appium_lib_core/common/base/bridge.rb index 3c250df8..e947f4c5 100644 --- a/lib/appium_lib_core/common/base/bridge.rb +++ b/lib/appium_lib_core/common/base/bridge.rb @@ -68,7 +68,7 @@ def browser # # new_driver = ::Appium::Core::Driver.attach_to( # driver.session_id, - # url: 'http://127.0.0.1:4723/wd/hub', automation_name: 'UiAutomator2', platform_name: 'Android' + # url: 'http://127.0.0.1:4723', automation_name: 'UiAutomator2', platform_name: 'Android' # ) # def attach_to(session_id, platform_name, automation_name) diff --git a/lib/appium_lib_core/driver.rb b/lib/appium_lib_core/driver.rb index 28c764d7..df531801 100644 --- a/lib/appium_lib_core/driver.rb +++ b/lib/appium_lib_core/driver.rb @@ -129,7 +129,7 @@ class Driver attr_reader :automation_name # Custom URL for the selenium server. If set this attribute, ruby_lib_core try to handshake to the custom url.
- # Defaults to false. Then try to connect to http://127.0.0.1:#{port}/wd/hub. + # Defaults to false. Then try to connect to http://127.0.0.1:#{port}. # @return [String] attr_reader :custom_url @@ -196,7 +196,7 @@ class Driver # # format 1 # @core = Appium::Core.for caps: {...}, appium_lib: {...} # # format 2. 'capabilities:' is also available instead of 'caps:'. - # @core = Appium::Core.for url: "http://127.0.0.1:8080/wd/hub", capabilities: {...}, appium_lib: {...} + # @core = Appium::Core.for url: "http://127.0.0.1:8080", capabilities: {...}, appium_lib: {...} # # # require 'rubygems' @@ -220,7 +220,7 @@ class Driver # } # } # @core = Appium::Core.for(opts) # create a core driver with 'opts' and extend methods into 'self' - # @core.start_driver # Connect to 'http://127.0.0.1:8080/wd/hub' because of 'port: 8080' + # @core.start_driver # Connect to 'http://127.0.0.1:8080' because of 'port: 8080' # # # Start iOS driver with .zip file over HTTP # # 'capabilities:' is also available instead of 'caps:'. Either is fine. @@ -233,7 +233,7 @@ class Driver # app: 'http://example.com/path/to/MyiOS.app.zip' # }, # appium_lib: { - # server_url: 'http://custom-host:8080/wd/hub.com', + # server_url: 'http://custom-host:8080/wd/hub', # wait: 0, # wait_timeout: 20, # wait_interval: 0.3, @@ -241,11 +241,11 @@ class Driver # } # } # @core = Appium::Core.for(opts) - # @core.start_driver # Connect to 'http://custom-host:8080/wd/hub.com' + # @core.start_driver # Connect to 'http://custom-host:8080/wd/hub' # # # Start iOS driver as another format. 'url' is available like below # opts = { - # url: "http://custom-host:8080/wd/hub.com", + # url: "http://custom-host:8080/wd/hub", # capabilities: { # platformName: :ios, # platformVersion: '11.0', @@ -261,7 +261,7 @@ class Driver # } # } # @core = Appium::Core.for(opts) # create a core driver with 'opts' and extend methods into 'self' - # @core.start_driver # start driver with 'url'. Connect to 'http://custom-host:8080/wd/hub.com' + # @core.start_driver # start driver with 'url'. Connect to 'http://custom-host:8080/wd/hub' # # # With a custom listener # class CustomListener < ::Selenium::WebDriver::Support::AbstractEventListener @@ -300,7 +300,7 @@ def self.for(opts = {}) # # new_driver = ::Appium::Core::Driver.attach_to( # driver.session_id, # The 'driver' has an existing session id - # url: 'http://127.0.0.1:4723/wd/hub', automation_name: 'UiAutomator2', platform_name: 'Android' + # url: 'http://127.0.0.1:4723', automation_name: 'UiAutomator2', platform_name: 'Android' # ) # new_driver.page_source # for example # @@ -352,7 +352,7 @@ def setup_for_new_session(opts = {}) # Creates a new global driver and quits the old one if it exists. # You can customise http_client as the following # - # @param [String] server_url Custom server url to send to requests. Default is "http://127.0.0.1:4723/wd/hub". + # @param [String] server_url Custom server url to send to requests. Default is "http://127.0.0.1:4723". # @param http_client_ops [Hash] Options for http client # @option http_client_ops [Hash] :http_client Custom HTTP Client # @option http_client_ops [Hash] :open_timeout Custom open timeout for http client. @@ -383,10 +383,10 @@ def setup_for_new_session(opts = {}) # } # # @core = Appium::Core.for(opts) # create a core driver with 'opts' and extend methods into 'self' - # @driver = @core.start_driver server_url: "http://127.0.0.1:8000/wd/hub" + # @driver = @core.start_driver server_url: "http://127.0.0.1:8000" # # # Attach custom HTTP client - # @driver = @core.start_driver server_url: "http://127.0.0.1:8000/wd/hub", + # @driver = @core.start_driver server_url: "http://127.0.0.1:8000", # http_client_ops: { http_client: Your:Http:Client.new, # open_timeout: 1_000, # read_timeout: 1_000 } @@ -394,7 +394,7 @@ def setup_for_new_session(opts = {}) def start_driver(server_url: nil, http_client_ops: { http_client: nil, open_timeout: 999_999, read_timeout: 999_999 }) - @custom_url ||= "http://127.0.0.1:#{@port}/wd/hub" + @custom_url ||= "http://127.0.0.1:#{@port}" @custom_url = server_url unless server_url.nil? @http_client = get_http_client http_client: http_client_ops.delete(:http_client), diff --git a/test/test_helper.rb b/test/test_helper.rb index 1449a048..85cdacc6 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -419,8 +419,8 @@ def udid_name module Mock HEADER = { 'Content-Type' => 'application/json; charset=utf-8', 'Cache-Control' => 'no-cache' }.freeze - NOSESSION = 'http://127.0.0.1:4723/wd/hub' - SESSION = 'http://127.0.0.1:4723/wd/hub/session/1234567890' + NOSESSION = 'http://127.0.0.1:4723' + SESSION = 'http://127.0.0.1:4723/session/1234567890' def android_mock_create_session android_mock_create_session_w3c @@ -443,7 +443,7 @@ def android_mock_create_session_w3c } }.to_json - stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session') + stub_request(:post, 'http://127.0.0.1:4723/session') .to_return(headers: HEADER, status: 200, body: response) stub_request(:post, "#{SESSION}/timeouts") @@ -457,7 +457,7 @@ def android_mock_create_session_w3c assert_equal({}, driver.send(:bridge).http.additional_headers) assert_requested( :post, - 'http://127.0.0.1:4723/wd/hub/session', + 'http://127.0.0.1:4723/session', headers: { 'X-Idempotency-Key' => /.+/, 'Content-Type' => 'application/json; charset=UTF-8', @@ -500,7 +500,7 @@ def android_chrome_mock_create_session_w3c } }.to_json - stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session') + stub_request(:post, 'http://127.0.0.1:4723/session') .to_return(headers: HEADER, status: 200, body: response) stub_request(:post, "#{SESSION}/timeouts") @@ -512,7 +512,7 @@ def android_chrome_mock_create_session_w3c assert_equal({}, driver.send(:bridge).http.additional_headers) assert_requested( :post, - 'http://127.0.0.1:4723/wd/hub/session', + 'http://127.0.0.1:4723/session', headers: { 'X-Idempotency-Key' => /.+/, 'Content-Type' => 'application/json; charset=UTF-8', @@ -558,14 +558,14 @@ def ios_mock_create_session_w3c } }.to_json - stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session') + stub_request(:post, 'http://127.0.0.1:4723/session') .to_return(headers: HEADER, status: 200, body: response) driver = @core.start_driver assert_requested( :post, - 'http://127.0.0.1:4723/wd/hub/session', + 'http://127.0.0.1:4723/session', headers: { 'X-Idempotency-Key' => /.+/, 'Content-Type' => 'application/json; charset=UTF-8', @@ -589,14 +589,14 @@ def windows_mock_create_session } }.to_json - stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session') + stub_request(:post, 'http://127.0.0.1:4723/session') .to_return(headers: HEADER, status: 200, body: response) driver = @core.start_driver assert_requested( :post, - 'http://127.0.0.1:4723/wd/hub/session', + 'http://127.0.0.1:4723/session', headers: { 'X-Idempotency-Key' => /.+/, 'Content-Type' => 'application/json; charset=UTF-8', @@ -620,14 +620,14 @@ def windows_mock_create_session_w3c } }.to_json - stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session') + stub_request(:post, 'http://127.0.0.1:4723/session') .to_return(headers: HEADER, status: 200, body: response) driver = @core.start_driver assert_requested( :post, - 'http://127.0.0.1:4723/wd/hub/session', + 'http://127.0.0.1:4723/session', headers: { 'X-Idempotency-Key' => /.+/, 'Content-Type' => 'application/json; charset=UTF-8', @@ -649,14 +649,14 @@ def mac2_mock_create_session_w3c } }.to_json - stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session') + stub_request(:post, 'http://127.0.0.1:4723/session') .to_return(headers: HEADER, status: 200, body: response) driver = @core.start_driver assert_requested( :post, - 'http://127.0.0.1:4723/wd/hub/session', + 'http://127.0.0.1:4723/session', headers: { 'X-Idempotency-Key' => /.+/, 'Content-Type' => 'application/json; charset=UTF-8', diff --git a/test/unit/android/webdriver/w3c/commands_test.rb b/test/unit/android/webdriver/w3c/commands_test.rb index 8d150073..056550e1 100644 --- a/test/unit/android/webdriver/w3c/commands_test.rb +++ b/test/unit/android/webdriver/w3c/commands_test.rb @@ -138,7 +138,7 @@ def test_no_session_id } }.to_json - stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session') + stub_request(:post, 'http://127.0.0.1:4723/session') .to_return(headers: HEADER, status: 200, body: response) error = assert_raises ::Selenium::WebDriver::Error::WebDriverError do @@ -149,12 +149,12 @@ def test_no_session_id end def test_remote_status - stub_request(:get, 'http://127.0.0.1:4723/wd/hub/status') + stub_request(:get, 'http://127.0.0.1:4723/status') .to_return(headers: HEADER, status: 200, body: { value: 'xxxx' }.to_json) @driver.remote_status - assert_requested(:get, 'http://127.0.0.1:4723/wd/hub/status', times: 1) + assert_requested(:get, 'http://127.0.0.1:4723/status', times: 1) end def test_page_source diff --git a/test/unit/appium_lib_core_test.rb b/test/unit/appium_lib_core_test.rb index 0b687244..264352f9 100644 --- a/test/unit/appium_lib_core_test.rb +++ b/test/unit/appium_lib_core_test.rb @@ -66,7 +66,7 @@ def test_symbolize_keys_raise_argument_error def test_core_instance_variables opts = { - url: 'http://custom-host:8080/wd/hub.com', + url: 'http://custom-host:8080/wd/hub/path', caps: { platformName: :ios, platformVersion: '11.0', @@ -76,7 +76,7 @@ def test_core_instance_variables } } @core = Appium::Core.for(opts) - assert_equal 'http://custom-host:8080/wd/hub.com', @core.custom_url + assert_equal 'http://custom-host:8080/wd/hub/path', @core.custom_url assert_equal :ios, @core.device assert_equal :xcuitest, @core.automation_name @@ -84,7 +84,7 @@ def test_core_instance_variables def test_core_instance_variables_with_appium_prefix_hash opts = { - url: 'http://custom-host:8080/wd/hub.com', + url: 'http://custom-host:8080/wd/hub/path', caps: { 'platformName': 'ios', 'appium:platformVersion': '11.0', @@ -94,7 +94,7 @@ def test_core_instance_variables_with_appium_prefix_hash } } @core = Appium::Core.for(opts) - assert_equal 'http://custom-host:8080/wd/hub.com', @core.custom_url + assert_equal 'http://custom-host:8080/wd/hub/path', @core.custom_url assert_equal :ios, @core.device assert_equal :xcuitest, @core.automation_name @@ -102,7 +102,7 @@ def test_core_instance_variables_with_appium_prefix_hash def test_core_instance_variables_with_appium_prefix_string opts = { - url: 'http://custom-host:8080/wd/hub.com', + url: 'http://custom-host:8080/wd/hub/path', caps: { 'platformName' => 'ios', 'appium:platformVersion' => '11.0', @@ -112,14 +112,14 @@ def test_core_instance_variables_with_appium_prefix_string } } @core = Appium::Core.for(opts) - assert_equal 'http://custom-host:8080/wd/hub.com', @core.custom_url + assert_equal 'http://custom-host:8080/wd/hub/path', @core.custom_url assert_equal :ios, @core.device assert_equal :xcuitest, @core.automation_name end def test_url_param opts = { - url: 'http://custom-host:8080/wd/hub.com', + url: 'http://custom-host:8080/wd/hub/path', caps: { platformName: :ios, platformVersion: '11.0', @@ -129,7 +129,7 @@ def test_url_param } } @core = Appium::Core.for(opts) # create a core driver with `opts` and extend methods into `self` - assert_equal 'http://custom-host:8080/wd/hub.com', @core.custom_url + assert_equal 'http://custom-host:8080/wd/hub/path', @core.custom_url end def test_url_server_url @@ -142,16 +142,16 @@ def test_url_server_url app: '/path/to/MyiOS.app' }, appium_lib: { - server_url: 'http://custom-host:8080/wd/hub.com' + server_url: 'http://custom-host:8080/wd/hub/path' } } @core = Appium::Core.for(opts) # create a core driver with `opts` and extend methods into `self` - assert_equal 'http://custom-host:8080/wd/hub.com', @core.custom_url + assert_equal 'http://custom-host:8080/wd/hub/path', @core.custom_url end def test_url_is_prior_than_server_url opts = { - url: 'http://custom-host1:8080/wd/hub.com', + url: 'http://custom-host1:8080/wd/hub/path', caps: { platformName: :ios, platformVersion: '11.0', @@ -160,11 +160,11 @@ def test_url_is_prior_than_server_url app: '/path/to/MyiOS.app' }, appium_lib: { - server_url: 'http://custom-host2:8080/wd/hub.com' + server_url: 'http://custom-host2:8080/wd/hub/path' } } @core = Appium::Core.for(opts) # create a core driver with `opts` and extend methods into `self` - assert_equal 'http://custom-host1:8080/wd/hub.com', @core.custom_url + assert_equal 'http://custom-host1:8080/wd/hub/path', @core.custom_url end end end diff --git a/test/unit/common_test.rb b/test/unit/common_test.rb index 72244b4f..3d0952ac 100644 --- a/test/unit/common_test.rb +++ b/test/unit/common_test.rb @@ -23,7 +23,7 @@ class AppiumCoreBaseBridgeTest < Minitest::Test def setup ::Selenium::WebDriver::Remote::Bridge.element_class = ::Appium::Core::Element - @bridge = Appium::Core::Base::Bridge.new url: 'http://127.0.0.1:4723/wd/hub' + @bridge = Appium::Core::Base::Bridge.new url: 'http://127.0.0.1:4723' end RESPONSE_BASE_VALUE = { @@ -77,13 +77,13 @@ def setup def test_create_session_w3c response = { value: RESPONSE_BASE_VALUE }.to_json - stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session') + stub_request(:post, 'http://127.0.0.1:4723/session') .with(body: { capabilities: { alwaysMatch: APPIUM_PREFIX_CAPS, firstMatch: [{}] } }.to_json) .to_return(headers: Mock::HEADER, status: 200, body: response) _driver = ::Appium::Core.for({ caps: CAPS, appium_lib: {} }).start_driver - assert_requested(:post, 'http://127.0.0.1:4723/wd/hub/session', times: 1) + assert_requested(:post, 'http://127.0.0.1:4723/session', times: 1) end def test_create_session_w3c_with_http_package @@ -119,14 +119,14 @@ def test_create_session_w3c_with_http_package 'appium:appPackage' => 'io.appium.android.apis' } - stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session') + stub_request(:post, 'http://127.0.0.1:4723/session') .with(body: { capabilities: { alwaysMatch: appium_prefix_http_caps, firstMatch: [{}] } }.to_json) .to_return(headers: Mock::HEADER, status: 200, body: response) core = ::Appium::Core.for({ caps: http_caps, appium_lib: {} }) core.start_driver - assert_requested(:post, 'http://127.0.0.1:4723/wd/hub/session', times: 1) + assert_requested(:post, 'http://127.0.0.1:4723/session', times: 1) assert_equal 'http://example.com/test.apk.zip', core.caps[:app] end diff --git a/test/unit/driver_test.rb b/test/unit/driver_test.rb index 5fe0fbf6..7119f8fd 100644 --- a/test/unit/driver_test.rb +++ b/test/unit/driver_test.rb @@ -125,7 +125,7 @@ def test_default_timeout_for_http_client assert_equal 'http', uri.scheme assert_equal '127.0.0.1', uri.host assert_equal 4723, uri.port - assert_equal '/wd/hub/', uri.path + assert_equal '/', uri.path end def test_http_client @@ -155,7 +155,7 @@ def test_default_timeout_for_http_client_with_direct } }.to_json - stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session') + stub_request(:post, 'http://127.0.0.1:4723/session') .to_return(headers: HEADER, status: 200, body: response) stub_request(:post, 'http://localhost:8888/wd/hub/session/1234567890/timeouts') @@ -164,7 +164,7 @@ def test_default_timeout_for_http_client_with_direct driver = core.start_driver - assert_requested(:post, 'http://127.0.0.1:4723/wd/hub/session', times: 1) + assert_requested(:post, 'http://127.0.0.1:4723/session', times: 1) assert_requested(:post, 'http://localhost:8888/wd/hub/session/1234567890/timeouts', body: { implicit: 30_000 }.to_json, times: 1) driver @@ -205,7 +205,7 @@ def test_default_timeout_for_http_client_with_direct_appium_prefix } }.to_json - stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session') + stub_request(:post, 'http://127.0.0.1:4723/session') .to_return(headers: HEADER, status: 200, body: response) stub_request(:post, 'http://localhost:8888/wd/hub/session/1234567890/timeouts') @@ -214,7 +214,7 @@ def test_default_timeout_for_http_client_with_direct_appium_prefix driver = core.start_driver - assert_requested(:post, 'http://127.0.0.1:4723/wd/hub/session', times: 1) + assert_requested(:post, 'http://127.0.0.1:4723/session', times: 1) assert_requested(:post, 'http://localhost:8888/wd/hub/session/1234567890/timeouts', body: { implicit: 30_000 }.to_json, times: 1) driver @@ -259,7 +259,7 @@ def test_default_timeout_for_http_client_with_direct_appium_prefix_prior_than_no } }.to_json - stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session') + stub_request(:post, 'http://127.0.0.1:4723/session') .to_return(headers: HEADER, status: 200, body: response) stub_request(:post, 'http://localhost:8888/wd/hub/session/1234567890/timeouts') @@ -268,7 +268,7 @@ def test_default_timeout_for_http_client_with_direct_appium_prefix_prior_than_no driver = core.start_driver - assert_requested(:post, 'http://127.0.0.1:4723/wd/hub/session', times: 1) + assert_requested(:post, 'http://127.0.0.1:4723/session', times: 1) assert_requested(:post, 'http://localhost:8888/wd/hub/session/1234567890/timeouts', body: { implicit: 30_000 }.to_json, times: 1) driver @@ -308,17 +308,17 @@ def test_default_timeout_for_http_client_with_direct_no_path } }.to_json - stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session') + stub_request(:post, 'http://127.0.0.1:4723/session') .to_return(headers: HEADER, status: 200, body: response) - stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session/1234567890/timeouts') + stub_request(:post, 'http://127.0.0.1:4723/session/1234567890/timeouts') .with(body: { implicit: 30_000 }.to_json) .to_return(headers: HEADER, status: 200, body: { value: nil }.to_json) driver = core.start_driver - assert_requested(:post, 'http://127.0.0.1:4723/wd/hub/session', times: 1) - assert_requested(:post, 'http://127.0.0.1:4723/wd/hub/session/1234567890/timeouts', + assert_requested(:post, 'http://127.0.0.1:4723/session', times: 1) + assert_requested(:post, 'http://127.0.0.1:4723/session/1234567890/timeouts', body: { implicit: 30_000 }.to_json, times: 1) driver end @@ -333,7 +333,7 @@ def test_default_timeout_for_http_client_with_direct_no_path assert_equal 'http', uri.scheme assert_equal '127.0.0.1', uri.host assert_equal 4723, uri.port - assert_equal '/wd/hub/', uri.path + assert_equal '/', uri.path end def test_default_timeout_for_http_client_with_direct_no_supported_client @@ -358,17 +358,17 @@ def test_default_timeout_for_http_client_with_direct_no_supported_client } }.to_json - stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session') + stub_request(:post, 'http://127.0.0.1:4723/session') .to_return(headers: HEADER, status: 200, body: response) - stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session/1234567890/timeouts') + stub_request(:post, 'http://127.0.0.1:4723/session/1234567890/timeouts') .with(body: { implicit: 30_000 }.to_json) .to_return(headers: HEADER, status: 200, body: { value: nil }.to_json) driver = core.start_driver http_client_ops: { http_client: Selenium::WebDriver::Remote::Http::Default.new } - assert_requested(:post, 'http://127.0.0.1:4723/wd/hub/session', times: 1) - assert_requested(:post, 'http://127.0.0.1:4723/wd/hub/session/1234567890/timeouts', + assert_requested(:post, 'http://127.0.0.1:4723/session', times: 1) + assert_requested(:post, 'http://127.0.0.1:4723/session/1234567890/timeouts', body: { implicit: 30_000 }.to_json, times: 1) driver end @@ -383,7 +383,7 @@ def test_default_timeout_for_http_client_with_direct_no_supported_client assert_equal 'http', uri.scheme assert_equal '127.0.0.1', uri.host assert_equal 4723, uri.port - assert_equal '/wd/hub/', uri.path + assert_equal '/', uri.path end def test_default_timeout_for_http_client_with_enable_idempotency_header_false @@ -404,17 +404,17 @@ def _android_mock_create_session_w3c(core) } }.to_json - stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session') + stub_request(:post, 'http://127.0.0.1:4723/session') .to_return(headers: HEADER, status: 200, body: response) - stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session/1234567890/timeouts') + stub_request(:post, 'http://127.0.0.1:4723/session/1234567890/timeouts') .with(body: { implicit: 5_000 }.to_json) .to_return(headers: HEADER, status: 200, body: { value: nil }.to_json) driver = core.start_driver - assert_requested(:post, 'http://127.0.0.1:4723/wd/hub/session', times: 1) - assert_requested(:post, 'http://127.0.0.1:4723/wd/hub/session/1234567890/timeouts', + assert_requested(:post, 'http://127.0.0.1:4723/session', times: 1) + assert_requested(:post, 'http://127.0.0.1:4723/session/1234567890/timeouts', body: { implicit: 5_000 }.to_json, times: 1) driver end @@ -448,17 +448,17 @@ def _android_mock_create_session_w3c_with_custom_http_client(core) } }.to_json - stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session') + stub_request(:post, 'http://127.0.0.1:4723/session') .to_return(headers: HEADER, status: 200, body: response) - stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session/1234567890/timeouts') + stub_request(:post, 'http://127.0.0.1:4723/session/1234567890/timeouts') .with(body: { implicit: 5_000 }.to_json) .to_return(headers: HEADER, status: 200, body: { value: nil }.to_json) driver = core.start_driver http_client_ops: { http_client: Selenium::WebDriver::Remote::Http::Default.new } - assert_requested(:post, 'http://127.0.0.1:4723/wd/hub/session', times: 1) - assert_requested(:post, 'http://127.0.0.1:4723/wd/hub/session/1234567890/timeouts', + assert_requested(:post, 'http://127.0.0.1:4723/session', times: 1) + assert_requested(:post, 'http://127.0.0.1:4723/session/1234567890/timeouts', body: { implicit: 5_000 }.to_json, times: 1) driver end @@ -523,7 +523,7 @@ def test_attach_to_an_existing_session } }.to_json - stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session') + stub_request(:post, 'http://127.0.0.1:4723/session') .to_return(headers: HEADER, status: 200, body: response) stub_request(:post, 'http://localhost:8888/wd/hub/session/1234567890/timeouts') @@ -532,7 +532,7 @@ def test_attach_to_an_existing_session driver = core.start_driver - assert_requested(:post, 'http://127.0.0.1:4723/wd/hub/session', times: 1) + assert_requested(:post, 'http://127.0.0.1:4723/session', times: 1) assert_requested(:post, 'http://localhost:8888/wd/hub/session/1234567890/timeouts', body: { implicit: 30_000 }.to_json, times: 1) driver @@ -543,7 +543,7 @@ def test_attach_to_an_existing_session attached_driver = ::Appium::Core::Driver.attach_to( driver.session_id, - url: 'http://127.0.0.1:4723/wd/hub', automation_name: 'UiAutomator2', platform_name: 'Android' + url: 'http://127.0.0.1:4723', automation_name: 'UiAutomator2', platform_name: 'Android' ) assert_equal driver.session_id, attached_driver.session_id @@ -569,12 +569,12 @@ def test_listener_default } }.to_json - stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session') + stub_request(:post, 'http://127.0.0.1:4723/session') .to_return(headers: HEADER, status: 200, body: response) driver = core.start_driver - assert_requested(:post, 'http://127.0.0.1:4723/wd/hub/session', times: 1) + assert_requested(:post, 'http://127.0.0.1:4723/session', times: 1) driver end @@ -602,12 +602,12 @@ def test_listener_with_custom_listener_element } }.to_json - stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session') + stub_request(:post, 'http://127.0.0.1:4723/session') .to_return(headers: HEADER, status: 200, body: response) driver = core.start_driver - assert_requested(:post, 'http://127.0.0.1:4723/wd/hub/session', times: 1) + assert_requested(:post, 'http://127.0.0.1:4723/session', times: 1) driver end @@ -639,12 +639,12 @@ def test_listener_with_custom_listener_elements } }.to_json - stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session') + stub_request(:post, 'http://127.0.0.1:4723/session') .to_return(headers: HEADER, status: 200, body: response) driver = core.start_driver - assert_requested(:post, 'http://127.0.0.1:4723/wd/hub/session', times: 1) + assert_requested(:post, 'http://127.0.0.1:4723/session', times: 1) driver end