量角器测试-如何将鼠标位置重置为默认原点

Protractor Test - How to Reset Mouse Location to Default Origin

本文关键字:默认 原点 位置 鼠标 测试 量角器      更新时间:2023-09-26

我正在使用量角器进行端到端测试,并且我正在使用多个测试规范。从一个测试规范到另一个测试规范,我注意到我的鼠标留在了前一个规范的最后一个位置。

我想要的是鼠标从每个规格的默认位置开始。我想应该是左上角。

我们的目标是,我知道我的鼠标在每个测试开始的地方,我可以相应地调整我的测试,每个测试将从鼠标在相同的基线开始。

例如:

//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
});

每次测试之前或之后手动将鼠标移动到" 0,0 ":

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