Skip to content

Conversation

@growvv
Copy link
Collaborator

@growvv growvv commented Oct 30, 2025

image

@growvv growvv requested a review from Copilot October 30, 2025 12:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a UI Viewer web interface to HapTest, enabling real-time inspection of HarmonyOS UI hierarchies through a browser-based dashboard. The feature includes backend API endpoints, Express server setup, device pooling for connection management, and a frontend interface with Vue.js.

  • Adds Express-based web server with REST API for device connectivity, screenshot fetching, and hierarchy inspection
  • Implements device pooling to manage persistent connections and automatic cleanup
  • Extends CLI with ui-viewer subcommand to launch the web service
  • Provides frontend UI with interactive hierarchy tree and screenshot overlay

Reviewed Changes

Copilot reviewed 20 out of 21 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/ui/ui_viewer_server.ts Core server implementation with Express routes, device pooling, and session management
src/ui/hierarchy_builder.ts Converts component trees to hierarchical JSON and generates XPath expressions
src/model/builder/page_builder.ts Enhanced layout parsing to support multiple input formats (windows, pages, direct nodes)
src/device/device.ts Adds disconnect/teardown methods and fallback page creation
src/device/hdc.ts Adds listTargets() static method to enumerate connected devices
src/device/uidriver/*.ts Returns DriverContext instead of bare driver; adds cleanup methods
src/cli/cli.ts Adds ui-viewer subcommand with refactored command structure
test/unit/*.test.ts Comprehensive unit tests for server routes and page builder normalization
res/ui-viewer/** Frontend HTML, CSS, and JavaScript for the web interface
package.json Adds Express and type definitions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

const metaSources = [value?.attributes, value?.metadata, value, ...ancestors].filter(Boolean);
if (value.attributes && (Array.isArray(value.children) || value.children === undefined)) {
if (!Array.isArray(value.children)) {
value.children = Array.isArray(value.children) ? value.children : [];
Copy link

Copilot AI Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same redundancy as line 201. Line 277 checks !Array.isArray(value.children), so the ternary is unnecessary. Simplify to value.children = [];.

Suggested change
value.children = Array.isArray(value.children) ? value.children : [];
value.children = [];

Copilot uses AI. Check for mistakes.
@code-sunbo code-sunbo merged commit 1ceb0e9 into main Nov 1, 2025
0 of 14 checks passed
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.

3 participants