cypress-real-events
cypress-real-events copied to clipboard
Make it possible to perform actions while pressing a particular key or pointer button
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 https://github.com/dmtrKovalenko/cypress-real-events/pull/17
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.
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!
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
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
@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
@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: https://github.com/microsoft/playwright/issues/8114 (they are using CDP under the hood as well)