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
[BUG][Electron] filechooser event not emitted when dialog.show(Open|Save)Dialog is called #8278
Comments
I'm also having trouble with showOpenDialogSync and showSaveDialogSync because the test stopped. |
I have create a test repo to trying to mock electron dialog like Does not work, but returned This Does anyone may have time to help to find out why? |
I am also having this issue and have been looking for a solution. @wsw0108 I am quite new to JS testing, but I will have a look into your code if I get some time. Please report back! |
@Daveiano I have found the fail cause, it's the async thing of electron ipc. The mock works actually. |
Based on spectron-fake-dialog, I wrote a little library to fake electron dialog for playwright/electron, |
Awesome! Can actually simplify this and just do: const electronApp = await playwright._electron.launch({ args: ['./main.js']});
// ...
// in test:
electronApp.evaluate(
async({ dialog }, filePaths) => {
dialog.showOpenDialog = () => Promise.resolve({ canceled: false, filePaths });
},
['file.txt']
); |
@MikeJerred Elegant solution. Can I use your idea to update my repo? |
Yep of course |
@wsw0108 I am getting this error when using playwright-fake-dialog
Setup is the following:
Any help and suggestions would be very appreciated! |
using 0.1.0 needs above lines in your electron main.js. If you use html input, just use filechooser from playwright. |
Ah, got you, thank you! I got it working now with the snippet from @MikeJerred, many thanks for that! |
H, i need some help to use the playwright-fake-dialog, do i need any code from "test/preload.js"?(https://github.com/wsw0108/electron-playwright-test/blob/master/test/preload.js). This is my code
And i get this ERROR in our Log-File: Our Application uses Electron 9, could that be a problem? |
best method, you can also control dialogs like so:
|
Investigation:
|
Duplicate of #5013. Full details and repro steps available there.
Opening new issue as requested by maintainers on original issue.
This is definitely a blocker for our integration tests as we need to test open and save functionality in our app and we're not able to select the files in the dialogs.
The text was updated successfully, but these errors were encountered: