为了账号安全,请及时绑定邮箱和手机立即绑定

如何覆盖React Native功能测试?

如何覆盖React Native功能测试?

元芳怎么了 2018-11-16 19:15:44
如何覆盖React Native功能测试
查看完整描述

1 回答

?
阿晨1998

TA贡献2037条经验 获得超6个赞

describe('base', function() {
this.timeout(5 * 60 * 1000);

var driver = wd.initPromiseChain();

driver.configureHttp({
timeout: 300 * 60 * 1000
});

before(function() {
return driver .initDriver();
});

after(function() {
return driver .sleep(1000)
.quit();
});

it('#1 login picture should be the same.', function() {
return driver .sleep(40 * 1000)
.waitForElementByName('autoresponsive')
.takeScreenshot()
.then(imgData => {
var newImg = new Buffer(imgData, 'base64');
var screenshotFolder = path.resolve(__dirname, '../screenshot');
var oldImgPath = path.join(screenshotFolder, process.env.platform === 'android' ? 'android.png' : 'ios.png');
var diffImgPath = path.join(screenshotFolder, process.env.platform === 'android' ? 'android-diff.png' : 'ios-diff.png');
return diffImage(oldImgPath, newImg, 0.3, diffImgPath);
})
.then(result => {
result.should.be.true();
})
.catch(e => {
console.log(e);
});
});});



查看完整回答
反对 回复 2018-12-13
  • 1 回答
  • 0 关注
  • 669 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信