tauri icon indicating copy to clipboard operation
tauri copied to clipboard

feat(core): expose test utils

Open lucasfernog opened this issue 3 years ago • 2 comments
trafficstars

What kind of change does this PR introduce?

  • [ ] Bugfix
  • [x] Feature
  • [ ] Docs
  • [ ] New Binding issue #___
  • [ ] Code style update
  • [ ] Refactor
  • [ ] Build-related changes
  • [ ] Other, please describe:

Does this PR introduce a breaking change?

  • [ ] Yes, and the changes were approved in issue #___
  • [ ] No

Checklist

  • [ ] When resolving issues, they are referenced in the PR's title (e.g fix: remove a typo, closes #___, #___)
  • [x] A change file is added if any packages will require a version bump due to this PR per the instructions in the readme.
  • [ ] I have added a convincing reason for adding this feature, if necessary

Other information

lucasfernog avatar Jul 24 '22 13:07 lucasfernog

I think this is a useful and important addition. I would love to see this get merged in the near future. I'm happy to help if there's some addition work required.

jhutchins avatar Sep 07 '22 17:09 jhutchins

Currently it only has a mock implementation for global shortcut and clipboard, but it could be a target for 1.2.

lucasfernog avatar Sep 07 '22 21:09 lucasfernog

This would be a nice to have feature indeed. Will it be picked up again at some point?

nanderstabel avatar Mar 10 '23 14:03 nanderstabel

@lucasfernog What's the status on this? I've been meaning to write some unit tests and setting up a mock app is vital for that process. 🙂

simonhyll avatar Mar 11 '23 04:03 simonhyll

I recognize that this might not be considered feature complete, but would it be possible to merge what's already been done and add to it over time? This is useful as is. I use it for unit testing my application, but that requires me to maintain my own fork of tauri. It would be nice to get back to not having to do that while also having tests.

I guess my question is what's the minimal amount of additional work needs to be done before this can be merged?

jhutchins avatar Jun 05 '23 15:06 jhutchins

I'll take a look at this again and target it for v1.4.

lucasfernog avatar Jun 05 '23 15:06 lucasfernog

Now this is looking :fire:

  • basic event loop functionality (exit when all windows are closed just like the actual Tauri behavior)
  • API to run a command and assert it's response matches
  • mock tauri::App, tauri::Builder, tauri::Context
  • documentation with examples

lucasfernog avatar Jun 06 '23 18:06 lucasfernog

This looks awesome!

jhutchins avatar Jun 06 '23 21:06 jhutchins