webdriverio / webdriverio/desktop-mobile

Converge multiremote launcher/worker wiring into native-core

Open
#656 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

scope:dioxus scope:electrobun scope:native-core scope:tauri type:task
Dominant language
TypeScript
Stars
13
Forks
6
Avg merge
2d 3h
Merged PRs (30d)
33

Description

Follow-up from #635 (electrobun Linux parallel + multiremote). Reviewing multiremote across electron / tauri / dioxus / electrobun surfaced wiring that each service re-derives by hand — and electrobun got a subtle piece wrong (per-instance connection params on the inner caps instead of the outer wrapper → Linux/W3C multiremote didn't route; fixed in #635). The correct behavior should be the default a new W3C service inherits, not something it re-discovers. Relevant as RN + Flutter still owe multiremote (#446) and Capacitor/Neutralino are on the roadmap.

Principle: unify the contract + correctness-critical wiring; leave the per-framework mechanism alone.

Core deliverable — extract into native-core
  • Connection-param placement helper. normaliseInstanceCaps(capabilities) → { caps, connectionTarget }[]. WDIO reads per-instance hostname/port from the outer { capabilities } wrapper for multiremote, but hoists them out of the caps object for single-session (@wdio/runner initializeInstance + sanitizeCaps). Encapsulate that so no service writes to the wrong place again. (Applies to the pre-spawned-W3C-server class: tauri external/embedded, dioxus embedded, electrobun-WebKitGTK — not the CDP-attach class, which puts debuggerAddress/--inspect inside caps and lets WDIO own the port.)
  • Worker-side instance iteration helper. forEachInstance(browser, (instance, caps) => …) wrapping the isMultiremote → loop instances → per-instance caps resolution (electron's alwaysMatch unwrap, electrobun's capabilityFor). Boilerplate replicated 4×; electrobun's attachInstance/capabilityFor is the cleanest model to lift.
Related convergence (checklist)
  • Per-instance port allocation — standardize on PortManager/get-port. base+i (dioxus-embedded, tauri-embedded) risks cross-worker collisions (cf. the ghost-port / hardcoded-4444 history); audit those paths before switching.
  • Teardown hygiene — always remove per-instance temp resources on teardown. Electrobun rms its bundle clones; tauri leaves generateDataDirectory temp dirs to the OS. (Independently grabbable — small standalone tauri cleanup.)
  • Multiremote-safety guard — shared warn/error helper driven by a per-service isolatesInstances(platform) descriptor; keep the per-service policy local. Today: electron none, tauri perWorkerMode, dioxus none, electrobun macOS-CEF warn.
Explicitly OUT of scope (legitimate, framework-dictated — do not unify)
  • Isolation mechanism: bundle clone (electrobun, path-scoped reap) vs XDG_DATA_HOME/TAURI_DATA_DIR (tauri) vs process+port only (dioxus/electron).
  • Driver model: WDIO-managed chromedriver (CDP) vs launcher-pre-spawned W3C server.
  • Setup hook: onPrepare (electron/tauri/dioxus) vs onWorkerStart (electrobun, dynamic per-worker ports) — both correct; just document the choice in the add-native-service runbook so it isn't copied by accident.
Definition of done

Helpers for the two core items live in native-core and are adopted by the pre-spawned-server services; add-native-service references them. Checklist items can land incrementally.

Refs: #635, #633, #446

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing electrobun's attachInstance/capabilityFor pattern with WDIO's initializeInstance and sanitizeCaps behavior, then inspect the pre-spawned-server services using the repeated multiremote wiring. Define the two helpers in native-core and adopt them in the applicable services, while checking port allocation and teardown paths. Done means the helpers are used by those services and the add-native-service runbook documents the setup-hook choice.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
testing, tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.