简体   繁体   English

与从移动设备获取的实际图像和屏幕截图进行比较

[英]Comparsion with the actual image and screenshot taken from the mobile device

Problem: 问题:

We have a web page which we load inside the Android App and iOS App. 我们有一个网页,可在Android App和iOS App中加载。 the web page is having a header slot and footer slot and a banner slot for the image. 该网页具有用于图像的页眉和页脚插槽以及横幅插槽。

When developers attach the URL's of the images to the header, footer and banner slots most of the times the images are not fitting within the screens. 当开发人员将图像的URL附加到页眉,页脚和横幅槽时,大多数情况下图像不适合屏幕。 1. They cross the boundaries of the screen size 2. Image with text content is hidden by the button in the banner slot 1.它们跨越屏幕尺寸的边界。2.具有文字内容的图像被横幅广告位中的按钮隐藏

We have to do an automation which actually checks if the images are not overlapped with the button in the banner slot and the images are not going beyond the screen sizes after the images appear in the device. 我们必须执行一个自动化操作,该操作实际上检查图像是否与横幅插槽中的按钮不重叠,并且在图像出现在设备中之后图像是否不超出屏幕尺寸。

I checked few ideas like Sikuli and some screenshot comparison libraries. 我检查了一些想法,例如Sikuli和一些屏幕截图比较库。 What I'm looking for is some tool that is closer to the human recognition which can tell whether the image is going beyond the limit. 我正在寻找的是一种更接近人类识别能力的工具,可以判断图像是否超出极限。

Can someone tell me which library or tool I can use to automate this? 有人可以告诉我可以使用哪个库或工具来自动执行此操作吗?

I'm uploading the image how our web page looks like 我正在上传图片,我们的网页看起来像 在此处输入图片说明

Look into Espresso . 看看意式浓缩咖啡 It's a UAT framework for Android. 这是用于Android的UAT框架。 It basically allows you to auto test your app at runtime. 它基本上允许您在运行时自动测试您的应用程序。

You could assert something like the following: 您可以声明以下内容:

onView(withId(R.id.headerImage))
    .check(matches(isCompletelyDisplayed()));
onView(withId(R.id.bodyImage))
    .check(matches(isCompletelyDisplayed()));
onView(withId(R.id.footerImage))
    .check(matches(isCompletelyDisplayed()));

If any of these items are cut off, your test will throw an error. 如果这些项目中的任何一项被删除,您的测试将引发错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM