Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] codegen: Electron Support #5181

Closed
Marcus10110 opened this issue Dec 4, 2020 · 6 comments
Closed

[Feature] codegen: Electron Support #5181

Marcus10110 opened this issue Dec 4, 2020 · 6 comments

Comments

@Marcus10110
Copy link

Fantastic project! I'd love to see codegen support for Eelectron!

There are no projects that I'm aware of that support test click recording inside of an electron application. This would greatly simplify E2E testing for electron apps.

Thanks for a great project!

@Marcus10110
Copy link
Author

Well, it's very crude, but I have a proof of concept here:
saleae/playwright-cli#1

I didn't want to open a PR because it's just a proof of concept, and shouldn't be merged.

This might be enough for my needs, at least it's enough to evaluate this for use with our electron application.

Quite impressed with this codebase!

@pavelfeldman
Copy link
Member

I didn't want to open a PR because it's just a proof of concept, and shouldn't be merged.

Why not, I think it looks promising!

  • I can help resolving the mouse issue
  • Having Electron as a dev dependency (a kind of a peer dependency) would work
  • Close signal is also a good idea

Feel free to file it, I'm sure others will find it useful as well.

@Marcus10110
Copy link
Author

Thanks for the feedback!

I've made some changes to the PR, and it seems to work reliably for codegen.
saleae/playwright-cli#1

I also tossed together another PR that attempts to add electron support to all of playwright-cli, rather than just hacking it into the codegen function. It's pretty messy at the moment, and suffers from a square peg/round hole problem.
saleae/playwright-cli#2

When I have more time I'll play with the ElectronApplication API a bit more and see if I can make it behave the same way the other browsers do, which have a clear separation between creating the browser instance and opening a page. Right now I'm using the electron launch args to automatically open a page, which more or less breaks the pattern used everywhere in playwright-cli.

Unfortunately, the electron context throws an error when openPage is called, but it might be possible to replace that with an explicit browser window open.

Also for a time I had successfully connected electron page close with the cli exiting, but I seem to have broken it again.

@dgozman dgozman transferred this issue from microsoft/playwright-cli Jan 27, 2021
@dgozman dgozman changed the title Request: codegen Electron Support [Feature] codegen: Electron Support Jan 27, 2021
@pavelfeldman
Copy link
Member

I'll close this as a part of the bug triaging process. We have hundreds of bugs and feature requests with dozens and even hundreds of upvotes, while this one only has a few thumbs up. Please feel free to open a new bug and link this one if you'd like to see it addressed.

@shadow-light
Copy link

I'd love to see Electron fully supported in the CLI etc. Should there be a new issue to track full Electron support?

(seems like there was but got closed #584 to merge into another, which then also got closed #647)

@aquarius-wing
Copy link

How to codegen by using electron?
Using "Codegen with custom setup"?
I wrote the js file with "findLatestBuild('dist_electron')", but I don't know how to run it.
The npx playwright codegen doesn't have option to set setup file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants