I’ve been messing around with creating some Obsidian plugins, but ran into issues writing end-to-end tests for them. Some people have managed to get WebdriverIO working with Obsidian such as here, but the configuration is pretty difficult to setup.
I went down a bit of a rabbit hole on how to do this and ended up writing a package to make it easier, wdio-obsidian-service. It’s a service that can be used by WebdriverIO that handles automatically downloading different Obsidian versions, sandboxing the test Obsidian instance, loading your plugin, opening test vaults, and can even be run in GitHub workflows for CI! I’m going to be using this for some plugins I’ve been working on, and I think other Obsidian plugin developers might find it useful.
I have a plugin ongoing here (nothing big, it create a tab with info inside, save into md files, etc…) and I wish to create some automatique tests. I tried jest (but complicate as need obsidian API), etc… even pyautogui, but nothing works.
I saw WebDriverIO and tried it, but with electron, clearly it’s complicated. Your package seems cool, Sadly I m not a professional of Electron, could you tell me step by step how to use your to create a end to end test.
Pratically, I wish to test like that (I simplify).
right click on a directory
click on option1 menu
=> my tab plugin open with info.
=> do some change inside the view.
=> check that the file.md was updated.
Is it possible to do that with WebdriverIO and your package ? thanks for your help.
Sure! There are setup instructions here that should be able to get you going with WebdriverIO. The npm init wdio@latest command step described there does most of the setup for you, and then the rest of the docs describe a few config tweaks you need to make WebdriverIO work with Obsidian.