问题描述
目前我正在使用 wdio-image-comparison-service 进行图像比较,以比较元素或图像的两个屏幕截图。我使用 browser.saveElement 函数来获取第一个元素的屏幕截图,我想与另一个图像进行比较,为此我使用了 browser.checkElement 函数。 我为此使用了以下代码:
//taking screenshot for comparison
browser.saveElement($("//span[@data-action='move'][1]"),'UploadWallpaper',{ /* some options */ });
//Checking screenshot with imagecropper element screenshot
const imagecropper ="//div[@class='io-imagecropper text-center']/img";
expect(browser.checkElement($(imagecropper),{ })
).toEqual(0);
browser.pause(2000);
在配置文件中我写了如下服务:
services: ['selenium-standalone','visual-regression',['image-comparison',// The options
{
// Some options,see the docs for more
baselineFolder: join(process.cwd(),'./tests/'),formatimageName: '{tag}-{logName}-{width}x{height}',screenshotPath: join(process.cwd(),'.tmp/'),savePerInstance: true,autoSaveBaseline: true,blockOutStatusBar: true,blockOutToolBar: true,ignorenothing: true // Without this option,it errors out only when mismatch is above 1.23%
// ... more options
}],],
这段代码在我的本地机器上按预期工作,但是当我尝试在 jenkins 上运行相同的代码时,它给我两个函数的错误作为 typeError。
有人可以为此提出任何解决方案吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)