Skip to content

Commit

Permalink
add tests more
Browse files Browse the repository at this point in the history
  • Loading branch information
KazuCocoa committed Aug 2, 2024
1 parent 8d7994c commit e382b22
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
19 changes: 18 additions & 1 deletion test/unit/appium_lib_core_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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',
Expand Down
19 changes: 17 additions & 2 deletions test/unit/driver_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand All @@ -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
Expand Down

0 comments on commit e382b22

Please sign in to comment.