Skip to content

Commit

Permalink
Merge pull request #881 from webdriverio-community/sm/update-docs
Browse files Browse the repository at this point in the history
docs: add `appBinaryPath` examples
  • Loading branch information
goosewobbler authored Dec 20, 2024
2 parents 3292208 + 55a5fa5 commit 16d8ebb
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 41 deletions.
20 changes: 1 addition & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,7 @@ export const config = {
};
```

If you manually set the path to the Electron binary, make sure you set the path correctly for MacOS

_`wdio.conf.ts`_

```ts
export const config = {
// ...
capabilities: [
{
// ...
'wdio:electronServiceOptions': {
appBinaryPath: './path/to/built/app.app/Contents/MacOS/app',
// ...
},
},
],
// ...
};
```
See the [configuration doc](./docs/configuration/service-configuration.md#appbinarypath) for how to find your `appBinaryPath` value for the different operating systems supported by Electron.

Alternatively, you can point the service at an unpackaged app by providing the path to the `main.js` script. Electron will need to be installed in your `node_modules`. It is recommended to bundle unpackaged apps using a bundler such as Rollup, Parcel, Webpack, etc.

Expand Down
54 changes: 40 additions & 14 deletions docs/configuration/service-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,50 @@ Type: `string[]`

The path to the Electron binary of the app for testing. In most cases the service will determine the path to your app automatically [(check here)](#automatic-detection-of-app-binary), but if this fails for some reason, e.g. your app is in a different repository from your tests, then it is recommended to set this value manually.

If you manually set the path to the Electron binary, make sure you set the path correctly for MacOS
If you manually set the path to the Electron binary, the path will be in different formats depending on the build tool you are using, how that tool is configured, and which OS you are building the app on.

Here are some examples of binary paths using default build configurations for a hypothetical app called `myApp` which is built in the `workspace/myApp` directory:

#### MacOS (Arm)

```ts
export const config = {
// ...
capabilities: [
{
// ...
'wdio:electronServiceOptions': {
appBinaryPath: '/foo/bar/myOtherApp.app/Contents/MacOS/myOtherApp',
// ...
},
},
],
// ...
};
'/workspace/myApp/dist/mac-arm64/myApp.app/Contents/MacOS/myApp'; // Electron Builder
'/workspace/myApp/out/myApp-darwin-arm64/myApp.app/Contents/MacOS/myApp'; // Electron Forge
```

#### MacOS (Intel)

```ts
'/workspace/myApp/dist/mac-x64/myApp.app/Contents/MacOS/myApp'; // Electron Builder
'/workspace/myApp/out/myApp-darwin-x64/myApp.app/Contents/MacOS/myApp'; // Electron Forge
```

#### MacOS (Universal)

```ts
'/workspace/myApp/dist/mac-universal/myApp.app/Contents/MacOS/myApp'; // Electron Builder
'/workspace/myApp/out/myApp-darwin-universal/myApp.app/Contents/MacOS/myApp'; // Electron Forge
```

#### Linux

```ts
'/workspace/myApp/dist/linux-unpacked/myApp'; // Electron Builder
'/workspace/myApp/out/myApp-linux-x64/myApp'; // Electron Forge
```

#### Windows

```ts
'C:\\workspace\\myApp\\dist\\win-unpacked\\myApp.exe'; // Electron Builder
'C:\\workspace\\myApp\\out\\myApp-win32-x64\\myApp.exe'; // Electron Forge
```

Note:

- The above examples are just to illustrate the format of your app binary path - the actual binary path of your app depends on your configuration.
- Electron Forge uses a standardised output directory which is `out/{appName}-{OS}-{arch}`

Type: `string`

### `appEntryPoint`:
Expand Down
16 changes: 8 additions & 8 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
"clean": "pnpm dlx shx rm -rf ./test/js ./node_modules pnpm-lock.yaml ./wdio-logs* ./out",
"init-e2es": "pnpm dlx shx mkdir -p ./test/js && rollup -c rollup.config.js",
"logs": "pnpm dlx shx cat ./wdio-logs*/*.log",
"test:e2e:forge-cjs": "cross-env EXAMPLE_DIR=forge-cjs pnpm run exec",
"test:e2e:forge-esm": "cross-env EXAMPLE_DIR=forge-esm pnpm run exec",
"test:e2e:builder-cjs": "cross-env EXAMPLE_DIR=builder-cjs pnpm run exec",
"test:e2e:builder-esm": "cross-env EXAMPLE_DIR=builder-esm pnpm run exec",
"test:e2e-mac-universal:forge-cjs": "cross-env EXAMPLE_DIR=forge-cjs pnpm run exec",
"test:e2e-mac-universal:forge-esm": "cross-env EXAMPLE_DIR=forge-esm pnpm run exec",
"test:e2e-mac-universal:builder-cjs": "cross-env EXAMPLE_DIR=builder-cjs pnpm run exec",
"test:e2e-mac-universal:builder-esm": "cross-env EXAMPLE_DIR=builder-esm pnpm run exec",
"test:e2e:forge-cjs": "cross-env DEBUG=wdio-electron-service EXAMPLE_DIR=forge-cjs pnpm run exec",
"test:e2e:forge-esm": "cross-env DEBUG=wdio-electron-service EXAMPLE_DIR=forge-esm pnpm run exec",
"test:e2e:builder-cjs": "cross-env DEBUG=wdio-electron-service EXAMPLE_DIR=builder-cjs pnpm run exec",
"test:e2e:builder-esm": "cross-env DEBUG=wdio-electron-service EXAMPLE_DIR=builder-esm pnpm run exec",
"test:e2e-mac-universal:forge-cjs": "cross-env DEBUG=wdio-electron-service EXAMPLE_DIR=forge-cjs pnpm run exec",
"test:e2e-mac-universal:forge-esm": "cross-env DEBUG=wdio-electron-service EXAMPLE_DIR=forge-esm pnpm run exec",
"test:e2e-mac-universal:builder-cjs": "cross-env DEBUG=wdio-electron-service EXAMPLE_DIR=builder-cjs pnpm run exec",
"test:e2e-mac-universal:builder-esm": "cross-env DEBUG=wdio-electron-service EXAMPLE_DIR=builder-esm pnpm run exec",
"test:e2e:no-binary-cjs": "cross-env DEBUG=wdio-electron-service EXAMPLE_DIR=no-binary-cjs pnpm run exec-no-binary",
"test:e2e:no-binary-esm": "cross-env DEBUG=wdio-electron-service EXAMPLE_DIR=no-binary-esm pnpm run exec-no-binary",
"exec": "pnpm run exec:js && pnpm run exec:main && pnpm run exec:multiremote && pnpm run exec:standalone",
Expand Down

0 comments on commit 16d8ebb

Please sign in to comment.