(element, distance)
| 217 | } |
| 218 | |
| 219 | export const mouseDownOnElementAndMove = async (element, distance) => { |
| 220 | const coordinates = getElementCoordinates(element) |
| 221 | triggerEvent(element, "mousedown", coordinates) |
| 222 | |
| 223 | const destination = (offset) => ({ |
| 224 | clientX: coordinates.clientX + offset, |
| 225 | clientY: coordinates.clientY + offset, |
| 226 | }) |
| 227 | |
| 228 | const dragSpeed = 20 |
| 229 | await delay(dragSpeed) |
| 230 | |
| 231 | let offset = 0 |
| 232 | const drag = async () => { |
| 233 | if (++offset <= distance) { |
| 234 | triggerEvent(element, "mousemove", destination(offset)) |
| 235 | await delay(dragSpeed) |
| 236 | drag() |
| 237 | } else { |
| 238 | triggerEvent(element, "mouseup", destination(distance)) |
| 239 | await delay(dragSpeed) |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | drag() |
| 244 | } |
| 245 | |
| 246 | const typeCharacterInElement = async (character, element) => { |
| 247 | const charCode = character.charCodeAt(0) |
nothing calls this directly
no test coverage detected
searching dependent graphs…