Skip to content

(@wdio/cli): Simplified Electron setup#11406

Merged
christian-bromann merged 3 commits intomainfrom
cb/electron-setup
Oct 12, 2023
Merged

(@wdio/cli): Simplified Electron setup#11406
christian-bromann merged 3 commits intomainfrom
cb/electron-setup

Conversation

@christian-bromann
Copy link
Member

Proposed changes

After releasing v5.2.0 of our Electron service, we can simplify the setup required for running tests on Electron Applications.

Types of changes

  • Polish (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • I have added proper type definitions for new commands (if appropriate)

Further comments

This setup was tested on the Electron Boilerplate.

Reviewers: @webdriverio/project-committers

@christian-bromann christian-bromann added the PR: Polish 💅 PRs that contain improvements on existing features label Oct 12, 2023
Copy link
Member

@erwinheitzman erwinheitzman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, fine improvements 👏

## More Information

You can learn more about how to configure the [`wdio-electron-service`](https://www.npmjs.com/package/wdio-electron-service) in the [service docs](/docs/wdio-electron-service).
You can learn more about how to configure the [`wdio-electron-service`](https://www.npmjs.com/package/wdio-electron-service) in the [service docs](/docs/wdio-electron-service). Make sure to check out our [Electron boilerplate project](https://github.com/webdriverio/electron-boilerplate/actions/runs/6490587562/job/17626575914) that showcases how to intergate WebdriverIO in an example application.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean to link to the CI output here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, good catch!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed: 52cd25c

const isTest = process.env.NODE_ENV === 'test'
if (isTest) {
import('wdio-electron-service/main');
require('wdio-electron-service/main');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed this change in the boilerplate project too, are there issues using dynamic import here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This I believe fails if your Electron project is forced to use a CJS setup in your tsconfig.json. AFAIK the Electron ecosystem still has no good support for ESM. While it is not impossible to get it working (looking at the service example), I wanted to make sure to not have it failing either due to type issues and using require here is just a safe way to demonstrate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Polish 💅 PRs that contain improvements on existing features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants