Skip to content

Commit 8b70c86

Browse files
authored
add visual check for find by elemenet (#214)
* add visual check for find by elemenet * fix rubocop
1 parent f8338b9 commit 8b70c86

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/functional/ios/ios/image_comparison_test.rb

+7-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def test_image_comparison_get_images_result
8585
def test_image_element
8686
skip 'Requires `npm install -g appium opencv4nodejs`' unless `npm list -g opencv4nodejs`.include? 'opencv4nodejs'
8787

88-
@@driver.update_settings({ fixImageTemplateScale: true })
88+
@@driver.update_settings({ fixImageTemplateScale: true, getMatchedImageResult: true })
8989

9090
el = @@driver.find_element :accessibility_id, 'Buttons'
9191
@@driver.save_element_screenshot el, 'test/functional/data/test_ios_button.png'
@@ -97,6 +97,7 @@ def test_image_element
9797
assert image_element.inspect
9898
assert image_element.hash
9999
assert image_element.ref =~ /\Aappium-image-element-[a-z0-9\-]+/
100+
assert !image_element.visual.nil?
100101

101102
el_location = el.location
102103
image_location = image_element.location
@@ -120,6 +121,11 @@ def test_image_element
120121

121122
assert @@driver.find_element :accessibility_id, 'Gray'
122123
@@driver.back
124+
125+
@@driver.update_settings({ fixImageTemplateScale: true, getMatchedImageResult: false })
126+
image_element =
127+
@@core.wait { @@driver.find_element_by_image AppiumLibCoreTest.path_of('test/functional/data/test_ios_button.png') }
128+
assert_nil image_element.visual
123129
end
124130

125131
def test_image_elements

0 commit comments

Comments
 (0)