本文整理匯總了Python中toolium.visual_test.VisualTest.exclude_elements方法的典型用法代碼示例。如果您正苦於以下問題:Python VisualTest.exclude_elements方法的具體用法?Python VisualTest.exclude_elements怎麽用?Python VisualTest.exclude_elements使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類toolium.visual_test.VisualTest
的用法示例。
在下文中一共展示了VisualTest.exclude_elements方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_exclude_no_elements
# 需要導入模塊: from toolium.visual_test import VisualTest [as 別名]
# 或者: from toolium.visual_test.VisualTest import exclude_elements [as 別名]
def test_exclude_no_elements(driver_wrapper):
# Exclude no elements
visual = VisualTest(driver_wrapper)
img = Image.open(file_v1)
img = visual.exclude_elements(img, [])
# Assert output image
assert_image(visual, img, 'report_name', 'register')
示例2: test_exclude_elements
# 需要導入模塊: from toolium.visual_test import VisualTest [as 別名]
# 或者: from toolium.visual_test.VisualTest import exclude_elements [as 別名]
def test_exclude_elements(driver_wrapper):
# Create elements mock
visual = VisualTest(driver_wrapper)
web_elements = [get_mock_element(x=250, y=40, height=40, width=300),
get_mock_element(x=250, y=90, height=20, width=100)]
img = Image.open(file_v1) # Exclude elements
img = visual.exclude_elements(img, web_elements)
# Assert output image
assert_image(visual, img, 'report_name', 'register_exclude')
示例3: test_exclude_elements
# 需要導入模塊: from toolium.visual_test import VisualTest [as 別名]
# 或者: from toolium.visual_test.VisualTest import exclude_elements [as 別名]
def test_exclude_elements(driver_wrapper):
# Create elements mock
driver_wrapper.driver.execute_script.return_value = 0 # scrollX=0 and scrollY=0
visual = VisualTest(driver_wrapper)
web_elements = [get_mock_element(x=250, y=40, height=40, width=300),
get_mock_element(x=250, y=90, height=20, width=100)]
img = Image.open(file_v1) # Exclude elements
img = visual.exclude_elements(img, web_elements)
# Assert output image
assert_image(visual, img, 'report_name', 'register_exclude')
示例4: VisualTests
# 需要導入模塊: from toolium.visual_test import VisualTest [as 別名]
# 或者: from toolium.visual_test.VisualTest import exclude_elements [as 別名]
#.........這裏部分代碼省略.........
# Resize image
img = Image.open(self.file_v1)
img = self.visual.crop_element(img, web_element)
# Assert output image
self.assert_image(img, self._testMethodName, 'register_cropped_element')
def test_mobile_resize(self):
# Update conf and create a new VisualTest instance
self.driver_wrapper.driver.get_window_size.return_value = {'width': 375, 'height': 667}
self.driver_wrapper.config.set('Driver', 'type', 'ios')
self.visual = VisualTest(self.driver_wrapper)
# Resize image
img = Image.open(self.file_ios)
img = self.visual.mobile_resize(img)
# Assert output image
self.assert_image(img, self._testMethodName, 'ios_resized')
def test_mobile_no_resize(self):
# Update conf and create a new VisualTest instance
self.driver_wrapper.driver.get_window_size.return_value = {'width': 750, 'height': 1334}
self.driver_wrapper.config.set('Driver', 'type', 'ios')
self.visual = VisualTest(self.driver_wrapper)
# Resize image
orig_img = Image.open(self.file_ios)
img = self.visual.mobile_resize(orig_img)
# Assert that image object has not been modified
assert_equal(orig_img, img)
def test_exclude_elements(self):
# Create elements mock
web_elements = [get_mock_element(x=250, y=40, height=40, width=300),
get_mock_element(x=250, y=90, height=20, width=100)]
img = Image.open(self.file_v1)
# Exclude elements
img = self.visual.exclude_elements(img, web_elements)
# Assert output image
self.assert_image(img, self._testMethodName, 'register_exclude')
def test_exclude_element_outofimage(self):
# Create elements mock
web_elements = [get_mock_element(x=250, y=40, height=40, width=1500)]
img = Image.open(self.file_v1)
# Exclude elements
img = self.visual.exclude_elements(img, web_elements)
# Assert output image
self.assert_image(img, self._testMethodName, 'register_exclude_outofimage')
def test_exclude_no_elements(self):
# Exclude no elements
img = Image.open(self.file_v1)
img = self.visual.exclude_elements(img, [])
# Assert output image
self.assert_image(img, self._testMethodName, 'register')
def test_assert_screenshot_no_enabled_force(self):
# Configure driver mock