tauri-apps / tauri-docs

The source for all Tauri project documentation.
https://tauri.app
MIT License
827 stars 625 forks source link

[request] e2e webdriver selenium examples #2430

Open bukowa opened 4 months ago

bukowa commented 4 months ago

Question you want answered

How do I test Tauri with selenium?

Where did you look for an answer?

As requested I post my question from Discord here ^^

Page URL

No response

Additional context

I created a generic Selenium library for Tauri (it is probably bloated as it's my first JavaScript code where I learned how to build a proper library and documentation). The documentation is available at https://bukowa.github.io/tauri-e2e/index.html, and I am using it successfully in my project. However, I don't think it would be a good addition to the Tauri v2 examples for how to perform end-to-end (E2E) testing.

As you can see here: https://github.com/bukowa/tauri-e2e/tree/master/selenium/javascript/src/selenium, implementing Selenium classes for WebKitGTK2 and WebView2 is quite simple, and it is possible to use them with the native Selenium API: https://bukowa.github.io/tauri-e2e/documents/3__Selenium_API.html. (The old documentation for V1 regarding Selenium was not working, which caused many issues.)

Is there any way that Tauri docs can benefit from some of this? I personally struggled a bit and have seen many issues about E2E testing problems. Currently, I am wondering if there are better ways to test the app than Selenium, perhaps using something more native to test everything and not just the webview part?

Are there any tracking issues or someone with more knowledge about how better and proper cross-platform testing can be performed?

Are you willing to work on this yourself?

rzmk commented 3 months ago

@bukowa Here's a past example I had for e2e using fantoccini: https://github.com/rzmk/tauri-windows-e2e-demo I've only implemented it for Windows though it could probably extended to Linux with tauri-driver but not sure about macOS. Also it may not be the most elegant solution so could be improved.