Skip to content

feat: add HarmonyOS driver as standalone npm package (detox-driver-ha… - #4971

Open
RuiYangLian wants to merge 2 commits into
wix:masterfrom
RuiYangLian:master
Open

RuiYangLian wants to merge 2 commits into
wix:masterfrom
RuiYangLian:master

Conversation

@RuiYangLian

@RuiYangLian RuiYangLian commented Aug 17, 2026

Copy link
Copy Markdown

This PR adds HarmonyOS (OpenHarmony) support as a standalone driver package (detox-driver-harmony), using Detox's built-in External driver mechanism.

@RuiYangLian
RuiYangLian requested a review from noomorph as a code owner August 17, 2026 09:46
…rmony)

External driver package for testing RNOH (React Native on HarmonyOS) apps
with Detox. Uses Detox's built-in External driver mechanism — zero changes
to Detox core (except 1-line bug fix in RuntimeDevice.js).

Package: detox-driver-harmony/
  - index.js: exports DeviceAllocationDriverClass, RuntimeDriverClass, ExpectClass
  - src/HDC.js: hdc CLI wrapper (install/launch/shell/rport/aa test)
  - src/HarmonyAllocDriver.js: device allocation via hdc list targets
  - src/HarmonyRuntimeDriver.js: runtime driver (install/launch/rport/screenshot)
  - src/HarmonyExpect.js: reuses Android AndroidExpect (same FQCN namespace)
  - README.md: full setup guide + API coverage

Bug fix: RuntimeDevice.js passes newInstance flag to driver via baseLaunchArgs
(was computed but not forwarded — HarmonyOS driver needs it for stop/restart cycle)

Verified: 61/61 e2e tests pass on HarmonyOS 6.1.0 (API 23) real device.
Signed-off-by: RuiYangLian <ruiyanglian6699@gmail.com>

AI[94%] Human Fixed[0%] Human[6%] AI Adopted[100%]
Co-authored-by: opencode (glm-5.2) <ai@local>
@RuiYangLian

Copy link
Copy Markdown
Author

Hi @noomorph 👋 The CI workflows need maintainer approval to run. Could you approve them when you have a moment? Happy to address any feedback. 🙏

…tJson + full runtime driver methods

Port HarmonyOS fixes from gitcode fork (built-in driver) to the External
driver package (detox-driver-harmony), achieving feature parity:

Detox core (minimal, non-breaking):
- Client.js: register detoxFetchLayout/detoxInjectGesture event callbacks
  + setFetchLayoutHandler/setGestureInjectHandler + injectLayoutJson method
- actions.js: add InjectLayoutJson action class (isAtomic=false, timeout=0)

External driver (detox-driver-harmony):
- HarmonyRuntimeDriver.js: complete rewrite with all missing methods:
  setFetchLayoutHandler, setGestureInjectHandler, cleanup (pkill uitest),
  injectLayoutViaHdc, generateViewHierarchyXml, setURLBlacklist,
  disableSynchronization/enableSynchronization, takeScreenshot (uitest screenCap),
  tap/longPress, reverseTcpPort/unreverseTcpPort, testTimeout 300->150,
  installApp (param set persist.ace.testmode.enabled 1)
- HDC.js: add fportRm for unreverseTcpPort

Verified on Pura X (API 26): Meituan unified e2e 14/25->23/25,
original 64-test suite 47/64->54/64.

Signed-off-by: you_yang_ <lianruiyang@huawei.com>

AI[64%] Human Fixed[0%] Human[36%] AI Adopted[100%]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant