mechanical-orchard / playwright-elixir

An Elixir library for Playwright web automation
MIT License
119 stars 23 forks source link

Implement basic versions of Page.Keyboard #52

Closed germsvel closed 5 months ago

germsvel commented 5 months ago

What changed?

We implement a basic version of Page.Keyboard functions whose specs were commented out in the module.

The test cases are the simplest versions I could come up with (having borrowed heavily from Python's keyboard tests)

The implementation also follows Python's implementations.

Noteworthy Highlights

  1. Our implementation takes a %Page{} struct rather than what the specs suggested (a Keyboard.t()). I don't know if it's possible to pass down a narrower type, but as far as I could tell Page had both the session and guid (which are needed for the Channel.post call).

  2. We namespace Playwright.Keyboard under Page (i.e. Playwright.Page.Keyboard) to match the directory structure and since that seems to match the Playwright documentation as well.

  3. Finally, we add a new test/assets/ directory where we include a new inputs/keyboard.html page. That page is copied directly from Python, so it follows Python's style of testing. In particular, our tests needed the getResult() function to get the values back for our test assertions.

coreyti commented 5 months ago

Hey @germsvel, thanks for the contribution!

I made some adjustments in commits:

Those are worth a quick look. And, any feedback/suggestions based on those would be great.

The other 4 commits are not directly related to your changes, but came along in my rebasing (the PR revealed some missing changes needed). I've decided to be okay with having those "tag along" with your PR 🤷🤩

All that said, I'm happy to merge your change. Please continue. 🙂