Feature Request: Coordinate-based mouse control for canvas/drawing apps (working prototype included) #1584
Unanswered
mauricekindermann
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm building a big canvas-based design tool and needed to test drag interactions on a FabricJS canvas. The existing drag() method works great for element-to-element dragging, but canvas tools need coordinate-based mouse control.
I haven't found any discussions or examples showing what I need to do, so I ended up building a small Mouse class that talks directly to Playwright's mouse API via the Client. I also wrapped the Pest browser in a CavasTestHelpers class so I can call canvas()-> and chain domain-specific methods like assertCanvasObjectCount(2) while still proxying through to Pest's methods via __call. Saves me writing lots of repetitive raw ->script() tags and needing to escape the visit constantly.
My tests are passing and
--debugshows objects are moving as you'd expect. I'd love to see the mouse functionality built into the plugin natively.Example:
Proof of concept:
The only hack is using reflection to get the page GUID since it's private. If this were built into Pest it wouldn't be needed.
Beta Was this translation helpful? Give feedback.
All reactions