最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Finding the mouse position in Cypress - Stack Overflow

programmeradmin1浏览0评论

Problem/Desire

Im currently trying to find the position of my mouse when testing in Cypress. I'm trying to work with WebGL models and since I can't grab those individually to be able to grab the model and move them around I was thinking of using the page coordinates/mouse position so its close enough.

Found a possible solution

I had found a closed issue on Cypress' github about this, but it wouldn't install so if any of you know why it's throwing the attached error or an easier way to find out what the position is let me know! It will be greatly appreciated.

Cypress closed issue | Mouse position

Photo of error in terminal

(sorry for the bad pen marking; trying to scribble out my last name) I ran the code given in the closed issue which was:

npm i -D cypress-mouse-position

then added these in the two files:

cypress/plugins/index.js


module.exports = (on, config) => {
  # ...
  initCypressMousePositionPlugin(on);
  # ...
}

cypress/support/index.js

import 'cypress-mouse-position/mands';

Problem/Desire

Im currently trying to find the position of my mouse when testing in Cypress. I'm trying to work with WebGL models and since I can't grab those individually to be able to grab the model and move them around I was thinking of using the page coordinates/mouse position so its close enough.

Found a possible solution

I had found a closed issue on Cypress' github about this, but it wouldn't install so if any of you know why it's throwing the attached error or an easier way to find out what the position is let me know! It will be greatly appreciated.

Cypress closed issue | Mouse position

Photo of error in terminal

(sorry for the bad pen marking; trying to scribble out my last name) I ran the code given in the closed issue which was:

npm i -D cypress-mouse-position

then added these in the two files:

cypress/plugins/index.js


module.exports = (on, config) => {
  # ...
  initCypressMousePositionPlugin(on);
  # ...
}

cypress/support/index.js

import 'cypress-mouse-position/mands';
Share Improve this question edited May 22, 2019 at 8:42 Joshua 3,2063 gold badges26 silver badges41 bronze badges asked May 20, 2019 at 22:20 HyeEunHyeEun 7072 gold badges9 silver badges19 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

It looks like the author of cypress-mouse-position never actually published his package to NPM, so I've done it for him.

You should now be able to do npm i -D cypress-mouse-position without encountering any errors, since it is now published on NPM.

发布评论

评论列表(0)

  1. 暂无评论