Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to perform actions while pressing a particular key or pointer button #198

Open
Andarist opened this issue Dec 2, 2021 · 6 comments

Comments

@Andarist
Copy link
Collaborator

Andarist commented Dec 2, 2021

To test some interactions we might have to do multiple things at once - like for example press space and move the pointer around while holding the left button of the mouse down to perform a "pan" in a canvas-based app (like in Figma, Excalidraw and more)

Should we introduce cy.realPressDown and cy.realPressUp to allow this? With this in place it should be possible to perform this sequence in a test - although it would be nice to also get some command for moving the pointer and this is related to #17

@dmtrKovalenko
Copy link
Owner

dmtrKovalenko commented Dec 2, 2021

Yep we can, but I prefer cy.realKeyDown and cy.realKeyUp naming. Not sure somebody will test painting on canvas with cypress. Oh and this can be problematic due to our coordinates system which is not so clear for cypress users.

@nileshgulia1
Copy link

I was wondering if this can also be made to work with clipboard, like copying and pasting ( meta+c,meta+v) ?
But I don't see in code where we are granting such permissions using CDP: https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-grantPermissions
Let me know and I will be happy to implement such feature!

@dmtrKovalenko
Copy link
Owner

dmtrKovalenko commented Dec 6, 2021

I think cypress itself is doing this on start for his own automation protocol, but making a test that makes copy and paste will be super helpful

@nileshgulia1
Copy link

Cypress doesn't have a full documented way of doing it for now. https://github.com/cypress-io/cypress-example-recipes/blob/master/examples/testing-dom__clipboard/cypress/integration/permissions-spec.js#L46
Also it doesn't handle "formatted text". As clipboard.readText and clipboard.writeText only deals with plain texts.

Actually, I started to implement it for our rich text editor library at EEA, but I need a way to somehow trigger a "copy" event ( without using document.execcommand , ofc).
https://github.com/eea/volto-slate/blob/8f81704d14eded91312d522ae8176ec859ed9462/cypress/integration/block-slate-format-boldlists.js#L16

@dmtrKovalenko
Copy link
Owner

@nileshgulia1 if you find this package not being able to do what you need – please submit a PR with a fix and a couple of tests that verify desired behavior

@Andarist
Copy link
Collaborator Author

Andarist commented Dec 6, 2021

@nileshgulia1 I'm not sure if that's currently possible - I can't find anything related to copy-pasting in the Chrome Debugger Protocol. And it seems that Playwright doesn't support this yet either: microsoft/playwright#8114 (they are using CDP under the hood as well)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants