|
@@ -40,12 +40,26 @@ class APILink():
|
|
|
return False
|
|
|
|
|
|
#对比样本快照与当前快照
|
|
|
- def contrast_snapshot(self,url,expected_screenshot,current_screenshot,element,clip):
|
|
|
+ def contrast_snapshot(self,url,expected_screenshot,current_screenshot,clip):
|
|
|
# 如果不存在样本照片,生成样本照片
|
|
|
- self.save_screenshot(url, expected_screenshot,element,clip)
|
|
|
- INFO(f"样本快照已保存:{expected_screenshot}")
|
|
|
+ if not os.path.exists(expected_screenshot):
|
|
|
+ self.save_screenshot(url, expected_screenshot,clip)
|
|
|
+ INFO(f"样本快照已保存:{expected_screenshot}")
|
|
|
#生成对比照片
|
|
|
- apilink.save_screenshot(url, current_screenshot,element,clip)
|
|
|
+ apilink.save_screenshot(url, current_screenshot,clip)
|
|
|
+ INFO(f"对比快照已保存:{expected_screenshot}")
|
|
|
+ #返回对比结果
|
|
|
+ result = apilink.compare_images(current_screenshot, expected_screenshot)
|
|
|
+ return result
|
|
|
+
|
|
|
+#对比样本快照与当前快照2
|
|
|
+ def contrast_snapshot_mask(self,url,expected_screenshot,current_screenshot,element,clip):
|
|
|
+ # 如果不存在样本照片,生成样本照片
|
|
|
+ if not os.path.exists(expected_screenshot):
|
|
|
+ self.save_screenshot_mask(url, expected_screenshot,element,clip)
|
|
|
+ INFO(f"样本快照已保存:{expected_screenshot}")
|
|
|
+ #生成对比照片
|
|
|
+ apilink.save_screenshot_mask(url, current_screenshot,element,clip)
|
|
|
INFO(f"对比快照已保存:{expected_screenshot}")
|
|
|
#返回对比结果
|
|
|
result = apilink.compare_images(current_screenshot, expected_screenshot)
|