* {{> moveCursorTo }} *
(locator, offsetX = 0, offsetY = 0)
| 1499 | * |
| 1500 | */ |
| 1501 | async moveCursorTo(locator, offsetX = 0, offsetY = 0) { |
| 1502 | let context = null |
| 1503 | if (typeof offsetX !== 'number') { |
| 1504 | context = offsetX |
| 1505 | offsetX = 0 |
| 1506 | } |
| 1507 | |
| 1508 | let el |
| 1509 | if (context) { |
| 1510 | const contextEls = await this._locate(context) |
| 1511 | assertElementExists(contextEls, context, 'Context element') |
| 1512 | el = await findElements.call(this, contextEls[0], locator) |
| 1513 | assertElementExists(el, locator) |
| 1514 | el = el[0] |
| 1515 | } else { |
| 1516 | el = await this._locateElement(locator) |
| 1517 | assertElementExists(el, locator) |
| 1518 | } |
| 1519 | |
| 1520 | // Use manual mouse.move instead of .hover() so the offset can be added to the coordinates |
| 1521 | const { x, y } = await clickablePoint(el) |
| 1522 | await this.page.mouse.move(x + offsetX, y + offsetY) |
| 1523 | return this._waitForAction() |
| 1524 | } |
| 1525 | |
| 1526 | /** |
| 1527 | * {{> focus }} |
nothing calls this directly
no test coverage detected