2016-09-21 51 views
2

我使用端对端测试量角器,我使用一个以上的测试规范。 从一个测试规范到另一个我发现我的鼠标在它是从以前的规范的最后位置离开。量角器测试 - 如何重置鼠标定位到默认原点

我想什么是鼠标从每个天赋的默认位置开始。 我相信会是左上角。

的目标是,我知道我的鼠标开始在每次测试开始时,我可以据此纠正我的测试,并且每个测试将鼠标在同一基线开始。

例如:

//Assume this is the first spec 
browser.actions().mouseMove(x: 15, y: 25).perform().then(function() { 
    //code 
}); 

//If this is in another spec, this mouseMove will start from the x: 15 & y: 25 location 
browser.actions().mouseMove(x: 153, y: 125).perform().then(function() { 
    //code 
}); 

回答

1
之前

或每个测试手动鼠标移动到 “0,0” 后:

browser.actions().mouseMove({x: 0, y: 0}).perform();