Skip to content

Commit

Permalink
Merge pull request #704 from webdriverio-community/sm/no-binary
Browse files Browse the repository at this point in the history
(feat): appEntryPoint
  • Loading branch information
goosewobbler authored Aug 19, 2024
2 parents b651372 + de5ed76 commit 8683003
Show file tree
Hide file tree
Showing 67 changed files with 2,402 additions and 1,812 deletions.
Binary file modified .github/assets/e2e-graph-mac-universal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .github/assets/e2e-graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
121 changes: 108 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ env:

jobs:
build:
name: Build & Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
os: [ubuntu-latest, macOS-latest]
node-version: [20.x]
fail-fast: false

Expand All @@ -37,33 +38,127 @@ jobs:
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-
- uses: pnpm/action-setup@v3
with:
version: 9.5.0
version: 9.7.0
run_install: false
- name: Set pnpm store path
run: |
pnpm config set store-dir ~/.pnpm-store --global
- name: Install Dependencies
run: |
pnpm install
if [ "$RUNNER_OS" == "Windows" ]; then
pnpm run ci:init-windows
pnpm install --no-frozen-lockfile
shell: bash
- name: Run Tests
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
# Run tasks in serial on Ubuntu to avoid Xvfb issues
pnpm run ci-linux
else
pnpm run ci
fi
shell: bash
- name: 🐛 Show logs
if: failure()
run: |
pnpm run ci:e2e:logs
- name: 🐛 Debug Build
uses: stateful/[email protected]
if: failure()
with:
timeout: '180000'
build-macos-universal:
name: MacOS Universal Build & Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macOS-latest]
node-version: [20.x]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Cache pnpm modules
uses: actions/cache@v4
env:
cache-name: cache-pnpm-modules
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-
- uses: pnpm/action-setup@v3
with:
version: 9.7.0
run_install: false
- name: Set pnpm store path
run: |
pnpm config set store-dir ~/.pnpm-store --global
- name: Install Dependencies
run: |
pnpm install
shell: bash
- name: Run Tests
run: |
pnpm run ci
pnpm run build
pnpm run ci-mac:e2e:mac-universal
shell: bash
- name: Run OS-specific Tests
- name: 🐛 Show logs
if: failure()
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
pnpm run ci:e2e:clean
pnpm install --no-frozen-lockfile
pnpm run ci:e2e:mac-universal
fi
pnpm run ci:e2e:logs
- name: 🐛 Debug Build
uses: stateful/[email protected]
if: failure()
with:
timeout: '180000'
build-windows:
name: Windows Build & Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
test: ['units', 'e2e:no-binary', 'e2e:builder-cjs', 'e2e:builder-esm', 'e2e:forge-cjs', 'e2e:forge-esm']
node-version: [20.x]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Cache pnpm modules
uses: actions/cache@v4
env:
cache-name: cache-pnpm-modules
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-
- uses: pnpm/action-setup@v3
with:
version: 9.7.1
run_install: false
- name: Set pnpm store path
run: |
pnpm config set store-dir ~/.pnpm-store --global
- name: Install Dependencies
run: |
pnpm install
shell: bash
- name: Run Tests
run: |
pnpm run build
pnpm run ci-windows:${{ matrix.test }}
shell: bash
- name: 🐛 Show logs
if: failure()
run: |
pnpm run ci:e2e:logs
- name: 🐛 Debug Build
uses: stateful/vscode-server-action@v1
uses: stateful/vscode-server-action@v1.1.0
if: failure()
with:
timeout: '180000'
2 changes: 1 addition & 1 deletion .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
node-version: 20.x
- uses: pnpm/action-setup@v3
with:
version: 9.5.0
version: 9.7.1
run_install: false
- name: Package Manager Setup
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
node-version: 20.x
- uses: pnpm/action-setup@v3
with:
version: 9.5.0
version: 9.7.1
run_install: false
- name: Package Manager Setup
run: |
Expand Down
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,27 @@ export const config = {
{
'browserName': 'electron',
'wdio:electronServiceOptions': {
appBinaryPath: './path/to/bundled/electron/app.exe',
appBinaryPath: './path/to/built/electron/app.exe',
appArgs: ['foo', 'bar=baz'],
},
},
],
// ...
};
```

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.

_`wdio.conf.ts`_

```ts
export const config = {
// ...
capabilities: [
{
'browserName': 'electron',
'wdio:electronServiceOptions': {
appEntryPoint: './path/to/bundled/electron/main.bundle.js',
appArgs: ['foo', 'bar=baz'],
},
},
Expand Down
16 changes: 8 additions & 8 deletions apps/builder-cjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-node-resolve": "^15.2.1",
"@types/node": "^20.14.14",
"@wdio/cli": "9.0.0-alpha.426",
"@wdio/globals": "9.0.0-alpha.426",
"@wdio/local-runner": "9.0.0-alpha.367",
"@wdio/mocha-framework": "9.0.0-alpha.426",
"@wdio/cli": "^9.0.4",
"@wdio/globals": "^9.0.4",
"@wdio/local-runner": "^9.0.4",
"@wdio/mocha-framework": "^9.0.4",
"cross-env": "^7.0.3",
"electron": "^31.3.1",
"electron": "^31.4.0",
"electron-builder": "^25.0.1",
"global-jsdom": "^24.0.0",
"jsdom": "^24.1.1",
"rollup": "^4.20.0",
"rollup": "^4.21.0",
"ts-loader": "^9.4.4",
"tsx": "^4.16.5",
"tsx": "^4.17.0",
"typescript": "^5.5.4",
"webdriverio": "9.0.0-alpha.369"
"webdriverio": "^9.0.4"
},
"peerDependencies": {
"typescript": "5.2.2"
Expand Down
Empty file modified apps/builder-cjs/tsconfig.json
100755 → 100644
Empty file.
16 changes: 8 additions & 8 deletions apps/builder-esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.1",
"@types/node": "^20.14.14",
"@wdio/cli": "9.0.0-alpha.426",
"@wdio/globals": "9.0.0-alpha.426",
"@wdio/local-runner": "9.0.0-alpha.367",
"@wdio/mocha-framework": "9.0.0-alpha.426",
"@wdio/cli": "^9.0.4",
"@wdio/globals": "^9.0.4",
"@wdio/local-runner": "^9.0.4",
"@wdio/mocha-framework": "^9.0.4",
"cross-env": "^7.0.3",
"electron": "^31.3.1",
"electron": "^31.4.0",
"electron-builder": "^25.0.1",
"global-jsdom": "^24.0.0",
"jsdom": "^24.1.1",
"rollup": "^4.20.0",
"rollup": "^4.21.0",
"ts-loader": "^9.4.4",
"tsx": "^4.16.5",
"tsx": "^4.17.0",
"typescript": "^5.5.4",
"webdriverio": "9.0.0-alpha.369"
"webdriverio": "^9.0.4"
},
"peerDependencies": {
"typescript": "5.2.2"
Expand Down
Empty file modified apps/builder-esm/tsconfig.json
100755 → 100644
Empty file.
18 changes: 9 additions & 9 deletions apps/forge-cjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"build:package:mac-universal": "cp ./src/index.html ./dist && electron-forge package --platform=darwin --arch=universal",
"build:mac-universal": "pnpm build:bundle && pnpm build:package:mac-universal",
"ci": "pnpm i && pnpm build && pnpm test",
"clean": "pnpm clean:dist && pnpm dlx shx rm -rf ./node_modules ./package-lock.json ./wdio-logs ./out",
"clean": "pnpm clean:dist && pnpm dlx shx rm -rf ./node_modules ./wdio-logs",
"clean:dist": "pnpm dlx shx rm -rf ./dist ./out && pnpm dlx shx mkdir -p ./dist"
},
"dependencies": {
Expand All @@ -21,19 +21,19 @@
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-node-resolve": "^15.2.1",
"@types/node": "^20.14.14",
"@wdio/cli": "9.0.0-alpha.426",
"@wdio/globals": "9.0.0-alpha.426",
"@wdio/local-runner": "9.0.0-alpha.367",
"@wdio/mocha-framework": "9.0.0-alpha.426",
"@wdio/cli": "^9.0.4",
"@wdio/globals": "^9.0.4",
"@wdio/local-runner": "^9.0.4",
"@wdio/mocha-framework": "^9.0.4",
"cross-env": "^7.0.3",
"electron": "^31.3.1",
"electron": "^31.4.0",
"global-jsdom": "^24.0.0",
"jsdom": "^24.1.1",
"rollup": "^4.20.0",
"rollup": "^4.21.0",
"ts-loader": "^9.4.4",
"tsx": "^4.16.5",
"tsx": "^4.17.0",
"typescript": "^5.5.4",
"webdriverio": "9.0.0-alpha.369"
"webdriverio": "^9.0.4"
},
"peerDependencies": {
"typescript": "5.2.2"
Expand Down
18 changes: 9 additions & 9 deletions apps/forge-esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"build:package": "cp ./src/index.html ./dist && electron-forge package",
"build:package:mac-universal": "cp ./src/index.html ./dist && electron-forge package --platform=darwin --arch=universal",
"build:mac-universal": "pnpm build:bundle && pnpm build:package:mac-universal",
"clean": "pnpm clean:dist && pnpm dlx shx rm -rf ./node_modules ./package-lock.json ./wdio-logs ./out",
"clean": "pnpm clean:dist && pnpm dlx shx rm -rf ./node_modules ./wdio-logs",
"clean:dist": "pnpm dlx shx rm -rf ./dist ./out && pnpm dlx shx mkdir -p ./dist"
},
"dependencies": {
Expand All @@ -22,19 +22,19 @@
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-node-resolve": "^15.2.1",
"@types/node": "^20.14.14",
"@wdio/cli": "9.0.0-alpha.426",
"@wdio/globals": "9.0.0-alpha.426",
"@wdio/local-runner": "9.0.0-alpha.367",
"@wdio/mocha-framework": "9.0.0-alpha.426",
"@wdio/cli": "^9.0.4",
"@wdio/globals": "^9.0.4",
"@wdio/local-runner": "^9.0.4",
"@wdio/mocha-framework": "^9.0.4",
"cross-env": "^7.0.3",
"electron": "^31.3.1",
"electron": "^31.4.0",
"global-jsdom": "^24.0.0",
"jsdom": "^24.1.1",
"rollup": "^4.20.0",
"rollup": "^4.21.0",
"ts-loader": "^9.4.4",
"tsx": "^4.16.5",
"tsx": "^4.17.0",
"typescript": "^5.5.4",
"webdriverio": "9.0.0-alpha.369"
"webdriverio": "^9.0.4"
},
"peerDependencies": {
"typescript": "5.2.2"
Expand Down
Binary file added apps/forge-esm/src/assets/icon/webdriverio.icns
Binary file not shown.
Binary file added apps/forge-esm/src/assets/icon/webdriverio.ico
Binary file not shown.
Binary file added apps/forge-esm/src/assets/icon/webdriverio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions apps/forge-esm/src/assets/icon/webdriverio.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified apps/forge-esm/tsconfig.json
100755 → 100644
Empty file.
5 changes: 5 additions & 0 deletions apps/no-binary-cjs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# no-binary-cjs

A CJS project for a minimal Electron app, designed to provide E2E testing for `wdio-electron-service`.

The app is not built but has been bundled.
35 changes: 35 additions & 0 deletions apps/no-binary-cjs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "example-no-binary-cjs",
"version": "1.0.0",
"main": "dist/main.bundle.js",
"private": true,
"scripts": {
"build": "tsc && rollup -c rollup.config.mjs && cp ./src/index.html ./dist",
"clean": "pnpm clean:dist && pnpm dlx shx rm -rf ./node_modules ./wdio-logs",
"clean:dist": "pnpm dlx shx rm -rf ./dist && pnpm dlx shx mkdir -p ./dist"
},
"dependencies": {
"wdio-electron-service": "workspace:*"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-node-resolve": "^15.2.1",
"@types/node": "^20.14.12",
"@wdio/cli": "^9.0.4",
"@wdio/globals": "^9.0.4",
"@wdio/local-runner": "^9.0.4",
"@wdio/mocha-framework": "^9.0.4",
"cross-env": "^7.0.3",
"electron": "^31.4.0",
"global-jsdom": "^24.0.0",
"jsdom": "^24.1.1",
"rollup": "^4.21.0",
"ts-loader": "^9.4.4",
"tsx": "^4.17.0",
"typescript": "^5.5.4",
"webdriverio": "^9.0.4"
},
"peerDependencies": {
"typescript": "5.2.2"
}
}
25 changes: 25 additions & 0 deletions apps/no-binary-cjs/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { nodeResolve } from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';

export default [
{
input: 'dist/preload.js',
output: {
file: 'dist/preload.bundle.js',
inlineDynamicImports: true,
format: 'cjs',
},
plugins: [nodeResolve(), commonjs()],
external: ['electron'],
},
{
input: 'dist/main.js',
output: {
file: 'dist/main.bundle.js',
inlineDynamicImports: true,
format: 'cjs',
},
plugins: [nodeResolve(), commonjs()],
external: ['electron'],
},
];
Loading

0 comments on commit 8683003

Please sign in to comment.