Meteor Desktop Plugin Test Suite
Few utils to ease out functional testing of Meteor Desktop plugins.
getElectronPath
Returns path to electron bin.
createTestApp(installPath, pluginName)
Creates a test app with the your plugin included.
constructPlugin(app, log, app, appSettings, eventsBus, modules, settings, Module)
It is instantiating your plugin. You can supply mocks for any params your plugin would normally receive from the skeleton app.
Pass undefined
if your plugin does not use certain param or if you want to use some defaults provided by this test suite. Check here to see what is passed by default.
fireEventsBusEvent(app, eventToFire, ...eventArgs)
Fires an event on the events bus, so you can simulate for example a system event on which you plugin is listening.
send(app, module, event, ...args)
Sends an IPC event to your module. Equivalent of Desktop.send
.
Use if your plugin/module registers itself via let module = new Module('myModuleName')
.
fetch(app, module, event, ...args)
Fetches some data from main process by sending an IPC event and waiting for a response.
Equivalent of Desktop.fetch
.
fireEventsBusEventAndWaitForAnother(app, eventToFire, eventToListenFor, ...eventArgs)
Fires an event on the events bus and then waits for an another event to be emitted. Useful for example when your plugin is doing some stuff on afterLoading
event and signalizes readiness via another event.
sendIpc(app, ...args)
Sends an IPC message to the main process.
sendIpcSync(app, ...args)
Same as above but sync. However also returns a Promise
as it is transferred through chromedriver.
sendIpcAndWaitForResponse(app, eventToSend, eventToListenFor, ...eventArgs)
Sends an IPC event and waits for an another IPC event to come.
class Logger(show, showErrors)
Fake logger that eventually can write the logs to the console. You can set show
to false
and showErrors
to true
to only see errors passed to it.
Example
An example of usage in tests is here meteor-desktop-splash-screen and here meteor-desktop-localstorage.