diff --git a/test/unit/appium_lib_core_test.rb b/test/unit/appium_lib_core_test.rb index 6e3df339..0b687244 100644 --- a/test/unit/appium_lib_core_test.rb +++ b/test/unit/appium_lib_core_test.rb @@ -82,7 +82,7 @@ def test_core_instance_variables assert_equal :xcuitest, @core.automation_name end - def test_core_instance_variables_with_appium_prefix + def test_core_instance_variables_with_appium_prefix_hash opts = { url: 'http://custom-host:8080/wd/hub.com', caps: { @@ -100,6 +100,23 @@ def test_core_instance_variables_with_appium_prefix assert_equal :xcuitest, @core.automation_name end + def test_core_instance_variables_with_appium_prefix_string + opts = { + url: 'http://custom-host:8080/wd/hub.com', + caps: { + 'platformName' => 'ios', + 'appium:platformVersion' => '11.0', + 'appium:deviceName' => 'iPhone Simulator', + 'appium:automationName' => 'XCUITest', + 'appium:app' => '/path/to/MyiOS.app' + } + } + @core = Appium::Core.for(opts) + assert_equal 'http://custom-host:8080/wd/hub.com', @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', diff --git a/test/unit/driver_test.rb b/test/unit/driver_test.rb index 69bc4eea..9bfae767 100644 --- a/test/unit/driver_test.rb +++ b/test/unit/driver_test.rb @@ -79,14 +79,13 @@ def test_verify_appium_core_base_capabilities_create_capabilities assert_equal 'someCapability2', caps[:someCapability2] end - def test_verify_appium_core_base_capabilities_create_capabilities_with_caps + def test_verify_appium_core_base_capabilities_create_capabilities_with_caps_hash caps = ::Appium::Core::Base::Capabilities.new(platformName: 'ios', 'appium:platformVersion': '11.4', 'appium:automationName': 'XCUITest', 'appium:app': 'test/functional/app/UICatalog.app.zip') caps_with_json = JSON.parse(caps.to_json) - puts(caps_with_json) assert_equal 'ios', caps_with_json['platformName'] assert_equal 'XCUITest', caps_with_json['appium:automationName'] assert_equal 'test/functional/app/UICatalog.app.zip', caps_with_json['appium:app'] @@ -96,6 +95,22 @@ def test_verify_appium_core_base_capabilities_create_capabilities_with_caps assert_equal 'test/functional/app/UICatalog.app.zip', caps[:'appium:app'] end + def test_verify_appium_core_base_capabilities_create_capabilities_with_caps_string + caps = ::Appium::Core::Base::Capabilities.new('platformName' => 'ios', + 'appium:platformVersion' => '11.4', + 'appium:automationName' => 'XCUITest', + 'appium:app' => 'test/functional/app/UICatalog.app.zip') + + caps_with_json = JSON.parse(caps.to_json) + assert_equal 'ios', caps_with_json['platformName'] + assert_equal 'XCUITest', caps_with_json['appium:automationName'] + assert_equal 'test/functional/app/UICatalog.app.zip', caps_with_json['appium:app'] + + assert_equal 'ios', caps['platformName'] + assert_equal 'XCUITest', caps['appium:automationName'] + assert_equal 'test/functional/app/UICatalog.app.zip', caps['appium:app'] + end + def test_default_wait assert_equal 5, @core.default_wait end