Skip to content

Commit

Permalink
Merge pull request #858 from webdriverio-community/sm/improve-no-binary
Browse files Browse the repository at this point in the history
feat: improved standalone interface
  • Loading branch information
goosewobbler authored Dec 11, 2024
2 parents 32457f6 + f68a0e6 commit da13272
Show file tree
Hide file tree
Showing 65 changed files with 1,237 additions and 1,224 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@ bin/LICENSE
bin/LICENSES.chromium.html
bin/gen

# Integration test logs
wdio-logs*
wdio-multiremote-logs*

# OS files
.DS_Store

Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# JS Test Files (these are transpiled from TS)
e2e/test/js/*.spec.js
14 changes: 7 additions & 7 deletions apps/builder-cjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
"wdio-electron-service": "workspace:*"
},
"devDependencies": {
"@types/node": "^22.9.1",
"@wdio/cli": "^9.2.14",
"@wdio/globals": "^9.2.14",
"@wdio/local-runner": "^9.2.15",
"@types/node": "^22.10.1",
"@wdio/cli": "^9.4.1",
"@wdio/globals": "^9.4.1",
"@wdio/local-runner": "^9.4.1",
"@wdio/mocha-framework": "^9.2.8",
"electron": "^33.2.0",
"electron": "^33.2.1",
"electron-builder": "^25.1.8",
"tsx": "^4.19.2",
"typescript": "^5.6.3",
"webdriverio": "^9.2.14"
"typescript": "^5.7.2",
"webdriverio": "^9.4.1"
},
"build": {
"asar": true,
Expand Down
2 changes: 1 addition & 1 deletion apps/builder-cjs/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { app, BrowserWindow, ipcMain } from 'electron';
import { isTest } from './util.js';
const isTest = process.env.TEST === 'true';

if (isTest) {
require('wdio-electron-service/main');
Expand Down
4 changes: 2 additions & 2 deletions apps/builder-cjs/src/preload.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { contextBridge, ipcRenderer } from 'electron';
import { isTest } from './util.js';
const { contextBridge, ipcRenderer } = require('electron');
const isTest = process.env.TEST === 'true';

if (isTest) {
require('wdio-electron-service/preload');
Expand Down
1 change: 0 additions & 1 deletion apps/builder-cjs/src/util.ts

This file was deleted.

14 changes: 7 additions & 7 deletions apps/builder-esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
"wdio-electron-service": "workspace:*"
},
"devDependencies": {
"@types/node": "^22.9.1",
"@wdio/cli": "^9.2.14",
"@wdio/globals": "^9.2.14",
"@wdio/local-runner": "^9.2.15",
"@types/node": "^22.10.1",
"@wdio/cli": "^9.4.1",
"@wdio/globals": "^9.4.1",
"@wdio/local-runner": "^9.4.1",
"@wdio/mocha-framework": "^9.2.8",
"electron": "^33.2.0",
"electron": "^33.2.1",
"electron-builder": "^25.1.8",
"tsx": "^4.19.2",
"typescript": "^5.6.3",
"webdriverio": "^9.2.14"
"typescript": "^5.7.2",
"webdriverio": "^9.4.1"
},
"build": {
"asar": true,
Expand Down
2 changes: 1 addition & 1 deletion apps/builder-esm/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { app, BrowserWindow, ipcMain } from 'electron';
import { isTest } from './util.js';
const isTest = process.env.TEST === 'true';

if (isTest) {
import('wdio-electron-service/main');
Expand Down
26 changes: 11 additions & 15 deletions apps/builder-esm/src/preload.cts
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import { contextBridge, ipcRenderer } from 'electron';
const { contextBridge, ipcRenderer } = require('electron');
const isTest = process.env.TEST === 'true';

(async () => {
// util.js is an ESM module so we need to use dynamic import
const { isTest } = await import('./util.js');
if (isTest) {
require('wdio-electron-service/preload');
}

if (isTest) {
require('wdio-electron-service/preload');
}
const validChannels = ['increase-window-size', 'decrease-window-size'];

const validChannels = ['increase-window-size', 'decrease-window-size'];
const invoke = (channel: string, ...data: unknown[]) =>
validChannels.includes(channel) ? ipcRenderer.invoke(channel, data) : Promise.reject();

const invoke = (channel: string, ...data: unknown[]) =>
validChannels.includes(channel) ? ipcRenderer.invoke(channel, data) : Promise.reject();

contextBridge.exposeInMainWorld('api', {
invoke,
});
})();
contextBridge.exposeInMainWorld('api', {
invoke,
});
1 change: 0 additions & 1 deletion apps/builder-esm/src/util.ts

This file was deleted.

18 changes: 9 additions & 9 deletions apps/forge-cjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@
"wdio-electron-service": "workspace:*"
},
"devDependencies": {
"@electron-forge/cli": "^7.5.0",
"@electron-forge/cli": "^7.6.0",
"@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-typescript": "^12.1.1",
"@types/node": "^22.9.1",
"@wdio/cli": "^9.2.14",
"@wdio/globals": "^9.2.14",
"@wdio/local-runner": "^9.2.15",
"@types/node": "^22.10.1",
"@wdio/cli": "^9.4.1",
"@wdio/globals": "^9.4.1",
"@wdio/local-runner": "^9.4.1",
"@wdio/mocha-framework": "^9.2.8",
"electron": "^33.2.0",
"rollup": "^4.27.3",
"electron": "^33.2.1",
"rollup": "^4.28.1",
"tsx": "^4.19.2",
"typescript": "^5.6.3",
"webdriverio": "^9.2.14"
"typescript": "^5.7.2",
"webdriverio": "^9.4.1"
}
}
2 changes: 1 addition & 1 deletion apps/forge-cjs/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { app, BrowserWindow, ipcMain } from 'electron';
import { isTest } from './util.js';
const isTest = process.env.TEST === 'true';

if (isTest) {
require('wdio-electron-service/main');
Expand Down
2 changes: 1 addition & 1 deletion apps/forge-cjs/src/preload.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { contextBridge, ipcRenderer } from 'electron';
import { isTest } from './util.js';
const isTest = process.env.TEST === 'true';

if (isTest) {
require('wdio-electron-service/preload');
Expand Down
1 change: 0 additions & 1 deletion apps/forge-cjs/src/util.ts

This file was deleted.

18 changes: 9 additions & 9 deletions apps/forge-esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@
"wdio-electron-service": "workspace:*"
},
"devDependencies": {
"@electron-forge/cli": "^7.5.0",
"@electron-forge/cli": "^7.6.0",
"@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-typescript": "^12.1.1",
"@types/node": "^22.9.1",
"@wdio/cli": "^9.2.14",
"@wdio/globals": "^9.2.14",
"@wdio/local-runner": "^9.2.15",
"@types/node": "^22.10.1",
"@wdio/cli": "^9.4.1",
"@wdio/globals": "^9.4.1",
"@wdio/local-runner": "^9.4.1",
"@wdio/mocha-framework": "^9.2.8",
"electron": "^33.2.0",
"rollup": "^4.27.3",
"electron": "^33.2.1",
"rollup": "^4.28.1",
"tsx": "^4.19.2",
"typescript": "^5.6.3",
"webdriverio": "^9.2.14"
"typescript": "^5.7.2",
"webdriverio": "^9.4.1"
}
}
2 changes: 1 addition & 1 deletion apps/forge-esm/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { app, BrowserWindow, ipcMain } from 'electron';
import { isTest } from './util.js';
const isTest = process.env.TEST === 'true';

if (isTest) {
await import('wdio-electron-service/main');
Expand Down
23 changes: 10 additions & 13 deletions apps/forge-esm/src/preload.cts
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import { contextBridge, ipcRenderer } from 'electron';

(async () => {
// util.js is an ESM module so we need to use dynamic import
const { isTest } = await import('./util.js');
const isTest = process.env.TEST === 'true';

if (isTest) {
require('wdio-electron-service/preload');
}
if (isTest) {
require('wdio-electron-service/preload');
}

const validChannels = ['increase-window-size', 'decrease-window-size'];
const validChannels = ['increase-window-size', 'decrease-window-size'];

const invoke = (channel: string, ...data: unknown[]) =>
validChannels.includes(channel) ? ipcRenderer.invoke(channel, data) : Promise.reject();
const invoke = (channel: string, ...data: unknown[]) =>
validChannels.includes(channel) ? ipcRenderer.invoke(channel, data) : Promise.reject();

contextBridge.exposeInMainWorld('api', {
invoke,
});
})();
contextBridge.exposeInMainWorld('api', {
invoke,
});
1 change: 0 additions & 1 deletion apps/forge-esm/src/util.ts

This file was deleted.

16 changes: 8 additions & 8 deletions apps/no-binary-cjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
"@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-typescript": "^12.1.1",
"@types/node": "^22.9.1",
"@wdio/cli": "^9.2.14",
"@wdio/globals": "^9.2.14",
"@wdio/local-runner": "^9.2.15",
"@types/node": "^22.10.1",
"@wdio/cli": "^9.4.1",
"@wdio/globals": "^9.4.1",
"@wdio/local-runner": "^9.4.1",
"@wdio/mocha-framework": "^9.2.8",
"electron": "^33.2.0",
"rollup": "^4.27.3",
"electron": "^33.2.1",
"rollup": "^4.28.1",
"tsx": "^4.19.2",
"typescript": "^5.6.3",
"webdriverio": "^9.2.14"
"typescript": "^5.7.2",
"webdriverio": "^9.4.1"
}
}
2 changes: 1 addition & 1 deletion apps/no-binary-cjs/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { app, BrowserWindow, ipcMain } from 'electron';
import { isTest } from './util.js';
const isTest = process.env.TEST === 'true';

if (isTest) {
require('wdio-electron-service/main');
Expand Down
2 changes: 1 addition & 1 deletion apps/no-binary-cjs/src/preload.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { contextBridge, ipcRenderer } from 'electron';
import { isTest } from './util.js';
const isTest = process.env.TEST === 'true';

if (isTest) {
require('wdio-electron-service/preload');
Expand Down
1 change: 0 additions & 1 deletion apps/no-binary-cjs/src/util.ts

This file was deleted.

16 changes: 8 additions & 8 deletions apps/no-binary-esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
"@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-typescript": "^12.1.1",
"@types/node": "^22.9.1",
"@wdio/cli": "^9.2.14",
"@wdio/globals": "^9.2.14",
"@wdio/local-runner": "^9.2.15",
"@types/node": "^22.10.1",
"@wdio/cli": "^9.4.1",
"@wdio/globals": "^9.4.1",
"@wdio/local-runner": "^9.4.1",
"@wdio/mocha-framework": "^9.2.8",
"electron": "^33.2.0",
"rollup": "^4.27.3",
"electron": "^33.2.1",
"rollup": "^4.28.1",
"tsx": "^4.19.2",
"typescript": "^5.6.3",
"webdriverio": "^9.2.14"
"typescript": "^5.7.2",
"webdriverio": "^9.4.1"
}
}
2 changes: 1 addition & 1 deletion apps/no-binary-esm/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { app, BrowserWindow, ipcMain } from 'electron';
import { isTest } from './util.js';
const isTest = process.env.TEST === 'true';

if (isTest) {
await import('wdio-electron-service/main');
Expand Down
23 changes: 10 additions & 13 deletions apps/no-binary-esm/src/preload.cts
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import { contextBridge, ipcRenderer } from 'electron';

(async () => {
// util.js is an ESM module so we need to use dynamic import
const { isTest } = await import('./util.js');
const isTest = process.env.TEST === 'true';

if (isTest) {
require('wdio-electron-service/preload');
}
if (isTest) {
require('wdio-electron-service/preload');
}

const validChannels = ['increase-window-size', 'decrease-window-size'];
const validChannels = ['increase-window-size', 'decrease-window-size'];

const invoke = (channel: string, ...data: unknown[]) =>
validChannels.includes(channel) ? ipcRenderer.invoke(channel, data) : Promise.reject();
const invoke = (channel: string, ...data: unknown[]) =>
validChannels.includes(channel) ? ipcRenderer.invoke(channel, data) : Promise.reject();

contextBridge.exposeInMainWorld('api', {
invoke,
});
})();
contextBridge.exposeInMainWorld('api', {
invoke,
});
1 change: 0 additions & 1 deletion apps/no-binary-esm/src/util.ts

This file was deleted.

6 changes: 6 additions & 0 deletions e2e/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# JS Test Files (these are transpiled from TS)
test/js

# Logs
wdio-logs*
wdio-multiremote-logs*
Loading

0 comments on commit da13272

Please sign in to comment.