webdriverio-community / wdio-electron-service

WebdriverIO service for testing Electron applications
https://webdriver.io
MIT License
34 stars 15 forks source link

Provide utility function to allow using this service without the testrunner #412

Closed christian-bromann closed 5 months ago

christian-bromann commented 8 months ago

This is inspired by a conversation in https://github.com/webdriverio/webdriverio/issues/12128

It would be nice to provide a way to allow users to use this service in a normal Node.js script without having to use the testrunner. I could see a custom remote method taking the same parameters as the webdriverio version would do but internally would run all the hooks before returning the instance. Note that beforeCommand or afterCommand work in standalone too.

goosewobbler commented 8 months ago

@christian-bromann this sounds somewhat related to #331 (the above bug in particular), do you think this feature would include starting electron without a binary or is it completely separate?

christian-bromann commented 8 months ago

@goosewobbler these features are different. #331 is about allowing users to test an Electron app without bundling it. This issue describes a feature where a user can use this service without having to run the wdio testrunner. Imagine a Node.js script like this:

import { startSession } from 'wdio-electron-service`

const ide = await startSession({
  electronVersion: '1.2.3',
  appBinaryPath: './path/to/bundled/electron/app.exe',
  appArgs: ['foo', 'bar=baz'],
})

where startSession takes a parameter to define the Electron application (no WebdriverIO.Config - instead only properties related for Electron automation) and returns a WebdriverIO.Browser.

goosewobbler commented 8 months ago

Got it, I was pretty sure they were separate but also had an optimistic thought that one might solve the other...perhaps if the testrunner is the root cause of the unbundled app not receiving args...let's see.

christian-bromann commented 5 months ago

Thanks for the work @goosewobbler - I released the docs: https://webdriver.io/docs/desktop-testing/electron/standalone