pptr-testing-library icon indicating copy to clipboard operation
pptr-testing-library copied to clipboard

Proposal: event wrapper

Open amh4r opened this issue 3 years ago • 2 comments

What's the feasibility for creating an event wrapper that mimics the user-event API? Not something that actually uses user-event, but rather makes Puppeteer event code look like user-event code.

For example, instead of this:

await page.keyboard.type("Gordon")
await page.keyboard.press("Tab")
await page.keyboard.type("Freeman")

You'd do something like this:

const user = userEvent.setup(page)
await user.keyboard("Gordon")
await user.tab()
await user.keyboard("Freeman")

It seems straightforward, but are there dragons I'm missing?

amh4r avatar May 22 '22 13:05 amh4r

Did you ever do any further research behind that?

indifferentghost avatar Jun 26 '23 19:06 indifferentghost

This sounds like a great addition. I would love to use the same API for my React unit tests and Puppeteer driven e2e tests.

BudgieInWA avatar Aug 24 '23 04:08 BudgieInWA