mechanical-orchard / playwright-elixir

An Elixir library for Playwright web automation
MIT License
107 stars 21 forks source link

Generate client modules from spec? #5

Open michallepicki opened 3 years ago

michallepicki commented 3 years ago

Hi!

I saw that other similar projects (playwright-sharp and others) generate the client modules from playwright API specification JSON file.

Is there plan to do the same here? There are multiple ways to do that in Elixir I think, one could be an approach similar to what chrome_remote_interface Elixir package does.

coreyti commented 3 years ago

Hi @michallepicki,

Thanks for reaching out... great question/suggestion. We'd been holding off on code generation while learning how to go about this, but do like the idea and it feels like it's now probably about time to implement.

We'll take a look at that example and see what we can do to get started. Also, happy to take PRs :)

hubertlepicki commented 3 years ago

I was looking at this task and, not wanting to discourage you, gave up when I was doing my internal experiment with playwright and elixir. The major problem for me was that the API Playwright exposes is really Object Oriented in nature, making the translation not as natural as it is in Ruby, JavaScript or C#. Really curious what you come up here :)

coreyti commented 3 years ago

That's a good point, @hubertlepicki, and something I've struggled with from time to time: when to make things look more like Playwright vs. when to make them more like Elixir.

So, I think that, for now, we'll probably continue with manual additions/fixes until getting close to feature parity. Then we can use the insights gained to see what sorts of automated generation would make best sense.