diff --git a/test/functional/ios/webdriver/device_test.rb b/test/functional/ios/webdriver/device_test.rb index 4f9f6b09..f9419a72 100644 --- a/test/functional/ios/webdriver/device_test.rb +++ b/test/functional/ios/webdriver/device_test.rb @@ -69,7 +69,7 @@ def test_page_source assert !source.include?('AppiumAUT') assert source.include?('XCUIElementTypeApplication type') - assert_in_delta 80, xml[2].elements.each('//*') { |v| v }.map(&:name).size, 5 # rubocop:disable Lint/Void: + assert xml[2].elements.each('//*') { |v| v }.map(&:name).size > 70 # rubocop:disable Lint/Void s_source = @@driver.page_source s_xml = REXML::Document.new s_source @@ -77,7 +77,8 @@ def test_page_source assert s_source.include?('AppiumAUT') assert s_source.include?('XCUIElementTypeApplication type') - assert [78, 81].include?(s_xml[2].elements.each('//*') { |v| v }.map(&:name).size) # rubocop:disable Lint/Void: + # Roughly matching... + assert s_xml[2].elements.each('//*') { |v| v }.map(&:name).size > 70 # rubocop:disable Lint/Void end def test_location diff --git a/test/unit/android/device/mjsonwp/commands_test.rb b/test/unit/android/device/mjsonwp/commands_test.rb index 305dbb10..59738971 100644 --- a/test/unit/android/device/mjsonwp/commands_test.rb +++ b/test/unit/android/device/mjsonwp/commands_test.rb @@ -94,11 +94,15 @@ def test_current_package def test_get_system_bars stub_request(:get, "#{SESSION}/appium/device/system_bars") - .to_return(headers: HEADER, status: 200, body: { value: 'A' }.to_json) + .to_return(headers: HEADER, status: 200, body: { value: { + statusBar: { visible: true, x: 0, y: 0, width: 1080, height: 63 }, + navigationBar: { visible: true, x: 0, y: 1794, width: 1080, height: 126 } + } }.to_json) - @driver.get_system_bars + info = @driver.get_system_bars assert_requested(:get, "#{SESSION}/appium/device/system_bars", times: 1) + assert_equal({ 'visible' => true, 'x' => 0, 'y' => 0, 'width' => 1080, 'height' => 63 }, info['statusBar']) end def test_get_display_density diff --git a/test/unit/android/device/w3c/commands_test.rb b/test/unit/android/device/w3c/commands_test.rb index 0db3d539..160fb8b9 100644 --- a/test/unit/android/device/w3c/commands_test.rb +++ b/test/unit/android/device/w3c/commands_test.rb @@ -93,11 +93,15 @@ def test_current_package def test_get_system_bars stub_request(:get, "#{SESSION}/appium/device/system_bars") - .to_return(headers: HEADER, status: 200, body: { value: 'A' }.to_json) + .to_return(headers: HEADER, status: 200, body: { value: { + statusBar: { visible: true, x: 0, y: 0, width: 1080, height: 63 }, + navigationBar: { visible: true, x: 0, y: 1794, width: 1080, height: 126 } + } }.to_json) - @driver.get_system_bars + info = @driver.get_system_bars assert_requested(:get, "#{SESSION}/appium/device/system_bars", times: 1) + assert_equal({ 'visible' => true, 'x' => 0, 'y' => 0, 'width' => 1080, 'height' => 63 }, info['statusBar']) end def test_get_display_density