对于protracor有点新手,但我试图实现的基本上是一个检查(从另一个函数)执行一个操作,然后执行相同的检查(从早先的相同函数)。两个函数的比较结果
我曾尝试以下,但unforunately得到Failed: first is not defined
checkCanvasWidth: {
value: function() {
return element(by.css("div[class='canvasWrapper'] > canvas")).getAttribute("width").then(function(width) {
return width;
});
}
},
zoomIn: {
value: function() {
this.checkCanvasWidth().then(function (width) {
var first = width;
console.log("before:" + width);
});
//performs a click
this.clickZoomIn();
this.checkCanvasWidth().then(function (width) {
var second = width;
console.log("after:" + width);
});
expect(first).toBeGreaterThan(second);
}
}
任何帮助将大规模感激!
谢谢Shilly,我确实需要承诺版本!这是我正在努力,但没有意识到 –