Standard approach for writing automated end-to-end tests for plugins?

As the plugins I’ve authored have gotten more complex, I’ve been wondering more and more about how best to write automated tests for them.

@trashhalo wrote an amazingly helpful example repo using Spectron for end-to-end tests. However, Spectron is now (as of next week) deprecated, and I’ve been having trouble porting the examples to an alternative such as Playwright – Specifically, the hardest part has been just getting a version of Obsidian running in the correct vault, and with my plugin enabled. (@trashhalo, if you see this, would you be willing to talk more through the details of how you figured out the vaultOpen and enablePlugin steps, whether here or in the repo?)

Could anyone here speak to whether there are any existing plans for an “official” or central set of mocks, or an updated example for end-to-end tests from the Obsidian developers or from elsewhere in the community?

4 Likes

For anyone reading this in the future, I’ve gotten automated tests working using Webdriver.io without Spectron in a plugin here.

2 Likes

Hello @L.J

Thanks a lot for sharing this, it looks incredibly helpful.

If you have time, would you mind sharing how you run the tests front he configurations in your plugin? I feel I am a complete novice to TS/JS and if you could direct me to some steps, that would be awesome!

Thanks in advance
Carlo

2 Likes