问题描述
因此,我找到了这个https://www.npmjs.com/package/protractor-image-comparison作为用于在量角器测试中比较图像的插件。但是,我以某种方式收到此错误:
TypeError: Cannot read property 'checkElement' of undefined
我不知道该怎么办。我已经按照网站上的指南进行操作,还已经删除了mode_modules文件夹,并做了 npm安装。
plugins: [{
// The module name
//path: 'node_modules/protractor-image-comparison/build/',// package: 'protractor-image-comparison',inline: require('protractor-image-comparison'),options: {
// baselineFolder: join(process.cwd(),"/imageTest/base"),// screenshotPath: join(process.cwd(),"/imageTest/actual"),baselineFolder: `${process.cwd()}/imageTest/base`,screenshotPath: `${process.cwd()}/imageTest/actual`,formatimageName: `{tag}-{logName}-{width}x{height}`,savePerInstance: true,},]
我尝试了上面注释中列出的内容(希望这样做可能有帮助吗?)
public async checkImage() {
await expect(await browser.protractorImageComparison.checkElement(await browser.element(by.xpath(("//image"))),"baselineImage")).to.equal(0);
}
baselineImage 是存储在baselineFolder中的.png文件
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)